Fix formatting

This commit is contained in:
Pavle Portic 2020-03-18 14:06:33 +01:00
parent 50980cf7aa
commit 6d9ba8a1d8
Signed by: TheEdgeOfRage
GPG Key ID: 6758ACE46AA2A849
9 changed files with 117 additions and 124 deletions

View File

@ -1,4 +1,3 @@
#!/bin/zsh #!/bin/zsh
ffmpeg -n -i "$1" -acodec libmp3lame -ab 320k -map_metadata 0 -id3v2_version 3 "$2" &> /dev/null ffmpeg -n -i "$1" -acodec libmp3lame -ab 320k -map_metadata 0 -id3v2_version 3 "$2" &> /dev/null

View File

@ -2,46 +2,46 @@
function usage() function usage()
{ {
local just_help=$1 local just_help=$1
local missing_required=$2 local missing_required=$2
local invalid_argument=$3 local invalid_argument=$3
local invalid_option=$4 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 Generate random password from /dev/urandom using the character set chosen
Option (pick one character set):" Option (pick one character set):"
local help_options=" \-a ,\--all\ all printable characters, not including space local help_options="\t\-a ,\--all\ all printable characters, not including space
\-lt ,\--limited\ all except special characters [A-Za-z0-9%+,-./:=@^_] \t\-lt ,\--limited\ all except special characters [A-Za-z0-9%+,-./:=@^_]
\-an ,\--alphanumeric\ letters and digits \t\-an ,\--alphanumeric\ letters and digits
\-al ,\--alpha\ letters \t\-al ,\--alpha\ letters
\-u ,\--upper\ upper case letters \t\-u ,\--upper\ upper case letters
\-l ,\--lower\ lower case letters \t\-l ,\--lower\ lower case letters
\-n ,\--numeric\ digits \t\-n ,\--numeric\ digits
\-h ,\--hex\ hexadecimal digits \t\-h ,\--hex\ hexadecimal digits
\-c ,\--count <length>\ Length of password to generate \t\-c ,\--count <length>\ Length of password to generate
\[SET]\ \ Other character SET compatible with tr \t\[SET]\ \ Other character SET compatible with tr
" "
if [ "$missing_required" != "" ] if [ "$missing_required" != "" ]
then then
echo "Missing required argument: $missing_required" echo "Missing required argument: $missing_required"
fi fi
if [ "$invalid_option" != "" ] && [ "$invalid_value" = "" ] if [ "$invalid_option" != "" ] && [ "$invalid_value" = "" ]
then then
echo "Invalid option: $invalid_option" echo "Invalid option: $invalid_option"
elif [ "$invalid_value" != "" ] elif [ "$invalid_value" != "" ]
then then
echo "Invalid value: $invalid_value for option: --$invalid_option" echo "Invalid value: $invalid_value for option: --$invalid_option"
fi fi
echo -e " echo -e "
" "
echo "$help" echo "$help"
echo "$help_options" | column -t -s'\' echo "$help_options" | column -t -s'\'
return return
} }
function init_args() function init_args()
{ {
@ -54,80 +54,79 @@ do
key="$1" key="$1"
case $key in case $key in
-a|--all) -a|--all)
all="true" all="true"
characters="[:graph:]" characters="[:graph:]"
shift shift
;; ;;
-lt|--limited) -lt|--limited)
special="true" special="true"
characters="A-Za-z0-9%+,-./:=@^_" characters="A-Za-z0-9%+,-./:=@^_"
shift shift
;; ;;
-an|--alphanumeric) -an|--alphanumeric)
alphanumeric="true" alphanumeric="true"
characters="[:alnum:]" characters="[:alnum:]"
shift shift
;; ;;
-al|--alpha) -al|--alpha)
alpha="true" alpha="true"
characters="[:alpha:]" characters="[:alpha:]"
shift shift
;; ;;
-u|--upper) -u|--upper)
upper="true" upper="true"
characters="[:upper:]" characters="[:upper:]"
shift shift
;; ;;
-l|--lower) -l|--lower)
lower="true" lower="true"
characters="[:lower:]" characters="[:lower:]"
shift shift
;; ;;
-n|--numeric) -n|--numeric)
numeric="true" numeric="true"
characters="[:digit:]" characters="[:digit:]"
shift shift
;; ;;
-h|--hex) -h|--hex)
hex="true" hex="true"
characters="0-9a-f" characters="0-9a-f"
shift shift
;; ;;
-c|--count) -c|--count)
count="$2" count="$2"
shift 2 shift 2
;; ;;
*) *)
POSITIONAL+=("$1") # saves unknown option in array POSITIONAL+=("$1") # saves unknown option in array
shift shift
;; ;;
esac esac
done done
for i in "${REQ_ARGS[@]}"; do for i in "${REQ_ARGS[@]}"; do
# $i is the string of the variable name # $i is the string of the variable name
# ${!i} is a parameter expression to get the value # ${!i} is a parameter expression to get the value
# of the variable whose name is i. # of the variable whose name is i.
req_var=${!i} req_var=${!i}
if [ "$req_var" = "" ] if [ "$req_var" = "" ]
then then
usage "" "--$i" usage "" "--$i"
exit exit
fi fi
done done
} }
init_args $@ init_args $@
if [ -z $characters ]; then if [ -z $characters ]; then
if [ -z $POSITIONAL ]; then if [ -z $POSITIONAL ]; then
echo "Missing at least one character set" echo "Missing at least one character set"
exit 2 exit 2
else else
characters=$POSITIONAL characters=$POSITIONAL
fi fi
fi fi
< /dev/urandom tr -dc $characters | head -c $count < /dev/urandom tr -dc $characters | head -c $count

