Modifications
This commit is contained in:
parent
e54bebad64
commit
f5af1d9952
@ -144,7 +144,9 @@ set $yw #ccdc90
|
|||||||
set $gn #88b090
|
set $gn #88b090
|
||||||
set $rd #e89393
|
set $rd #e89393
|
||||||
# border background text
|
# border background text
|
||||||
client.focused #2f2f2f #2f2f2f #ffffff
|
#client.focused #2f2f2f #2f2f2f #ffffff
|
||||||
|
#client.focused #ffffff #ffffff #000000
|
||||||
|
client.focused #6a6a6a #6a6a6a #ffffff
|
||||||
client.unfocused $bg $bg $ia
|
client.unfocused $bg $bg $ia
|
||||||
client.focused_inactive $bg $bg $ac
|
client.focused_inactive $bg $bg $ac
|
||||||
client.urgent $rd $rd $tx
|
client.urgent $rd $rd $tx
|
||||||
@ -223,7 +225,7 @@ exec --no-startup-id /usr/bin/numlockx
|
|||||||
# Run firefox/firefox-bin
|
# Run firefox/firefox-bin
|
||||||
exec --no-startup-id firefox -p a || firefox-bin -p a
|
exec --no-startup-id firefox -p a || firefox-bin -p a
|
||||||
# Start syncthing if it hasn't already been started
|
# Start syncthing if it hasn't already been started
|
||||||
#exec --no-startup-id /bin/zsh -c 'pidof syncthing||screen -dmS syncthing ~/bin/syncthing'
|
exec --no-startup-id /bin/zsh -c 'pidof syncthing||screen -dmS syncthing ~/bin/syncthing'
|
||||||
exec --no-startup-id nextcloud
|
exec --no-startup-id nextcloud
|
||||||
# Start kdeconnect
|
# Start kdeconnect
|
||||||
#exec --no-startup-id "~/bin/indicator-kdeconnect"
|
#exec --no-startup-id "~/bin/indicator-kdeconnect"
|
||||||
|
@ -1,5 +1,22 @@
|
|||||||
#!/usr/bin/env zsh
|
#!/usr/bin/env zsh
|
||||||
if [ "$1" = "lock" ];then
|
ARG="$1"
|
||||||
|
shift
|
||||||
|
if [ "$ARG" = "move" ]; then
|
||||||
|
shift
|
||||||
|
eval "$(xdotool getwindowfocus getwindowgeometry | grep Geometry: | perl -pe 's/^\s*Geometry: /WinH=/;s/x/\nWinW=/g')"
|
||||||
|
eval "$(xdotool getwindowfocus getwindowgeometry | grep Position: | perl -pe 's/^\s*Position: /WinY=/;s/,/\nWinX=/g;s/\s\(.+//')"
|
||||||
|
eval "$(xrandr | grep -w connected | perl -pe 's/.+?(\d+x\d+)\+\d+\+\d+.*/\1/g;s/^/MonH=/;s/x/\nMonW=/;' | head -n2)"
|
||||||
|
if [ "$ARG" = "top" ]; then
|
||||||
|
echo $((WinY))
|
||||||
|
xdotool getwindowfocus windowmove $((WinY - 1)) 0
|
||||||
|
elif [ "$ARG" = "right" ]; then
|
||||||
|
xdotool getwindowfocus windowmove $((MonH - WinH)) $((WinX - 1))
|
||||||
|
elif [ "$ARG" = "left" ]; then
|
||||||
|
xdotool getwindowfocus windowmove 0 $((WinX - 1))
|
||||||
|
elif [ "$ARG" = "bottom" ]; then
|
||||||
|
xdotool getwindowfocus windowmove $((WinY - 1)) $((MonW - WinW))
|
||||||
|
fi
|
||||||
|
elif [ "$ARG" = "lock" ];then
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
declare -i ID
|
declare -i ID
|
||||||
@ -14,19 +31,19 @@ if [ "$1" = "lock" ];then
|
|||||||
echo "Touchpad enabled."
|
echo "Touchpad enabled."
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ "$1" = "pass" ];then
|
if [ "$ARG" = "pass" ];then
|
||||||
pass -c $(ls ~/.password-store/*/*|cut -b-37 --complement|rofi -dmenu|sed -e 's/\.gpg//')
|
pass -c $(ls ~/.password-store/*/*|cut -b-37 --complement|rofi -dmenu|sed -e 's/\.gpg//')
|
||||||
fi
|
fi
|
||||||
if [ "$1" = "screensaver" ];then
|
if [ "$ARG" = "screensaver" ];then
|
||||||
cat /tmp/noss||i3lock -di `shuf -n1 -e ~/.i3/wall/*`
|
cat /tmp/noss||i3lock -di `shuf -n1 -e ~/.i3/wall/*`
|
||||||
fi
|
fi
|
||||||
if [ "$1" = "wall" ];then
|
if [ "$ARG" = "wall" ];then
|
||||||
#if [[ -d ~/.i3/wallOM ]];then feh --bg-scale "`shuf -n1 -e ~/.i3/wallOM/*`";else feh --bg-scale "`shuf -n1 -e ~/.i3/wall/*`";fi;
|
#if [[ -d ~/.i3/wallOM ]];then feh --bg-scale "`shuf -n1 -e ~/.i3/wallOM/*`";else feh --bg-scale "`shuf -n1 -e ~/.i3/wall/*`";fi;
|
||||||
#feh --bg-scale "$(shuf -n1 -e ~/.i3/wallOM/*)"
|
#feh --bg-scale "$(shuf -n1 -e ~/.i3/wallOM/*)"
|
||||||
#feh --bg-scale ~/.i3/image.png
|
#feh --bg-scale ~/.i3/image.png
|
||||||
feh --bg-scale "$(shuf -n1 <(realpath /home/stonewareslord/sync/wallpaper/"$(hostname)"/*))"
|
feh --bg-scale "$(shuf -n1 <(realpath /home/stonewareslord/sync/wallpaper/"$(hostname)"/*))"
|
||||||
fi
|
fi
|
||||||
if [ "$1" = "swap" ];then
|
if [ "$ARG" = "swap" ];then
|
||||||
python << EOF
|
python << EOF
|
||||||
import i3
|
import i3
|
||||||
swap = [output for output in i3.get_outputs() if output['active']]
|
swap = [output for output in i3.get_outputs() if output['active']]
|
||||||
@ -36,7 +53,7 @@ if len(swap) == 2:
|
|||||||
i3.command('move', 'workspace to output right')
|
i3.command('move', 'workspace to output right')
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
if [ "$1" = "boot" ];then
|
if [ "$ARG" = "boot" ];then
|
||||||
test -f ~/.screenlayout/default.sh && ~/.screenlayout/default.sh
|
test -f ~/.screenlayout/default.sh && ~/.screenlayout/default.sh
|
||||||
/usr/bin/xset -b
|
/usr/bin/xset -b
|
||||||
/usr/bin/xset +fp /usr/share/fonts/X11/misc
|
/usr/bin/xset +fp /usr/share/fonts/X11/misc
|
||||||
@ -58,7 +75,7 @@ if [ "$1" = "boot" ];then
|
|||||||
xinput --set-prop 'Logitech USB Optical Mouse' 'Device Accel Constant Deceleration' 3
|
xinput --set-prop 'Logitech USB Optical Mouse' 'Device Accel Constant Deceleration' 3
|
||||||
$(which ck-launch-session 2>/dev/null) $(which i3)
|
$(which ck-launch-session 2>/dev/null) $(which i3)
|
||||||
fi
|
fi
|
||||||
if [ "$1" = "screen-lock" ];then
|
if [ "$ARG" = "screen-lock" ];then
|
||||||
revert(){
|
revert(){
|
||||||
xset dpms 0 0 0
|
xset dpms 0 0 0
|
||||||
}
|
}
|
||||||
@ -67,11 +84,11 @@ if [ "$1" = "screen-lock" ];then
|
|||||||
slock
|
slock
|
||||||
revert
|
revert
|
||||||
fi
|
fi
|
||||||
if [ "$1" = "paste" ]; then
|
if [ "$ARG" = "paste" ]; then
|
||||||
sleep 2
|
sleep 2
|
||||||
DISPLAY=:0.0 xdotool type --clearmodifiers --file <(xsel)
|
DISPLAY=:0.0 xdotool type --clearmodifiers --file <(xsel)
|
||||||
fi
|
fi
|
||||||
if [ "$1" = "ping" ]; then
|
if [ "$ARG" = "ping" ]; then
|
||||||
shift
|
shift
|
||||||
# Return code
|
# Return code
|
||||||
local RET=0
|
local RET=0
|
||||||
@ -80,35 +97,35 @@ if [ "$1" = "ping" ]; then
|
|||||||
# -4 : ipv4 only
|
# -4 : ipv4 only
|
||||||
# check if nc has -z
|
# check if nc has -z
|
||||||
if nc -h |& grep -q -- -z; then
|
if nc -h |& grep -q -- -z; then
|
||||||
nc -w 1 -z4 "$1" "$2" >& /dev/null && RET=1
|
nc -w 1 -z4 "$ARG" "$1" >& /dev/null && RET=1
|
||||||
# check if nc has --transfer (-x)
|
# check if nc has --transfer (-x)
|
||||||
elif nc -h |& grep -q -- --transfer; then
|
elif nc -h |& grep -q -- --transfer; then
|
||||||
nc -w 1 -4 "$1" "$2" -x </dev/null >& /dev/null && RET=1
|
nc -w 1 -4 "$ARG" "$1" -x </dev/null >& /dev/null && RET=1
|
||||||
fi
|
fi
|
||||||
echo $RET
|
echo $RET
|
||||||
fi
|
fi
|
||||||
if [ "$1" = "ip" ]; then
|
if [ "$ARG" = "ip" ]; then
|
||||||
shift
|
shift
|
||||||
local RET=0
|
local RET=0
|
||||||
if [ "$(hostname)" = "MMLin" ]; then
|
if [ "$(hostname)" = "MMLin" ]; then
|
||||||
if grep -q "$1" < <(ifconfig enp2s0f0); then
|
if grep -q "$ARG" < <(ifconfig enp2s0f0); then
|
||||||
RET=1
|
RET=1
|
||||||
fi
|
fi
|
||||||
elif [ "$(hostname)" = "G2" ]; then
|
elif [ "$(hostname)" = "G2" ]; then
|
||||||
if grep -q "$1" < <(ifconfig enp1s0;ifconfig wlp2s0); then
|
if grep -q "$ARG" < <(ifconfig enp1s0;ifconfig wlp2s0); then
|
||||||
RET=1
|
RET=1
|
||||||
fi
|
fi
|
||||||
elif [ "$(hostname)" = "SGen" ]; then
|
elif [ "$(hostname)" = "SGen" ]; then
|
||||||
if grep -q "$1" < <(ifconfig enp0s25); then
|
if grep -q "$ARG" < <(ifconfig enp0s25); then
|
||||||
RET=1
|
RET=1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
echo $RET
|
echo $RET
|
||||||
fi
|
fi
|
||||||
if [ "$1" = "copy" ]; then
|
if [ "$ARG" = "copy" ]; then
|
||||||
(printf '-chegg ';xsel | perl -pe 's/[^a-zA-Z ]//g;chomp()') | xsel && notify-send "Copied" || notify-send "Error"
|
(printf '-chegg ';xsel | perl -pe 's/[^a-zA-Z ]//g;chomp()') | xsel && notify-send "Copied" || notify-send "Error"
|
||||||
fi
|
fi
|
||||||
if [ "$1" = "screenshot" ]; then
|
if [ "$ARG" = "screenshot" ]; then
|
||||||
\rm -f ~/last-photo/*(N)
|
\rm -f ~/last-photo/*(N)
|
||||||
sleep .2
|
sleep .2
|
||||||
#DISPLAY=:0.0 xfce4-screenshooter -r -s ~/last-photo
|
#DISPLAY=:0.0 xfce4-screenshooter -r -s ~/last-photo
|
||||||
@ -118,7 +135,7 @@ if [ "$1" = "screenshot" ]; then
|
|||||||
#DISPLAY=:0.0 scrot -s "$HOME/last-photo/$(date +'%Y-%m-%d_%T').png"
|
#DISPLAY=:0.0 scrot -s "$HOME/last-photo/$(date +'%Y-%m-%d_%T').png"
|
||||||
\cp ~/last-photo/* ~/Pictures
|
\cp ~/last-photo/* ~/Pictures
|
||||||
fi
|
fi
|
||||||
if [ "$1" = "shutdownprompt" ]; then
|
if [ "$ARG" = "shutdownprompt" ]; then
|
||||||
RESP=$(printf 'Sleep\nNMRestart\nShutdown\nRestart\nLogout\n' | rofi -i -dmenu 2>/dev/null)
|
RESP=$(printf 'Sleep\nNMRestart\nShutdown\nRestart\nLogout\n' | rofi -i -dmenu 2>/dev/null)
|
||||||
if [[ ! -z "$RESP" ]]; then
|
if [[ ! -z "$RESP" ]]; then
|
||||||
case "$RESP" in
|
case "$RESP" in
|
||||||
@ -143,13 +160,13 @@ if [ "$1" = "shutdownprompt" ]; then
|
|||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ "$1" = "run" ]; then
|
if [ "$ARG" = "run" ]; then
|
||||||
PATH="$HOME/bin:/usr/games/bin:$PATH" rofi -show run
|
PATH="$HOME/bin:/usr/games/bin:$PATH" rofi -show run
|
||||||
fi
|
fi
|
||||||
if [ "$1" = "window" ]; then
|
if [ "$ARG" = "window" ]; then
|
||||||
rofi -show window
|
rofi -show window
|
||||||
fi
|
fi
|
||||||
if [ "$1" = "clip" ]; then
|
if [ "$ARG" = "clip" ]; then
|
||||||
# Get the rofi-selected index of what to paste
|
# Get the rofi-selected index of what to paste
|
||||||
local INDEX="$(gpaste-client --oneline | colrm 80 | rofi -dmenu | perl -pe 's/:.*//')"
|
local INDEX="$(gpaste-client --oneline | colrm 80 | rofi -dmenu | perl -pe 's/:.*//')"
|
||||||
# If they made a selection, select it
|
# If they made a selection, select it
|
||||||
@ -157,3 +174,24 @@ if [ "$1" = "clip" ]; then
|
|||||||
gpaste-client select "$INDEX"
|
gpaste-client select "$INDEX"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
if [ "$ARG" = "ssh_helper" ]; then
|
||||||
|
if command -v iwgetid >/dev/null; then
|
||||||
|
SSID="$(iwgetid wlan0 -r)"
|
||||||
|
elif command -v nmcli >/dev/null; then
|
||||||
|
SSID="$(nmcli -t -f active,ssid dev wifi | perl -ne 'print if s/yes://;')"
|
||||||
|
fi
|
||||||
|
case "$(hostname)" in
|
||||||
|
sgen|egen|runner2)
|
||||||
|
SSID=ATTskUYuI2
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
logger "Found SSID for $(hostname): $SSID"
|
||||||
|
case "$SSID" in
|
||||||
|
ATTskUYuI2)
|
||||||
|
ssh -q -W "${1}" "${2}@192.168.1.200"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
ssh -q -W "${1}" -p 23 "${2}@austenwares.com"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
37
skel/.vimrc
37
skel/.vimrc
@ -6,7 +6,6 @@ endif
|
|||||||
"let g:formatters_cpp = ['my_custom_cpp']
|
"let g:formatters_cpp = ['my_custom_cpp']
|
||||||
"let g:formatdef_my_custom_java = '"astyle --mode=java -xc --style=google -j -s2 -xG -S -K -N -xn -xl -n -p -H"'
|
"let g:formatdef_my_custom_java = '"astyle --mode=java -xc --style=google -j -s2 -xG -S -K -N -xn -xl -n -p -H"'
|
||||||
"let g:formatters_java = ['my_custom_java']
|
"let g:formatters_java = ['my_custom_java']
|
||||||
"let g:UltiSnipsUsePythonVersion=3
|
|
||||||
command! WW %!sudo tee > /dev/null %
|
command! WW %!sudo tee > /dev/null %
|
||||||
"TODO: Fix this
|
"TODO: Fix this
|
||||||
"let g:rbpt_loadcmd_toggle = 1
|
"let g:rbpt_loadcmd_toggle = 1
|
||||||
@ -118,6 +117,8 @@ set grepprg=grep\ -nH\ $*
|
|||||||
" Trial mappings {
|
" Trial mappings {
|
||||||
"nnoremap <Leader>o m`o<Esc>``
|
"nnoremap <Leader>o m`o<Esc>``
|
||||||
"nnoremap <Leader>O m`O<Esc>``
|
"nnoremap <Leader>O m`O<Esc>``
|
||||||
|
" Always search in the forward direction
|
||||||
|
nnoremap # #/<CR><C-o>
|
||||||
" }
|
" }
|
||||||
|
|
||||||
|
|
||||||
@ -175,6 +176,8 @@ set grepprg=grep\ -nH\ $*
|
|||||||
syntax on
|
syntax on
|
||||||
" }
|
" }
|
||||||
|
|
||||||
|
"lacheck does not work
|
||||||
|
let b:ale_linters = {'tex': [ "alex", "chktex", "proselint", "redpen", "vale", "write-good" ]}
|
||||||
"Polyglot conflicts with another latex editor
|
"Polyglot conflicts with another latex editor
|
||||||
let g:polyglot_disabled = ['latex']
|
let g:polyglot_disabled = ['latex']
|
||||||
"Signify
|
"Signify
|
||||||
@ -187,29 +190,29 @@ let g:signify_difftool = 'diff'
|
|||||||
" \ 'file': '\v\.(exe|so|dll|class)$',
|
" \ 'file': '\v\.(exe|so|dll|class)$',
|
||||||
" \ 'link': 'SOME_BAD_SYMBOLIC_LINKS',
|
" \ 'link': 'SOME_BAD_SYMBOLIC_LINKS',
|
||||||
" \ }
|
" \ }
|
||||||
"Airline
|
|
||||||
"let g:airline_left_sep='▶'
|
|
||||||
"let g:airline_right_sep='◀'
|
|
||||||
"let g:airline#extensions#syntastic#enabled=0
|
|
||||||
"let g:ycm_show_diagnostics_ui=0
|
"let g:ycm_show_diagnostics_ui=0
|
||||||
"let g:ycm_path_to_python_interpreter='/usr/bin/python2.7'
|
"let g:ycm_path_to_python_interpreter='/usr/bin/python2.7'
|
||||||
"let g:syntastic_cpp_compiler = 'clang++'
|
|
||||||
"let g:syntastic_cpp_compiler_options = ' -std=c++11 -stdlib=libc++'
|
|
||||||
"let g:syntastic_cpp_compiler_options = ' -std=c++11'
|
|
||||||
"let g:airline#extensions#whitespace#enabled=0
|
|
||||||
"let g:airline#extensions#whitespace#show_message=0
|
|
||||||
"let g:airline#extensions#tmuxline#enabled=1
|
|
||||||
"let g:formatprg_cpp="astyle"
|
"let g:formatprg_cpp="astyle"
|
||||||
"let g:formatprg_args_expr_cpp=" --mode=c --style=1tbs -xe -k1 -j"
|
"let g:formatprg_args_expr_cpp=" --mode=c --style=1tbs -xe -k1 -j"
|
||||||
" These flags don't work for some reason
|
" These flags don't work for some reason
|
||||||
" -xn -xc -xl -S
|
" -xn -xc -xl -S
|
||||||
"inoremap <expr><Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
|
"inoremap <expr><Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
|
||||||
"inoremap <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
|
"inoremap <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
|
||||||
"let g:UltiSnipsJumpForwardTrigger="<C-S-Q>"
|
let g:UltiSnipsUsePythonVersion=3
|
||||||
|
|
||||||
|
"let g:UltiSnipsJumpForwardTrigger="<Tab>"
|
||||||
"let g:UltiSnipsExpandTrigger="<S-Tab>"
|
"let g:UltiSnipsExpandTrigger="<S-Tab>"
|
||||||
|
let g:UltiSnipsExpandTrigger = "<tab>"
|
||||||
|
let g:UltiSnipsJumpForwardTrigger = "<tab>"
|
||||||
|
let g:UltiSnipsJumpBackwardTrigger = "<s-tab>"
|
||||||
|
let g:SuperTabDefaultCompletionType = '<C-n>'
|
||||||
|
|
||||||
|
let g:AutoPairs = {'(':')', '[':']', '{':'}',"'":"'",'"':'"', '`':'`', '$':'$'}
|
||||||
|
|
||||||
|
"let g:UltiSnipsExpandTrigger="<C-n>"
|
||||||
"let g:UltiSnipsListSnippets="<C-e>"
|
"let g:UltiSnipsListSnippets="<C-e>"
|
||||||
"let g:UltiSnipsEditSplit="vertical"
|
"let g:UltiSnipsEditSplit="vertical"
|
||||||
inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
|
"inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
|
||||||
filetype off
|
filetype off
|
||||||
if has("win32")
|
if has("win32")
|
||||||
call plug#begin('~/vimfiles/plugged')
|
call plug#begin('~/vimfiles/plugged')
|
||||||
@ -239,9 +242,11 @@ endif
|
|||||||
"Fuzzy file search | https://github.com/kien/ctrlp.vim
|
"Fuzzy file search | https://github.com/kien/ctrlp.vim
|
||||||
Plug 'https://gitea.austenwares.com/vim/tabular', { 'on': 'Tab' }
|
Plug 'https://gitea.austenwares.com/vim/tabular', { 'on': 'Tab' }
|
||||||
"Quickly make tables in vim | https://github.com/godlygeek/tabular
|
"Quickly make tables in vim | https://github.com/godlygeek/tabular
|
||||||
"Plug 'https://gitea.austenwares.com/vim/UltiSnips'
|
Plug 'https://gitea.austenwares.com/vim/UltiSnips'
|
||||||
"Adds snippet support | https://github.com/sirver/UltiSnips
|
"Adds snippet support | https://github.com/sirver/UltiSnips
|
||||||
"Plug 'https://gitea.austenwares.com/vim/vim-snippets'
|
"Plug 'https://github.com/ajh17/VimCompletesMe'
|
||||||
|
"Supposed to be a good tab plugin
|
||||||
|
Plug 'https://gitea.austenwares.com/vim/vim-snippets'
|
||||||
"Add snippets | https://github.com/honza/vim-snippets
|
"Add snippets | https://github.com/honza/vim-snippets
|
||||||
Plug 'https://gitea.austenwares.com/vim/eregex.vim'
|
Plug 'https://gitea.austenwares.com/vim/eregex.vim'
|
||||||
"Real regexes in vim | https://github.com/othree/eregex.vim
|
"Real regexes in vim | https://github.com/othree/eregex.vim
|
||||||
@ -295,6 +300,8 @@ endif
|
|||||||
" Staging {
|
" Staging {
|
||||||
"Plug 'https://gitea.austenwares.com/vim/vim-symfony'
|
"Plug 'https://gitea.austenwares.com/vim/vim-symfony'
|
||||||
"Plug 'dracula/vim'
|
"Plug 'dracula/vim'
|
||||||
|
Plug 'https://gitea.austenwares.com/vim/ale'
|
||||||
|
Plug 'https://github.com/ervandew/supertab'
|
||||||
|
|
||||||
"Plug 'idanarye/vim-vebugger'
|
"Plug 'idanarye/vim-vebugger'
|
||||||
"Debugger | https://github.com/idanarye/vim-vebugger
|
"Debugger | https://github.com/idanarye/vim-vebugger
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
b-list() {
|
b-list() {
|
||||||
if [[ -z "$1" ]]; then
|
if [[ -z "$1" ]]; then
|
||||||
column -t <(borg list "$BORG_REPO")
|
column -t <(borg list "::")
|
||||||
else
|
else
|
||||||
borg list "$BORG_REPO::$1"
|
borg list "::$1"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
b-delete() {
|
b-delete() {
|
||||||
while (( $# > 0 )); do
|
while (( $# > 0 )); do
|
||||||
if [[ ! -z "$1" ]]; then
|
if [[ ! -z "$1" ]]; then
|
||||||
echo "Deleting... $1"
|
echo "Deleting... $1"
|
||||||
borg delete "$BORG_REPO::$1"
|
borg delete "::$1"
|
||||||
fi
|
fi
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
@ -24,16 +24,16 @@ b-create() {
|
|||||||
if [[ -f "/home/stonewareslord/syncthing/me/backup/$(hostname)/mount" ]]; then
|
if [[ -f "/home/stonewareslord/syncthing/me/backup/$(hostname)/mount" ]]; then
|
||||||
"$SUDO" "/home/stonewareslord/syncthing/me/backup/$(hostname)/mount"
|
"$SUDO" "/home/stonewareslord/syncthing/me/backup/$(hostname)/mount"
|
||||||
fi
|
fi
|
||||||
"$SUDO" borg create -vpsx --exclude-caches --compression lzma,7 --exclude-from "$IGNORE_FILE" $BORG_REPO::$(hostname)-$(uuidgen) / /boot /home
|
"$SUDO" borg create -vpsx --exclude-caches --compression lzma,7 --exclude-from "$IGNORE_FILE" "::$(hostname)-$(uuidgen)" / /boot /home
|
||||||
}
|
}
|
||||||
b-rename() {
|
b-rename() {
|
||||||
borg rename -v "$BORG_REPO::$1" "$2"
|
borg rename -v "::$1" "$2"
|
||||||
}
|
}
|
||||||
b-info() {
|
b-info() {
|
||||||
borg info "$BORG_REPO::$1"
|
borg info "::$1"
|
||||||
}
|
}
|
||||||
b-diff() {
|
b-diff() {
|
||||||
borg list "$BORG_REPO"
|
borg list "::"
|
||||||
echo -n "First ID: "
|
echo -n "First ID: "
|
||||||
read ID1
|
read ID1
|
||||||
echo -n "Second ID: "
|
echo -n "Second ID: "
|
||||||
@ -60,8 +60,8 @@ b-diff() {
|
|||||||
echo "FILE_SIZE_LIST2: $FILE_SIZE_LIST2"
|
echo "FILE_SIZE_LIST2: $FILE_SIZE_LIST2"
|
||||||
echo "COMPLETED_FILE1: $COMPLETED_FILE1"
|
echo "COMPLETED_FILE1: $COMPLETED_FILE1"
|
||||||
echo "COMPLETED_FILE2: $COMPLETED_FILE2"
|
echo "COMPLETED_FILE2: $COMPLETED_FILE2"
|
||||||
borg list --short "$BORG_REPO::$ID1" | pv -N "Getting List 1" > "$FILE_LIST1"
|
borg list --short "::$ID1" | pv -N "Getting List 1" > "$FILE_LIST1"
|
||||||
borg list --short "$BORG_REPO::$ID2" | pv -N "Getting List 2" > "$FILE_LIST2"
|
borg list --short "::$ID2" | pv -N "Getting List 2" > "$FILE_LIST2"
|
||||||
# Find differences and calculate them
|
# Find differences and calculate them
|
||||||
diff <(pv -cN "List 1 Diff" "$FILE_LIST1") <(pv -cN "List 1 Diff" "$FILE_LIST2") > >(ag '^<' | perl -pe 's/^< //' > "$A_DIFFS") > >(ag '^>' | perl -pe 's/^> //' > "$B_DIFFS")
|
diff <(pv -cN "List 1 Diff" "$FILE_LIST1") <(pv -cN "List 1 Diff" "$FILE_LIST2") > >(ag '^<' | perl -pe 's/^< //' > "$A_DIFFS") > >(ag '^>' | perl -pe 's/^> //' > "$B_DIFFS")
|
||||||
# Truncate everything
|
# Truncate everything
|
||||||
@ -88,7 +88,7 @@ b-diff() {
|
|||||||
echo "$COMPLETED_FILE2"
|
echo "$COMPLETED_FILE2"
|
||||||
}
|
}
|
||||||
b-size() {
|
b-size() {
|
||||||
borg list "$BORG_REPO"
|
borg list "::"
|
||||||
echo -n "ID: "
|
echo -n "ID: "
|
||||||
read ID
|
read ID
|
||||||
if [ -z "$ID" ]; then
|
if [ -z "$ID" ]; then
|
||||||
@ -101,7 +101,7 @@ b-size() {
|
|||||||
echo "FILE_LIST: $FILE_LIST"
|
echo "FILE_LIST: $FILE_LIST"
|
||||||
echo "FILE_SIZE_LIST: $FILE_SIZE_LIST"
|
echo "FILE_SIZE_LIST: $FILE_SIZE_LIST"
|
||||||
echo "COMPLETED_FILE: $COMPLETED_FILE"
|
echo "COMPLETED_FILE: $COMPLETED_FILE"
|
||||||
borg list --short "$BORG_REPO::$ID" | pv -N "Getting List" > "$FILE_LIST"
|
borg list --short "::$ID" | pv -N "Getting List" > "$FILE_LIST"
|
||||||
while read i
|
while read i
|
||||||
do
|
do
|
||||||
test -f /"$i" && du -sh /"$i" 2>/dev/null >> "$FILE_SIZE_LIST"
|
test -f /"$i" && du -sh /"$i" 2>/dev/null >> "$FILE_SIZE_LIST"
|
||||||
@ -114,8 +114,8 @@ b-size() {
|
|||||||
b-extract() {
|
b-extract() {
|
||||||
local BACKUP="$1"
|
local BACKUP="$1"
|
||||||
shift
|
shift
|
||||||
borg extract "$BORG_REPO::$BACKUP" $*
|
borg extract "::$BACKUP" $*
|
||||||
}
|
}
|
||||||
b-cmd() {
|
b-cmd() {
|
||||||
echo "$BORG_REPO" $*
|
echo "::" $*
|
||||||
}
|
}
|
||||||
|
364
skel/.zshrc
364
skel/.zshrc
@ -15,21 +15,12 @@ export HISTFILE="$HOME/.zsh_history"
|
|||||||
setopt APPEND_HISTORY
|
setopt APPEND_HISTORY
|
||||||
setopt EXTENDED_HISTORY
|
setopt EXTENDED_HISTORY
|
||||||
setopt APPEND_HISTORY SHARE_HISTORY HISTIGNOREALLDUPS
|
setopt APPEND_HISTORY SHARE_HISTORY HISTIGNOREALLDUPS
|
||||||
export DISABLE_AUTO_TITLE=true
|
|
||||||
export EDITOR='vim'
|
export EDITOR='vim'
|
||||||
export FZF_COMPLETION_OPTS='--no-mouse -m -1 -x'
|
export FZF_COMPLETION_OPTS='--no-mouse -m -1 -x'
|
||||||
zstyle ':completion:*' use-cache on
|
zstyle ':completion:*' use-cache on
|
||||||
zstyle ':completion:*' cache-path ~/.cache/zsh
|
zstyle ':completion:*' cache-path ~/.cache/zsh
|
||||||
compress(){
|
|
||||||
INFILE="${1:r}.tpxz"
|
|
||||||
if [ -f "$INFILE" ]; then
|
|
||||||
echo "Won't replace $1" >&2
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
tar --xattrs -I pixz -cpf "$INFILE" $*
|
|
||||||
}
|
|
||||||
# Check if a command exists
|
# Check if a command exists
|
||||||
ex(){
|
ex() {
|
||||||
command -v "$1" >/dev/null
|
command -v "$1" >/dev/null
|
||||||
return $?
|
return $?
|
||||||
}
|
}
|
||||||
@ -42,67 +33,24 @@ else
|
|||||||
fi
|
fi
|
||||||
# For pasting in commands that start with $
|
# For pasting in commands that start with $
|
||||||
$ () {
|
$ () {
|
||||||
$*
|
"$@"
|
||||||
}
|
}
|
||||||
# A service implementation
|
|
||||||
sv () {
|
|
||||||
command="${@: -1}"
|
|
||||||
while (( $# > 1 )); do
|
|
||||||
if [[ "$command" == "i" ]]; then
|
|
||||||
echo "Status of $1"
|
|
||||||
rc-service "$1" status
|
|
||||||
shift
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
sudo true || return 2
|
|
||||||
if [[ "$1" == "sshd" ]] || [[ "$1" == "ssh" ]]; then
|
|
||||||
echo "Checking sshd config..."
|
|
||||||
sudo sshd -t && echo "Config good. Continuing" || (echo "Aborting due to bad ssh config";return 1)
|
|
||||||
fi
|
|
||||||
if [[ "$command" == "r" ]]; then
|
|
||||||
echo "Restarting $1"
|
|
||||||
sudo rc-service "$1" restart
|
|
||||||
elif [[ "$command" == "s" ]]; then
|
|
||||||
echo "Starting $1"
|
|
||||||
sudo rc-service "$1" start
|
|
||||||
elif [[ "$command" == "x" ]]; then
|
|
||||||
echo "Stopping $1"
|
|
||||||
sudo rc-service "$1" stop
|
|
||||||
else
|
|
||||||
sudo rc-service "$1" "$command"
|
|
||||||
fi
|
|
||||||
shift
|
|
||||||
done
|
|
||||||
}
|
|
||||||
compdef _services sv
|
|
||||||
# Run gui application as root by copying xauth credentials
|
# Run gui application as root by copying xauth credentials
|
||||||
asroot(){
|
asroot() {
|
||||||
# Use temporary file for added security
|
# Use temporary file for added security
|
||||||
TEMPFILE=$(tempfile)
|
TEMPFILE="$(tempfile)"
|
||||||
xauth extract $TEMPFILE $DISPLAY
|
xauth extract "$TEMPFILE" "$DISPLAY"
|
||||||
sudo zsh -c "xauth merge $TEMPFILE;(srm $TEMPFILE||rm $TEMPFILE)&'$@';"
|
sudo zsh -c "xauth merge $TEMPFILE;(srm $TEMPFILE||rm $TEMPFILE)&'$@';"
|
||||||
}
|
}
|
||||||
# De-symlink
|
# De-symlink
|
||||||
dsl() {
|
dsl() {
|
||||||
while (( $# > 0 )); do
|
while (( $# > 0 )); do
|
||||||
readlink $1 2>&1 >/dev/null && mv $(readlink $1) $1
|
readlink "$1" 2>&1 >/dev/null && mv "$(readlink "$1")" "$1"
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
# Update the sync project
|
|
||||||
update-sync-project() {
|
|
||||||
if [[ ! -L ~/.zshrc ]]; then
|
|
||||||
echo "zshrc isn't a link"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
local ABSPATH="$(\dirname "$(\dirname "$(\readlink -e ~/.zshrc)")")"
|
|
||||||
git -C "$ABSPATH" pull origin master
|
|
||||||
if (( $# > 0 )); then
|
|
||||||
"$ABSPATH/scripts/sync.sh" $*
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
# Remove directory by removing subdirectories up a level
|
# Remove directory by removing subdirectories up a level
|
||||||
dedir(){
|
dedir() {
|
||||||
# Try removing the directory if it's empty, fail silently if you can't
|
# Try removing the directory if it's empty, fail silently if you can't
|
||||||
=rmdir "$1" 2>/dev/null && return
|
=rmdir "$1" 2>/dev/null && return
|
||||||
# Make a uuid to avoid name conflicts
|
# Make a uuid to avoid name conflicts
|
||||||
@ -116,7 +64,7 @@ dedir(){
|
|||||||
=rmdir "$name" || return 3
|
=rmdir "$name" || return 3
|
||||||
}
|
}
|
||||||
# Run multitail on logs
|
# Run multitail on logs
|
||||||
mt(){
|
mt() {
|
||||||
if [[ -z "$1" ]]; then
|
if [[ -z "$1" ]]; then
|
||||||
echo "Opts:\nm xe gitea dm syncthing g" >&2
|
echo "Opts:\nm xe gitea dm syncthing g" >&2
|
||||||
return 1
|
return 1
|
||||||
@ -130,111 +78,39 @@ mt(){
|
|||||||
syncthing) sudo multitail /var/log/syncthing.{err,log};;
|
syncthing) sudo multitail /var/log/syncthing.{err,log};;
|
||||||
g) sudo watch -c genlop -tc;;
|
g) sudo watch -c genlop -tc;;
|
||||||
sync) watch grep -e Dirty: -e Writeback: /proc/meminfo;;
|
sync) watch grep -e Dirty: -e Writeback: /proc/meminfo;;
|
||||||
*) multitail "$1"
|
*) multitail "$@"
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
run(){
|
run() {
|
||||||
test -f "${1:r}" && rm "${1:r}"
|
test -f "${1:r}" && rm "${1:r}"
|
||||||
echo "Building..." >&2
|
echo "Building..." >&2
|
||||||
gcc -Wall -g -std=c99 "${1:r}.c" -o "${1:r}" && (echo "Running..." >&2;./"${1:r}")
|
gcc -Wall -g -std=c99 "${1:r}.c" -o "${1:r}" && (echo "Running..." >&2;./"${1:r}")
|
||||||
}
|
}
|
||||||
upload() {
|
ex vim && alias vi='vim'
|
||||||
tar -cf - "$*" | base64 | curl --data-urlencode text@- -d title="File uploaded at $(date '+%d/%h/%y %H:%M:%S') on $(hostname)" -d name=$USER -d expire="1440" https://austenwares.com/paste/api/create | sed -e 's/view/view\/raw/'
|
ex rc-service && alias service='rc-service'
|
||||||
}
|
ex ip && alias ip='ip -c'
|
||||||
download() {
|
ex adb && alias apush="adb push -p"
|
||||||
URL="$(printf $1 | perl -pe 's/\/paste\/view(?!\/raw)/\/paste\/view\/raw/')"
|
ex adb && alias apull="adb pull -p"
|
||||||
curl "$URL" | base64 -d | tar -xf -
|
ex mtr && alias mtr='mtr -t'
|
||||||
}
|
ex telegram-cli && alias tg='telegram-cli -NWA --disable-link-preview'
|
||||||
update-tool() {
|
ex eix && alias eix="eix -F"
|
||||||
if [ "$EUID" -ne 0 ]; then
|
ex tmux && alias tmux='tmux -2'
|
||||||
echo "This function should be run as root"
|
ex tree && alias tree='tree -C'
|
||||||
return 1
|
ex ocp && alias ocp="ocp -vs0 -dcurses"
|
||||||
fi
|
alias jupyter='docker run --rm --user="$(id -u):$(id -g)" -v "$PWD":/home/jovyan/work -p 8888:8888 jupyter/scipy-notebook'
|
||||||
local RESP=""
|
|
||||||
while [[ "$RESP" != "q" ]]; do
|
|
||||||
CMD=${RESP:0:1}
|
|
||||||
case "$CMD" in
|
|
||||||
u) update -q;;
|
|
||||||
l) layman -S ;;
|
|
||||||
g) upgrade;;
|
|
||||||
e) etc-update;;
|
|
||||||
p) emerge -Av @preserved-rebuild --usepkg=n --keep-going=y;;
|
|
||||||
m) emerge -Av @module-rebuild --usepkg=n;;
|
|
||||||
d) emerge -Ava --depclean;;
|
|
||||||
h) haskell-updater -- --usepkg=n;;
|
|
||||||
c) perl-cleaner --reallyall;;
|
|
||||||
y) python-updater;;
|
|
||||||
r) revdep-rebuild;;
|
|
||||||
q) return;;
|
|
||||||
esac
|
|
||||||
RESP=${RESP:1}
|
|
||||||
if [[ ! -z "$RESP" ]]; then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
echo "Commands:"
|
|
||||||
echo "u: update"
|
|
||||||
echo "l: layman -S"
|
|
||||||
echo "g: upgrade"
|
|
||||||
echo "e: etc-update"
|
|
||||||
echo "p: emerge @preserved-rebuild --usepkg=n --keep-going=y"
|
|
||||||
echo "m: emerge @module-rebuild --usepkg=n"
|
|
||||||
echo "d: emerge --ask --depclean"
|
|
||||||
echo "h: haskell-updater -- --usepkg=n"
|
|
||||||
echo "c: perl-cleaner --reallyall"
|
|
||||||
echo "y: python-updater"
|
|
||||||
echo "r: revdep-rebuild"
|
|
||||||
echo "q: quit"
|
|
||||||
echo -n '\a> '
|
|
||||||
read RESP
|
|
||||||
done
|
|
||||||
}
|
|
||||||
if ex vim; then
|
|
||||||
alias vi='vim'
|
|
||||||
fi
|
|
||||||
if ex rc-service; then
|
|
||||||
alias service='rc-service'
|
|
||||||
fi
|
|
||||||
if ex ip; then
|
|
||||||
alias ip='ip -c'
|
|
||||||
fi
|
|
||||||
if ex adb; then
|
|
||||||
alias apush="adb push -p"
|
|
||||||
alias apull="adb pull -p"
|
|
||||||
fi
|
|
||||||
alias cleaner="sudo ~/run.sh 'perl-cleaner --reallyall' 'python-updater' 'haskell-updater -- --usepkg=n'"
|
|
||||||
alias jsonpretty='python -m json.tool'
|
|
||||||
alias nmrestart='nmcli radio wifi off;nmcli radio wifi on'
|
|
||||||
if ex mtr; then
|
|
||||||
alias mtr='mtr -t'
|
|
||||||
fi
|
|
||||||
if ex telegram-cli; then
|
|
||||||
alias tg='telegram-cli -NWA --disable-link-preview'
|
|
||||||
fi
|
|
||||||
alias perm='stat -c "%a %n"'
|
|
||||||
alias afci='git x ./autoformat.sh;git commit -am "Autoformatted"'
|
alias afci='git x ./autoformat.sh;git commit -am "Autoformatted"'
|
||||||
if ex eix; then
|
alias con='git x php bin/console'
|
||||||
alias eix="eix -F"
|
alias disphost='export DISPLAY=:0.0'
|
||||||
fi
|
alias l='ls -CF'
|
||||||
|
alias la='ls -A'
|
||||||
|
alias less='less -R'
|
||||||
|
alias ll='ls -AlhF'
|
||||||
|
alias logout='sudo pkill -u "$USER"'
|
||||||
alias mouse1="xmodmap <(echo pointer = 1 2 3)"
|
alias mouse1="xmodmap <(echo pointer = 1 2 3)"
|
||||||
alias mouse2="xmodmap <(echo pointer = 3 2 1)"
|
alias mouse2="xmodmap <(echo pointer = 3 2 1)"
|
||||||
if ex ocp; then
|
alias nmrestart='nmcli radio wifi off;sleep 1;nmcli radio wifi on'
|
||||||
alias ocp="ocp -vs0 -dcurses"
|
|
||||||
fi
|
|
||||||
alias con='git x php bin/console'
|
|
||||||
alias srm='shred -uzv'
|
|
||||||
alias disphost='export DISPLAY=:0.0'
|
|
||||||
alias ll='ls -AlhF'
|
|
||||||
alias la='ls -A'
|
|
||||||
alias l='ls -CF'
|
|
||||||
alias logout='sudo pkill -u $USER'
|
|
||||||
if ex tmux; then
|
|
||||||
alias tmux='tmux -2'
|
|
||||||
fi
|
|
||||||
alias less='less -R'
|
|
||||||
if ex tree; then
|
|
||||||
alias tree='tree -C'
|
|
||||||
fi
|
|
||||||
alias resource='. ~/.zshrc'
|
alias resource='. ~/.zshrc'
|
||||||
|
alias srm='shred -uzv'
|
||||||
if [ "$(uname)" != "Darwin" ]; then
|
if [ "$(uname)" != "Darwin" ]; then
|
||||||
# Not Mac
|
# Not Mac
|
||||||
export PATH="$HOME/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:$HOME/.cargo/bin"
|
export PATH="$HOME/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:$HOME/.cargo/bin"
|
||||||
@ -252,49 +128,19 @@ fi
|
|||||||
if test -f /etc/gentoo-release; then
|
if test -f /etc/gentoo-release; then
|
||||||
# Gentoo
|
# Gentoo
|
||||||
alias etup='sudo etc-update'
|
alias etup='sudo etc-update'
|
||||||
ins(){
|
ins() {
|
||||||
# Sudo echo so we have immediate results on weather sudo worked
|
# Sudo echo so we have immediate results on weather sudo worked
|
||||||
sudo echo "Args: $*"
|
sudo echo "Args: $*"
|
||||||
# Beep, verbose, ask
|
# Beep, verbose, ask
|
||||||
sudo emerge --autounmask-write -Ava $*
|
sudo emerge --autounmask-write -Ava $*
|
||||||
echo "\a"
|
echo "\a"
|
||||||
}
|
}
|
||||||
upgrade(){
|
upgrade() {
|
||||||
# Sudo echo so we have immediate results on weather sudo worked
|
# Sudo echo so we have immediate results on weather sudo worked
|
||||||
sudo echo "Args: $*"
|
sudo echo "Args: $*"
|
||||||
sudo emerge --update --newuse --deep --verbose --tree --keep-going=y --verbose-conflicts --alert --ask --binpkg-respect-use=y --binpkg-changed-deps=y --backtrack=30 $* @world
|
sudo emerge --update --newuse --deep --verbose --tree --keep-going=y --verbose-conflicts --alert --ask --binpkg-respect-use=y --binpkg-changed-deps=y --backtrack=30 $* @world
|
||||||
echo "\\a"
|
echo "\\a"
|
||||||
}
|
}
|
||||||
# For emerging with absolute paths
|
|
||||||
em(){
|
|
||||||
# Beep, verbose, ask
|
|
||||||
EMERGE_ARGS="-Ava"
|
|
||||||
X=""
|
|
||||||
for var in "$@"
|
|
||||||
do
|
|
||||||
if [[ "$var" =~ ^- ]]; then
|
|
||||||
EMERGE_ARGS="$EMERGE_ARGS $var"
|
|
||||||
else
|
|
||||||
X="$X =$var"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
echo sudo emerge "$EMERGE_ARGS""$X"
|
|
||||||
sudo emerge "$EMERGE_ARGS""$X"
|
|
||||||
echo "\a"
|
|
||||||
}
|
|
||||||
update(){
|
|
||||||
# If this is a server computer
|
|
||||||
sudo rm -f '/usr/portage/metadata/timestamp.chk'
|
|
||||||
if ex eix-update; then
|
|
||||||
sudo zsh -c "emaint sync -a&&eix-update"
|
|
||||||
else
|
|
||||||
sudo emaint sync -a
|
|
||||||
fi
|
|
||||||
sudo -k
|
|
||||||
if [ "$1" != "-q" ]; then
|
|
||||||
echo '\a'
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
elif test -f /etc/lsb-release; then
|
elif test -f /etc/lsb-release; then
|
||||||
# Ubuntu
|
# Ubuntu
|
||||||
alias install='sudo apt install'
|
alias install='sudo apt install'
|
||||||
@ -319,9 +165,7 @@ alias ............='k ../../../../../../../../../../..'
|
|||||||
alias .............='k ../../../../../../../../../../../..'
|
alias .............='k ../../../../../../../../../../../..'
|
||||||
alias ..............='k ../../../../../../../../../../../../..'
|
alias ..............='k ../../../../../../../../../../../../..'
|
||||||
alias ...............='k ../../../../../../../../../../../../../..'
|
alias ...............='k ../../../../../../../../../../../../../..'
|
||||||
if ex youtube-dl; then
|
ex youtube-dl && alias ytdl="youtube-dl -x --audio-format mp3 --audio-quality 0 -c -o '%(title)s.%(ext)s'"
|
||||||
alias ytdl="youtube-dl $@ -x --audio-format mp3 --audio-quality 0 -c -o '%(title)s.%(ext)s'"
|
|
||||||
fi
|
|
||||||
if ex wemux; then
|
if ex wemux; then
|
||||||
alias tux="wemux"
|
alias tux="wemux"
|
||||||
elif ex tmux; then
|
elif ex tmux; then
|
||||||
@ -331,9 +175,8 @@ if ex git; then
|
|||||||
alias g="git"
|
alias g="git"
|
||||||
fi
|
fi
|
||||||
alias stdns="sudo sh -c 'echo nameserver 1.1.1.1 > /etc/resolv.conf'"
|
alias stdns="sudo sh -c 'echo nameserver 1.1.1.1 > /etc/resolv.conf'"
|
||||||
alias fvim="vim -u NONE +\"so ~/.vim/plugged/flappyvird-vim/plugin/flappyvird.vim\" +\"so ~/.vim/plugged/flappyvird-vim/autoload/flappyvird.vim\" +\":FlappyVird\" +\":q\""
|
#alias fvim="vim -u NONE +\"so ~/.vim/plugged/flappyvird-vim/plugin/flappyvird.vim\" +\"so ~/.vim/plugged/flappyvird-vim/autoload/flappyvird.vim\" +\":FlappyVird\" +\":q\""
|
||||||
alias fk='k `fzf --no-mouse -m -1 -x`'
|
alias fk='k `fzf --no-mouse -m -1 -x`'
|
||||||
#alias susp="sudo true&&((slock;sleep 2;nmcli radio wifi off;nmcli radio wifi on)&echo mem | sudo tee /sys/power/state >/dev/null);sudo -k"
|
|
||||||
alias susp="sudo true && (slock&until echo mem|sudo tee /sys/power/state>/dev/null;do sleep 1;done;sleep 4;nmcli radio wifi off;sleep 3;nmcli radio wifi on)"
|
alias susp="sudo true && (slock&until echo mem|sudo tee /sys/power/state>/dev/null;do sleep 1;done;sleep 4;nmcli radio wifi off;sleep 3;nmcli radio wifi on)"
|
||||||
if ex sudo; then
|
if ex sudo; then
|
||||||
alias s='sudo -Hu'
|
alias s='sudo -Hu'
|
||||||
@ -353,7 +196,7 @@ fi
|
|||||||
if ex rg; then
|
if ex rg; then
|
||||||
alias -g G='|& rg'
|
alias -g G='|& rg'
|
||||||
alias rg='rg -i'
|
alias rg='rg -i'
|
||||||
# I'm so sorry ggreer
|
# I'm so sorry, ggreer
|
||||||
alias ag=rg
|
alias ag=rg
|
||||||
elif ex ag; then
|
elif ex ag; then
|
||||||
alias -g G='|& ag'
|
alias -g G='|& ag'
|
||||||
@ -368,8 +211,8 @@ timer() {
|
|||||||
echo
|
echo
|
||||||
done | pv -Sptels "$1" >/dev/null
|
done | pv -Sptels "$1" >/dev/null
|
||||||
}
|
}
|
||||||
fixsh(){
|
fixsh() {
|
||||||
sed -i -e $1"d" ~/.ssh/known_hosts
|
sed -i'' -e "${1}d" ~/.ssh/known_hosts
|
||||||
}
|
}
|
||||||
mv() { /bin/mv -v "$@" }
|
mv() { /bin/mv -v "$@" }
|
||||||
m() { mv "$@" }
|
m() { mv "$@" }
|
||||||
@ -392,68 +235,28 @@ linx() {
|
|||||||
elif (( $# == 1 )) && [[ -f "$1" ]]; then
|
elif (( $# == 1 )) && [[ -f "$1" ]]; then
|
||||||
linx < "$1"
|
linx < "$1"
|
||||||
else
|
else
|
||||||
tar -cf - $* | linx
|
tar -cf - "$@" | linx
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
grename() {
|
bp() {
|
||||||
echo incomplete
|
|
||||||
return
|
|
||||||
FILES=($*)
|
|
||||||
REGEX='s///'
|
|
||||||
echo -n "Command (frneVVVq): "
|
|
||||||
while read input; do
|
|
||||||
case $input in
|
|
||||||
f)
|
|
||||||
echo "File list:"
|
|
||||||
printf '%s\n' $FILES
|
|
||||||
;;
|
|
||||||
r)
|
|
||||||
echo "Regex:"
|
|
||||||
echo "$REGEX"
|
|
||||||
;;
|
|
||||||
n)
|
|
||||||
echo "Simulated replacement:"
|
|
||||||
perl-rename -n "$REGEX" $FILES
|
|
||||||
;;
|
|
||||||
e)
|
|
||||||
echo "Editing regex..."
|
|
||||||
TEMPFILE=$(tempfile)
|
|
||||||
(cat <(printf '%s\n' $FILES);echo;echo "$REGEX") > $TEMPFILE
|
|
||||||
vim $TEMPFILE +'normal G$h'
|
|
||||||
REGEX=$(tac $TEMPFILE|grep -m1 '.')
|
|
||||||
rm $TEMPFILE
|
|
||||||
;;
|
|
||||||
VVV)
|
|
||||||
echo "Actual results:"
|
|
||||||
perl-rename -v $REGEX $FILES
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
q)
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
echo -n "Command (frneVVVq): "
|
|
||||||
done
|
|
||||||
}
|
|
||||||
bp(){
|
|
||||||
printf '\a'
|
printf '\a'
|
||||||
}
|
}
|
||||||
ltar(){
|
ltar() {
|
||||||
tar -cf - $@|pv -WcN tar|xz|pv -WcN lzma
|
tar -cf - "$@"|pv -WcN tar|xz|pv -WcN lzma
|
||||||
#tar -cf - $@|pv -WcN tar -s $(echo $(du -sb $@|awk '{print $1}'|tr '\n' '+')0|bc)|gzip|pv -WcN dest
|
#tar -cf - $@|pv -WcN tar -s $(echo $(du -sb $@|awk '{print $1}'|tr '\n' '+')0|bc)|gzip|pv -WcN dest
|
||||||
#tar -cf - $@|pv -WcN tar -s $(echo $(du -sb $@|awk '{print $1}'|tr '\n' '+')0|bc)|gzip|pv -WcN dest
|
#tar -cf - $@|pv -WcN tar -s $(echo $(du -sb $@|awk '{print $1}'|tr '\n' '+')0|bc)|gzip|pv -WcN dest
|
||||||
}
|
}
|
||||||
ctar(){
|
ctar() {
|
||||||
tar -cf - $@|pv -WcN tar|gzip|pv -WcN gzip
|
tar -cf - "$@"|pv -WcN tar|gzip|pv -WcN gzip
|
||||||
}
|
}
|
||||||
offline(){
|
offline() {
|
||||||
if [ ! -z "$@" ] ; then
|
if [ ! -z "$@" ] ; then
|
||||||
sudo unshare -n -- sudo -u $USER zsh -c "$@"
|
sudo unshare -n -- sudo -u "$USER" zsh -c "$@"
|
||||||
else
|
else
|
||||||
sudo unshare -n -- sudo -u $USER LP_MARK_PREFIX=" $(tput setaf 1)(offline)$(tput sgr0) " zsh
|
sudo unshare -n -- sudo -u "$USER" LP_MARK_PREFIX=" $(tput setaf 1)(offline)$(tput sgr0) " zsh
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
dnstest(){
|
dnstest() {
|
||||||
echo "resolv.conf:"
|
echo "resolv.conf:"
|
||||||
cat /etc/resolv.conf
|
cat /etc/resolv.conf
|
||||||
echo "Testing DNS:"
|
echo "Testing DNS:"
|
||||||
@ -466,13 +269,9 @@ dnstest(){
|
|||||||
echo "Testing DNS"
|
echo "Testing DNS"
|
||||||
curl -L portquiz.net
|
curl -L portquiz.net
|
||||||
}
|
}
|
||||||
tsh(){
|
tsh() {
|
||||||
ssh -X $*
|
ssh "$@"
|
||||||
if which ponysay >/dev/null; then
|
echo "\n\n\n\n\n\n\n\n\n\nSESSION CLOSED\n\n\n\n\n\n\n\n\n\n"
|
||||||
ponysay "Connection closed!"
|
|
||||||
else
|
|
||||||
echo "\n\n\n\n\n\n\n\n\n\nSESSION CLOSED\n\n\n\n\n\n\n\n\n\n"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
compdefas () {
|
compdefas () {
|
||||||
local a
|
local a
|
||||||
@ -482,11 +281,11 @@ compdefas () {
|
|||||||
}
|
}
|
||||||
compdefas ssh tsh
|
compdefas ssh tsh
|
||||||
compdefas mv m mv
|
compdefas mv m mv
|
||||||
mcl(){
|
mcl() {
|
||||||
mkdir -p $1
|
mkdir -p $1
|
||||||
cd $1
|
cd $1
|
||||||
}
|
}
|
||||||
create-repo(){
|
create-repo() {
|
||||||
PRIVATE="true"
|
PRIVATE="true"
|
||||||
while getopts ":p" opt; do
|
while getopts ":p" opt; do
|
||||||
case $opt in
|
case $opt in
|
||||||
@ -507,27 +306,7 @@ create-repo(){
|
|||||||
read -s password
|
read -s password
|
||||||
curl --user "$username:$password" -d name="$1" -d private="$PRIVATE" https://gitea.austenwares.com/api/v1/user/repos
|
curl --user "$username:$password" -d name="$1" -d private="$PRIVATE" https://gitea.austenwares.com/api/v1/user/repos
|
||||||
}
|
}
|
||||||
hsh(){
|
rc() {
|
||||||
FILE="$1"
|
|
||||||
ARGS=""
|
|
||||||
while (( $# > 0 )); do
|
|
||||||
if [[ "md5" = "$1" ]] || [[ "md5sum" = "$1" ]] || [[ "m" = "$1" ]]; then
|
|
||||||
ARGS="$ARGS "md5sum
|
|
||||||
elif [[ "sha1" = "$1" ]] || [[ "sha1sum" = "$1" ]] || [[ "s" = "$1" ]]; then
|
|
||||||
ARGS="$ARGS "sha1sum
|
|
||||||
elif [[ "sha2" = "$1" ]] || [[ "sha256sum" = "$1" ]]; then
|
|
||||||
ARGS="$ARGS "sha256sum
|
|
||||||
elif [[ "sha512" = "$1" ]] || [[ "sha512sum" = "$1" ]]; then
|
|
||||||
ARGS="$ARGS "sha512sum
|
|
||||||
fi
|
|
||||||
shift
|
|
||||||
done
|
|
||||||
ARGS=$(echo "$ARGS"|xargs)
|
|
||||||
echo "Calculating ($ARGS) of \"$FILE\""
|
|
||||||
echo pv "$FILE" \| pee $ARGS
|
|
||||||
pv "$FILE" | pee $(echo $ARGS)
|
|
||||||
}
|
|
||||||
rc(){
|
|
||||||
case $1 in
|
case $1 in
|
||||||
z) vim ~/.zshrc;;
|
z) vim ~/.zshrc;;
|
||||||
v) vim ~/.vimrc;;
|
v) vim ~/.vimrc;;
|
||||||
@ -542,31 +321,7 @@ rc(){
|
|||||||
*) echo "Opts:\nz v i\nuse make unmask mask accept_keywords keywords license"
|
*) echo "Opts:\nz v i\nuse make unmask mask accept_keywords keywords license"
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
pub-git-rm(){
|
k() {
|
||||||
if (( $# == 0 )) ; then
|
|
||||||
git remote rm local
|
|
||||||
git remote rm ncsu
|
|
||||||
git remote rm gitlab
|
|
||||||
git remote rm aws
|
|
||||||
fi
|
|
||||||
while (( $# > 0 )) ; do
|
|
||||||
git remote rm "$1"
|
|
||||||
shift
|
|
||||||
done
|
|
||||||
}
|
|
||||||
pub-git-push(){
|
|
||||||
if (( $# == 0 )) ; then
|
|
||||||
git push local --all && git push local --tags
|
|
||||||
git push ncsu --all && git push ncsu --tags
|
|
||||||
git push gitlab --all && git push gitlab --tags
|
|
||||||
git push aws --all && git push aws --tags
|
|
||||||
fi
|
|
||||||
while (( $# > 0 )) ; do
|
|
||||||
git push "$1" --all && git push "$1" --tags
|
|
||||||
shift
|
|
||||||
done
|
|
||||||
}
|
|
||||||
k(){
|
|
||||||
#More than 1 arguement
|
#More than 1 arguement
|
||||||
if [[ $# > 1 ]] ; then
|
if [[ $# > 1 ]] ; then
|
||||||
vim $@
|
vim $@
|
||||||
@ -623,16 +378,7 @@ if ex fasd; then
|
|||||||
eval "$(fasd --init auto)"
|
eval "$(fasd --init auto)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#Old config options that are no longer in use
|
|
||||||
#alias pg="pcregrep -M"
|
|
||||||
#if command -v greadlink 2>&1 >/dev/null; then
|
|
||||||
# alias readlink='greadlink'
|
|
||||||
#fi
|
|
||||||
#alias steamo='sudo kill -9 `pidof steam`;sudo unshare -n -- sh -c "ifconfig lo up;sudo -u $USER steam" > /dev/null 2>&1 & disown'
|
|
||||||
#alias bat='upower -i /org/freedesktop/UPower/devices/battery_BAT0| grep -E "state|to\ full|percentage"'
|
#alias bat='upower -i /org/freedesktop/UPower/devices/battery_BAT0| grep -E "state|to\ full|percentage"'
|
||||||
#alias aoeu='setxkbmap -layout us -option "'
|
|
||||||
#alias asdf='setxkbmap -layout dvorak -option ""'
|
|
||||||
#alias sudo='sudo -H'
|
|
||||||
echo -ne '[# ]\r'
|
echo -ne '[# ]\r'
|
||||||
source ~/.zsh-git/lpr/liquidprompt
|
source ~/.zsh-git/lpr/liquidprompt
|
||||||
source ~/.zsh-git/omg/base.sh
|
source ~/.zsh-git/omg/base.sh
|
||||||
|
Loading…
Reference in New Issue
Block a user