Fix formatting
This commit is contained in:
parent
50980cf7aa
commit
6d9ba8a1d8
|
@ -1,4 +1,3 @@
|
|||
#!/bin/zsh
|
||||
|
||||
ffmpeg -n -i "$1" -acodec libmp3lame -ab 320k -map_metadata 0 -id3v2_version 3 "$2" &> /dev/null
|
||||
|
||||
|
|
|
@ -2,46 +2,46 @@
|
|||
|
||||
function usage()
|
||||
{
|
||||
local just_help=$1
|
||||
local missing_required=$2
|
||||
local invalid_argument=$3
|
||||
local invalid_option=$4
|
||||
local just_help=$1
|
||||
local missing_required=$2
|
||||
local invalid_argument=$3
|
||||
local invalid_option=$4
|
||||
|
||||
local help="Usage: genpass -c COUNT [OPTION] [SET]
|
||||
local help="Usage: genpass -c COUNT [OPTION] [SET]
|
||||
|
||||
Generate random password from /dev/urandom using the character set chosen
|
||||
|
||||
Option (pick one character set):"
|
||||
local help_options=" \-a ,\--all\ all printable characters, not including space
|
||||
\-lt ,\--limited\ all except special characters [A-Za-z0-9%+,-./:=@^_]
|
||||
\-an ,\--alphanumeric\ letters and digits
|
||||
\-al ,\--alpha\ letters
|
||||
\-u ,\--upper\ upper case letters
|
||||
\-l ,\--lower\ lower case letters
|
||||
\-n ,\--numeric\ digits
|
||||
\-h ,\--hex\ hexadecimal digits
|
||||
\-c ,\--count <length>\ Length of password to generate
|
||||
\[SET]\ \ Other character SET compatible with tr
|
||||
local help_options="\t\-a ,\--all\ all printable characters, not including space
|
||||
\t\-lt ,\--limited\ all except special characters [A-Za-z0-9%+,-./:=@^_]
|
||||
\t\-an ,\--alphanumeric\ letters and digits
|
||||
\t\-al ,\--alpha\ letters
|
||||
\t\-u ,\--upper\ upper case letters
|
||||
\t\-l ,\--lower\ lower case letters
|
||||
\t\-n ,\--numeric\ digits
|
||||
\t\-h ,\--hex\ hexadecimal digits
|
||||
\t\-c ,\--count <length>\ Length of password to generate
|
||||
\t\[SET]\ \ Other character SET compatible with tr
|
||||
"
|
||||
|
||||
if [ "$missing_required" != "" ]
|
||||
then
|
||||
echo "Missing required argument: $missing_required"
|
||||
fi
|
||||
if [ "$missing_required" != "" ]
|
||||
then
|
||||
echo "Missing required argument: $missing_required"
|
||||
fi
|
||||
|
||||
if [ "$invalid_option" != "" ] && [ "$invalid_value" = "" ]
|
||||
then
|
||||
echo "Invalid option: $invalid_option"
|
||||
elif [ "$invalid_value" != "" ]
|
||||
then
|
||||
echo "Invalid value: $invalid_value for option: --$invalid_option"
|
||||
fi
|
||||
if [ "$invalid_option" != "" ] && [ "$invalid_value" = "" ]
|
||||
then
|
||||
echo "Invalid option: $invalid_option"
|
||||
elif [ "$invalid_value" != "" ]
|
||||
then
|
||||
echo "Invalid value: $invalid_value for option: --$invalid_option"
|
||||
fi
|
||||
|
||||
echo -e "
|
||||
echo -e "
|
||||
"
|
||||
echo "$help"
|
||||
echo "$help_options" | column -t -s'\'
|
||||
return
|
||||
echo "$help"
|
||||
echo "$help_options" | column -t -s'\'
|
||||
return
|
||||
}
|
||||
function init_args()
|
||||
{
|
||||
|
@ -54,80 +54,79 @@ do
|
|||
key="$1"
|
||||
|
||||
case $key in
|
||||
-a|--all)
|
||||
all="true"
|
||||
characters="[:graph:]"
|
||||
shift
|
||||
;;
|
||||
-lt|--limited)
|
||||
special="true"
|
||||
characters="A-Za-z0-9%+,-./:=@^_"
|
||||
shift
|
||||
;;
|
||||
-an|--alphanumeric)
|
||||
alphanumeric="true"
|
||||
characters="[:alnum:]"
|
||||
shift
|
||||
;;
|
||||
-al|--alpha)
|
||||
alpha="true"
|
||||
characters="[:alpha:]"
|
||||
shift
|
||||
;;
|
||||
-u|--upper)
|
||||
upper="true"
|
||||
characters="[:upper:]"
|
||||
shift
|
||||
;;
|
||||
-l|--lower)
|
||||
lower="true"
|
||||
characters="[:lower:]"
|
||||
shift
|
||||
;;
|
||||
-n|--numeric)
|
||||
numeric="true"
|
||||
characters="[:digit:]"
|
||||
shift
|
||||
;;
|
||||
-h|--hex)
|
||||
hex="true"
|
||||
characters="0-9a-f"
|
||||
shift
|
||||
;;
|
||||
-c|--count)
|
||||
count="$2"
|
||||
shift 2
|
||||
;;
|
||||
*)
|
||||
POSITIONAL+=("$1") # saves unknown option in array
|
||||
shift
|
||||
;;
|
||||
-a|--all)
|
||||
all="true"
|
||||
characters="[:graph:]"
|
||||
shift
|
||||
;;
|
||||
-lt|--limited)
|
||||
special="true"
|
||||
characters="A-Za-z0-9%+,-./:=@^_"
|
||||
shift
|
||||
;;
|
||||
-an|--alphanumeric)
|
||||
alphanumeric="true"
|
||||
characters="[:alnum:]"
|
||||
shift
|
||||
;;
|
||||
-al|--alpha)
|
||||
alpha="true"
|
||||
characters="[:alpha:]"
|
||||
shift
|
||||
;;
|
||||
-u|--upper)
|
||||
upper="true"
|
||||
characters="[:upper:]"
|
||||
shift
|
||||
;;
|
||||
-l|--lower)
|
||||
lower="true"
|
||||
characters="[:lower:]"
|
||||
shift
|
||||
;;
|
||||
-n|--numeric)
|
||||
numeric="true"
|
||||
characters="[:digit:]"
|
||||
shift
|
||||
;;
|
||||
-h|--hex)
|
||||
hex="true"
|
||||
characters="0-9a-f"
|
||||
shift
|
||||
;;
|
||||
-c|--count)
|
||||
count="$2"
|
||||
shift 2
|
||||
;;
|
||||
*)
|
||||
POSITIONAL+=("$1") # saves unknown option in array
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
for i in "${REQ_ARGS[@]}"; do
|
||||
# $i is the string of the variable name
|
||||
# ${!i} is a parameter expression to get the value
|
||||
# of the variable whose name is i.
|
||||
req_var=${!i}
|
||||
if [ "$req_var" = "" ]
|
||||
then
|
||||
usage "" "--$i"
|
||||
exit
|
||||
fi
|
||||
# $i is the string of the variable name
|
||||
# ${!i} is a parameter expression to get the value
|
||||
# of the variable whose name is i.
|
||||
req_var=${!i}
|
||||
if [ "$req_var" = "" ]
|
||||
then
|
||||
usage "" "--$i"
|
||||
exit
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
init_args $@
|
||||
|
||||
if [ -z $characters ]; then
|
||||
if [ -z $POSITIONAL ]; then
|
||||
echo "Missing at least one character set"
|
||||
exit 2
|
||||
else
|
||||
characters=$POSITIONAL
|
||||
fi
|
||||
if [ -z $POSITIONAL ]; then
|
||||
echo "Missing at least one character set"
|
||||
exit 2
|
||||
else
|
||||
characters=$POSITIONAL
|
||||
fi
|
||||
fi
|
||||
|
||||
< /dev/urandom tr -dc $characters | head -c $count
|
||||
|
||||
|
|
|
@ -18,4 +18,3 @@ if (( XRES > YRES )); then
|
|||
else
|
||||
convert $1 -resize x$2 $1
|
||||
fi
|
||||
|
||||
|
|
|
@ -2,21 +2,21 @@
|
|||
SSH_ENV="$HOME/.ssh/environment"
|
||||
|
||||
function start_agent {
|
||||
echo "Initialising new SSH agent..."
|
||||
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
|
||||
echo succeeded
|
||||
chmod 600 "${SSH_ENV}"
|
||||
. "${SSH_ENV}" > /dev/null
|
||||
echo "Initialising new SSH agent..."
|
||||
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
|
||||
echo succeeded
|
||||
chmod 600 "${SSH_ENV}"
|
||||
. "${SSH_ENV}" > /dev/null
|
||||
}
|
||||
|
||||
# Source SSH settings, if applicable
|
||||
|
||||
if [ -f "${SSH_ENV}" ]; then
|
||||
. "${SSH_ENV}" > /dev/null
|
||||
#ps ${SSH_AGENT_PID} doesn't work under cywgin
|
||||
ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {
|
||||
start_agent;
|
||||
}
|
||||
. "${SSH_ENV}" > /dev/null
|
||||
#ps ${SSH_AGENT_PID} doesn't work under cywgin
|
||||
ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {
|
||||
start_agent;
|
||||
}
|
||||
else
|
||||
start_agent;
|
||||
start_agent;
|
||||
fi
|
||||
|
|
|
@ -13,31 +13,30 @@
|
|||
# first the system ones:
|
||||
print "ANSI colors:\n";
|
||||
for ($color = 0; $color < 8; $color++) {
|
||||
print "\x1b[48;5;${color}m ";
|
||||
print "\x1b[48;5;${color}m ";
|
||||
}
|
||||
print "\x1b[0m\n";
|
||||
for ($color = 8; $color < 16; $color++) {
|
||||
print "\x1b[48;5;${color}m ";
|
||||
print "\x1b[48;5;${color}m ";
|
||||
}
|
||||
print "\x1b[0m\n\n";
|
||||
|
||||
# now the color cube
|
||||
print "Color cube, 6x6x6:\n";
|
||||
for ($green = 0; $green < 6; $green++) {
|
||||
for ($red = 0; $red < 6; $red++) {
|
||||
for ($blue = 0; $blue < 6; $blue++) {
|
||||
$color = 16 + ($red * 36) + ($green * 6) + $blue;
|
||||
print "\x1b[48;5;${color}m ";
|
||||
for ($red = 0; $red < 6; $red++) {
|
||||
for ($blue = 0; $blue < 6; $blue++) {
|
||||
$color = 16 + ($red * 36) + ($green * 6) + $blue;
|
||||
print "\x1b[48;5;${color}m ";
|
||||
}
|
||||
print "\x1b[0m ";
|
||||
}
|
||||
print "\x1b[0m ";
|
||||
}
|
||||
print "\n";
|
||||
print "\n";
|
||||
}
|
||||
|
||||
# now the grayscale ramp
|
||||
print "Grayscale ramp:\n";
|
||||
for ($color = 232; $color < 256; $color++) {
|
||||
print "\x1b[48;5;${color}m ";
|
||||
print "\x1b[48;5;${color}m ";
|
||||
}
|
||||
print "\x1b[0m\n";
|
||||
|
||||
|
|
|
@ -14,4 +14,3 @@ awk -v term_cols="${width:-$(tput cols || echo 80)}" 'BEGIN{
|
|||
}
|
||||
printf "\n";
|
||||
}'
|
||||
|
||||
|
|
|
@ -231,7 +231,6 @@ function! UserConfig()
|
|||
autocmd Filetype php setl et ts=4 sw=4 sts=4 tw=0
|
||||
autocmd Filetype c,cpp setl noet ts=4 sts=4 sw=4
|
||||
autocmd Filetype rst setl autoindent& cindent& smartindent& indentexpr& et ts=4 sts=4 sw=4
|
||||
autocmd Filetype markdown setl et ts=2 sts=2 sw=2
|
||||
autocmd Filetype tex setl et ts=4 sts=4 sw=4
|
||||
autocmd Filetype nginx setl noet ts=4 sts=4 sw=4
|
||||
augroup END
|
||||
|
@ -284,9 +283,10 @@ function! UserConfig()
|
|||
\ 'cpp': ['gcc'],
|
||||
\ 'vue': ['eslint'],
|
||||
\ 'javascript': ['eslint'],
|
||||
\ 'cloudformation': ['cloudformation'],
|
||||
\ }
|
||||
let g:ale_lint_on_insert_leave = 1
|
||||
let g:ale_fix_on_save = 0
|
||||
let g:ale_fix_on_save = 1
|
||||
|
||||
" fzf config
|
||||
let g:fzf_colors = {
|
||||
|
@ -323,4 +323,3 @@ function! UserConfig()
|
|||
let g:Hexokinase_ftAutoload = ['css', 'scss', 'sass', 'stylus']
|
||||
|
||||
endfunction
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ xhost +localhost
|
|||
xhost +calcium
|
||||
xhost +neon
|
||||
xbindkeys
|
||||
feh --bg-fill /home/pavle/pictures/wallpapers/arboreal_serenity.jpg
|
||||
feh --bg-fill /home/pavle/pictures/wallpapers/ltt.png
|
||||
dunst &
|
||||
|
||||
exec i3
|
||||
|
|
Loading…
Reference in New Issue