View File

@ -18,4 +18,3 @@ if (( XRES > YRES )); then
else else
convert $1 -resize x$2 $1 convert $1 -resize x$2 $1
fi fi

View File

@ -2,21 +2,21 @@
SSH_ENV="$HOME/.ssh/environment" SSH_ENV="$HOME/.ssh/environment"
function start_agent { function start_agent {
echo "Initialising new SSH agent..." echo "Initialising new SSH agent..."
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}" /usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
echo succeeded echo succeeded
chmod 600 "${SSH_ENV}" chmod 600 "${SSH_ENV}"
. "${SSH_ENV}" > /dev/null . "${SSH_ENV}" > /dev/null
} }
# Source SSH settings, if applicable # Source SSH settings, if applicable
if [ -f "${SSH_ENV}" ]; then if [ -f "${SSH_ENV}" ]; then
. "${SSH_ENV}" > /dev/null . "${SSH_ENV}" > /dev/null
#ps ${SSH_AGENT_PID} doesn't work under cywgin #ps ${SSH_AGENT_PID} doesn't work under cywgin
ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || { ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {
start_agent; start_agent;
} }
else else
start_agent; start_agent;
fi fi

View File

@ -13,31 +13,30 @@
# first the system ones: # first the system ones:
print "ANSI colors:\n"; print "ANSI colors:\n";
for ($color = 0; $color < 8; $color++) { for ($color = 0; $color < 8; $color++) {
print "\x1b[48;5;${color}m "; print "\x1b[48;5;${color}m ";
} }
print "\x1b[0m\n"; print "\x1b[0m\n";
for ($color = 8; $color < 16; $color++) { for ($color = 8; $color < 16; $color++) {
print "\x1b[48;5;${color}m "; print "\x1b[48;5;${color}m ";
} }
print "\x1b[0m\n\n"; print "\x1b[0m\n\n";
# now the color cube # now the color cube
print "Color cube, 6x6x6:\n"; print "Color cube, 6x6x6:\n";
for ($green = 0; $green < 6; $green++) { for ($green = 0; $green < 6; $green++) {
for ($red = 0; $red < 6; $red++) { for ($red = 0; $red < 6; $red++) {
for ($blue = 0; $blue < 6; $blue++) { for ($blue = 0; $blue < 6; $blue++) {
$color = 16 + ($red * 36) + ($green * 6) + $blue; $color = 16 + ($red * 36) + ($green * 6) + $blue;
print "\x1b[48;5;${color}m "; print "\x1b[48;5;${color}m ";
}
print "\x1b[0m ";
} }
print "\x1b[0m "; print "\n";
}
print "\n";
} }
# now the grayscale ramp # now the grayscale ramp
print "Grayscale ramp:\n"; print "Grayscale ramp:\n";
for ($color = 232; $color < 256; $color++) { for ($color = 232; $color < 256; $color++) {
print "\x1b[48;5;${color}m "; print "\x1b[48;5;${color}m ";
} }
print "\x1b[0m\n"; print "\x1b[0m\n";

View File

@ -14,4 +14,3 @@ awk -v term_cols="${width:-$(tput cols || echo 80)}" 'BEGIN{
} }
printf "\n"; printf "\n";
}' }'

View File

@ -231,7 +231,6 @@ function! UserConfig()
autocmd Filetype php setl et ts=4 sw=4 sts=4 tw=0 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 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 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 tex setl et ts=4 sts=4 sw=4
autocmd Filetype nginx setl noet ts=4 sts=4 sw=4 autocmd Filetype nginx setl noet ts=4 sts=4 sw=4
augroup END augroup END
@ -284,9 +283,10 @@ function! UserConfig()
\ 'cpp': ['gcc'], \ 'cpp': ['gcc'],
\ 'vue': ['eslint'], \ 'vue': ['eslint'],
\ 'javascript': ['eslint'], \ 'javascript': ['eslint'],
\ 'cloudformation': ['cloudformation'],
\ } \ }
let g:ale_lint_on_insert_leave = 1 let g:ale_lint_on_insert_leave = 1
let g:ale_fix_on_save = 0 let g:ale_fix_on_save = 1
" fzf config " fzf config
let g:fzf_colors = { let g:fzf_colors = {
@ -323,4 +323,3 @@ function! UserConfig()
let g:Hexokinase_ftAutoload = ['css', 'scss', 'sass', 'stylus'] let g:Hexokinase_ftAutoload = ['css', 'scss', 'sass', 'stylus']
endfunction endfunction

View File

@ -20,7 +20,7 @@ xhost +localhost
xhost +calcium xhost +calcium
xhost +neon xhost +neon
xbindkeys xbindkeys
feh --bg-fill /home/pavle/pictures/wallpapers/arboreal_serenity.jpg feh --bg-fill /home/pavle/pictures/wallpapers/ltt.png
dunst & dunst &
exec i3 exec i3

View File

@ -152,4 +152,3 @@ export FZF_DEFAULT_OPTS='
' '
source ~/.local/bin/start-ssh-agent source ~/.local/bin/start-ssh-agent