diff --git a/.bash_profile b/.bash_profile index 19987ed..d5d0046 100644 --- a/.bash_profile +++ b/.bash_profile @@ -1,31 +1,102 @@ #!/bin/bash -[[ -f ~/.bashrc ]] && . ~/.bashrc +set -o vi +bind -m vi-insert "\C-l":clear-screen -# if running bash -if [ -n "$BASH_VERSION" ]; then - # include .bashrc if it exists - if [ -f "$HOME/.bashrc" ]; then - . "$HOME/.bashrc" +shopt -s extglob + +HISTSIZE= +HISTFILESIZE= + +export EDITOR='nvim' + +export GIT_AUTHOR_NAME="Tovi Jaeschke-Rogers" +export GIT_AUTHOR_EMAIL="tovi@tovijaeschke.xyz" +export GIT_COMMITTER_NAME="Tovi Jaeschke-Rogers" +export GIT_COMMITTER_EMAIL="tovi@tovijaeschke.xyz" + +export LESS='-R' +export LESSOPEN='|~/.lessfilter %s' + +if [[ $(uname) != "Linux" ]]; then + + test -e "${HOME}/.iterm2_shell_integration.bash" && source "${HOME}/.iterm2_shell_integration.bash" || true + + export HOMEBREW_NO_INSTALL_CLEANUP=1 + + export GIT_AUTHOR_EMAIL="tovi.jaeschke-rogers@thirty4.com" + export GIT_COMMITTER_EMAIL="tovi.jaeschke-rogers@thirty4.com" + + mount-hdd() { + if [ -z $1 ]; then + sudo umount /dev/disk2s1 && sudo /usr/local/bin/ntfs-3g /dev/disk2s1 /Volumes/NTFS -olocal -oallow_other + else + sudo umount /dev/$1 && sudo /usr/local/bin/ntfs-3g /dev/$1 /Volumes/NTFS -olocal -oallow_other fi -fi + } -export GOPATH="$HOME/code/go" -export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/usr/share/games:/usr/local/sbin:/usr/sbin:/sbin:~/.local/bin:/usr/local/go/bin:$GOPATH/bin" +fi # set PATH so it includes user's private bin if it exists if [ -d "$HOME/.local/bin" ] ; then - PATH="$PATH:$(du "$HOME/.local/bin/" | cut -f2 | tr '\n' ':')" + PATH="$PATH:$(du "$HOME/.local/bin/" | cut -f2 | tr '\n' ':')$HOME/.composer/vendor/bin" fi -export TERMINAL='st' -export EDITOR='vim' -export PAGER='less' -export BROWSER='firefox' +source ~/.config/aliasrc + +parse_git_branch() { + git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' +} + +export PS1=" \[\033[0;36m\]\t \[\033[0;35m\]\u\[\033[0;32m\]@\[\033[0;34m\]\h \[\033[32m\]\W\[\033[33m\]\$(parse_git_branch)\[\033[31m\] \n$\[\033[00m\] " + +mkcd() { + if [ ! -d "$1" ]; then + mkdir -p "$1" && cd "$1" + elif [ -d "$1" ]; then + cd "$1" + else + echo "Error" + fi +} + +# Go up directory structures +up() { + cd $(printf "%0.0s../" $(seq 1 $1)); +} + +git() { + if [[ $@ == "mergetool" ]]; then + command git mergetool --no-gui + else + command git $@ + fi +} + +# git branch -vv | grep 'gone\]' | awk ' { print $1 }' | xargs -p git branch -d +git-prune() { + if [[ $@ == "--apply" ]]; then + command git branch --merged develop | grep -vEw "develop$|master$" | xargs git branch -d + else + echo "Run \"git prune --apply\" to delete the following branches:" + command git branch --merged develop | grep -vEw "develop$|master$" + fi +} + +color-diff() { + if [ -z ${1+x} ] || [ -z ${2+x} ]; then + echo "Usage: color-diff dir1/ dir2/" + return + fi + diff -bur $1 $2 | colordiff | less +} + +export NVM_DIR="$HOME/.nvm" +[ -s "/usr/local/opt/nvm/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh" # This loads nvm +[ -s "/usr/local/opt/nvm/etc/bash_completion.d/nvm" ] && . "/usr/local/opt/nvm/etc/bash_completion.d/nvm" -export PULSE_PROP="filter.want=echo-cancel" -export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/opt/cuda/lib64" -export CUDA_HOME="/opt/cuda" +[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion -[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && exec startx +[[ -r "/usr/local/etc/profile.d/bash_completion.sh" ]] && . "/usr/local/etc/profile.d/bash_completion.sh" +eval "$(thefuck --alias)" diff --git a/.bashrc b/.bashrc index 7de2a31..c6d1d4b 100644 --- a/.bashrc +++ b/.bashrc @@ -1,49 +1,11 @@ #!/bin/bash -set -o vi -bind -m vi-insert "\C-l":clear-screen - -shopt -s extglob +#set -o vi +#bind -m vi-insert "\C-l":clear-screen HISTSIZE= HISTFILESIZE= -export EDITOR='nvim' - -export GIT_AUTHOR_NAME="Tovi Jaeschke-Rogers" -export GIT_AUTHOR_EMAIL="tovi@tovijaeschke.xyz" -export GIT_COMMITTER_NAME="Tovi Jaeschke-Rogers" -export GIT_COMMITTER_EMAIL="tovi@tovijaeschke.xyz" - -export LESS='-R' -export LESSOPEN='|~/.lessfilter %s' - -alias ls="ls --color=auto" \ - vb='nvim ~/.bashrc && source ~/.bashrc' \ - va='nvim ~/.config/aliasrc && source ~/.bashrc' - -if [[ $(uname) != "Linux" ]]; then - - test -e "${HOME}/.iterm2_shell_integration.bash" && source "${HOME}/.iterm2_shell_integration.bash" || true - - export HOMEBREW_NO_INSTALL_CLEANUP=1 - - export GIT_AUTHOR_EMAIL="tovi.jaeschke-rogers@thirty4.com" - export GIT_COMMITTER_EMAIL="tovi.jaeschke-rogers@thirty4.com" - - alias ls="ls -G" \ - vb='nvim ~/.bash_profile && source ~/.bash_profile' \ - va='nvim ~/.config/aliasrc && source ~/.bash_profile' - - mount-hdd() { - if [ -z $1 ]; then - sudo umount /dev/disk2s1 && sudo /usr/local/bin/ntfs-3g /dev/disk2s1 /Volumes/NTFS -olocal -oallow_other - else - sudo umount /dev/$1 && sudo /usr/local/bin/ntfs-3g /dev/$1 /Volumes/NTFS -olocal -oallow_other - fi - } - -fi # set PATH so it includes user's private bin if it exists if [ -d "$HOME/.local/bin" ] ; then @@ -52,11 +14,12 @@ fi source ~/.config/aliasrc + parse_git_branch() { git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' } -export PS1=" \[\033[0;36m\]\t \[\033[0;35m\]\u\[\033[0;32m\]@\[\033[0;34m\]\h \[\033[32m\]\W\[\033[33m\]\$(parse_git_branch)\[\033[31m\] \n$\[\033[00m\] " +export PS1="\[\033[0;35m\]\u\[\033[0;32m\]@\[\033[0;34m\]\h \[\033[32m\]\W\[\033[33m\]\$(parse_git_branch)\[\033[31m\] \n$\[\033[00m\] " mkcd() { if [ ! -d "$1" ]; then @@ -81,12 +44,10 @@ git() { fi } -# git branch -vv | grep 'gone\]' | awk ' { print $1 }' | xargs -p git branch -d git-prune() { - if [[ $@ == "--apply" ]]; then + if [[ $@ == "prune" ]]; then command git branch --merged develop | grep -vEw "develop$|master$" | xargs git branch -d else - echo "Run \"git prune --apply\" to delete the following branches:" command git branch --merged develop | grep -vEw "develop$|master$" fi } @@ -99,11 +60,28 @@ color-diff() { diff -bur $1 $2 | colordiff | less } -export NVM_DIR="$HOME/.nvm" +export EDITOR='nvim' + +shopt -s extglob + +export GIT_AUTHOR_NAME="Tovi Jaeschke-Rogers" +export GIT_AUTHOR_EMAIL="tovi.jaeschke-rogers@thirty4.com" +export GIT_COMMITTER_NAME="Tovi Jaeschke-Rogers" +export GIT_COMMITTER_EMAIL="tovi.jaeschke-rogers@thirty4.com" + + export NVM_DIR="$HOME/.nvm" [ -s "/usr/local/opt/nvm/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh" # This loads nvm [ -s "/usr/local/opt/nvm/etc/bash_completion.d/nvm" ] && . "/usr/local/opt/nvm/etc/bash_completion.d/nvm" +eval $(thefuck --alias) + +test -e "${HOME}/.iterm2_shell_integration.bash" && source "${HOME}/.iterm2_shell_integration.bash" || true [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion [[ -r "/usr/local/etc/profile.d/bash_completion.sh" ]] && . "/usr/local/etc/profile.d/bash_completion.sh" + +export LESS='-R' +export LESSOPEN='|~/.lessfilter %s' + +export TMPDIR=/tmp diff --git a/.config/aliasrc b/.config/aliasrc index 6e3310f..387aee6 100644 --- a/.config/aliasrc +++ b/.config/aliasrc @@ -1,5 +1,6 @@ #!/bin/sh alias q='exit' \ + ls="ls -G" \ dd='sudo dd status=progress' \ h="history | grep" \ back='cd -' \ @@ -20,7 +21,10 @@ alias q='exit' \ ddate='date +%d-%m-%Y' \ gitup='git push origin $(git rev-parse --abbrev-ref HEAD)' \ gco='git checkout' \ + gbls='git --no-pager branch -a' \ vv='nvim ~/.config/nvim/init.vim' \ + vb='nvim ~/.bash_profile && source ~/.bash_profile' \ + va='nvim ~/.config/aliasrc && source ~/.bash_profile' \ delorig='find . -name "*.orig" -exec rm {} \;' \ delbak='find . -name "*.bak" -exec rm {} \;' \ site-clone='wget --mirror --convert-links --adjust-extension --page-requisites --no-parent' diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index 28dec6c..7452ba3 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -24,6 +24,7 @@ Plug 'tpope/vim-commentary' Plug 'tpope/vim-fugitive' Plug 'rbong/vim-flog' Plug 'ap/vim-css-color' +Plug 'justinmk/vim-sneak' call plug#end() " Some basics: @@ -32,6 +33,7 @@ call plug#end() set nohlsearch set clipboard+=unnamedplus set incsearch + set ignorecase set smartcase set noswapfile @@ -39,6 +41,12 @@ call plug#end() set undodir=~/.config/nvim/undodir set undofile + let g:gruvbox_contrast_dark = 'hard' + if exists('+termguicolors') + let &t_8f = "\[38;2;%lu;%lu;%lum" + let &t_8b = "\[38;2;%lu;%lu;%lum" + endif + let g:gruvbox_invert_selection = '0' colorscheme gruvbox set background=dark @@ -74,6 +82,8 @@ call plug#end() nmap gd (coc-definition) nmap gr (coc-references) + nmap rr (coc-rename) + nnoremap prw :CocSearch =expand("") inoremap pumvisible() ? "\" : "\" inoremap pumvisible() ? "\" : "\" @@ -90,6 +100,21 @@ call plug#end() let g:pdv_cfg_autoEndClass = 0 let g:pdv_cfg_autoEndFunction = 0 +" Sneak config + let g:sneak#label = 1 + " case insensitive sneak + let g:sneak#use_ic_scs = 1 + " immediately move to the next instance of search, if you move the cursor sneak is back to default behavior + let g:sneak#s_next = 1 + " remap so I can use , and ; with f and t + map gS Sneak_, + map gs Sneak_; + " Change the colors + "highlight Sneak guifg=black guibg=#00C7DF ctermfg=black ctermbg=cyan + "highlight SneakScope guifg=red guibg=yellow ctermfg=red ctermbg=yellow + " Cool prompts + let g:sneak#prompt = 'S> ' + " Spell-check set to o, 'o' for 'orthography': map o :setlocal spell! spelllang=en_au @@ -106,7 +131,10 @@ call plug#end() map s :!clear && shellcheck % " Replace all is aliased to S. - nnoremap S :%s//g + nnoremap :%s//g + +" For chrome extension development + nnoremap :set syntax= " Ensure files are read as what I want: let g:vimwiki_ext2syntax = {'.Rmd': 'markdown', '.rmd': 'markdown','.md': 'markdown', '.markdown': 'markdown', '.mdown': 'markdown'} @@ -130,6 +158,11 @@ call plug#end() " Update CHANGELOG message inoremap C Update CHANGELOG:wq + inoremap 7 Refactor for php7bbhi + +" Copy entire document + noremap y ggyG + map y ggyG """HTML autocmd FileType html inoremap b <++>FbT>i diff --git a/.gitignore_global b/.gitignore_global index f4af9f3..581607f 100644 --- a/.gitignore_global +++ b/.gitignore_global @@ -4,3 +4,10 @@ lib/form/base zz_release_ticket.php ZzDummyTask.class.php lib/task/ZzDummyTask.class.php +.DS_Store +todo.txt +todo +TODO.txt +TODO +release* +RELEASE* diff --git a/.inputrc b/.inputrc index f9b94dd..a30a380 100644 --- a/.inputrc +++ b/.inputrc @@ -1,19 +1,23 @@ -$include /etc/inputrc -set editing-mode vi -$if mode=vi +set completion-ignore-case on -set show-mode-in-prompt on -set vi-ins-mode-string \1\e[6 q\2 -set vi-cmd-mode-string \1\e[2 q\2 +set keymap emacs +"\C-x\C-r": re-read-init-file +"\e[A": history-search-backward +"\e[B": history-search-forward +"\e[C": forward-char +"\e[D": backward-char set keymap vi-command -# these are for vi-command mode -Control-l: clear-screen -Control-a: beginning-of-line +"\C-x\C-r": re-read-init-file +"\e[A": history-search-backward +"\e[B": history-search-forward +"\e[C": forward-char +"\e[D": backward-char set keymap vi-insert -# these are for vi-insert mode -Control-l: clear-screen -Control-a: beginning-of-line +"\C-x\C-r": re-read-init-file +"\e[A": history-search-backward +"\e[B": history-search-forward +"\e[C": forward-char +"\e[D": backward-char -$endif diff --git a/.local/bin/bcms b/.local/bin/bcms new file mode 100755 index 0000000..3f30ba9 --- /dev/null +++ b/.local/bin/bcms @@ -0,0 +1,169 @@ +#!/bin/bash + +# Variables +blog_dir=~/repos/blog-cms + +check() { + if [ "$EUID" -ne 0 ] + then + echo "Please run as root" + exit + fi +} + +confirm() { + confirmvar="" + while [[ "$confirmvar" == "" ]] + do + read -p "y/n/q: " confirmvar + if [ "${confirmvar}" == "y" ] + then + echo true + elif [ "${confirmvar}" == "n" ] + then + echo false + fi + done +} + +newpost() { + c=false + while [[ ${c} == false ]] + do + read -p "Title: " title + echo -e "Subject 1:\n\t0 - no subject\n\t1 - Programming\n\t2 - Pentesting\n\t3 - Personal" + sub1=$(subjectselect) + echo -e "Subject 1:\n\t0 - no subject\n\t1 - Programming\n\t2 - Pentesting\n\t3 - Personal" + sub2=$(subjectselect) + echo -e "Title: ${title}\nSubject 1: ${sub1}\nSubject 2: ${sub2}\n\nAre you sure?\n" + c=$(confirm) + done + dirname=$(echo ${title} | sed 's/\ /_/g') + mkdir -p ${blog_dir}/posts/${dirname}/static + cd ${blog_dir}/posts/${dirname} + echo ${title} >> title + echo ${sub1} >> .sub1 + echo ${sub2} >> .sub2 + touch {intro.html,body.html} + pwd + ls -al +} + +subjectselect() { + read -p "0/1/2/3: " tmpvar + if [ "$tmpvar" == "1" ] + then + echo "Programming" + elif [ "$tmpvar" == "2" ] + then + echo "Pentesting" + elif [ "$tmpvar" == "3" ] + then + echo "Personal" + elif [ "$tmpvar" == "0" ] + then + echo "" + fi +} + +listandReturn() { printf "Listing contents of %s.\\n" "$1" + ls -rc "$1" | awk -F '/' '{print $NF}' | nl + read -erp "Pick an entry by number to $2, or press ctrl-c to cancel. " number + chosen="$(ls -rc "$1" | nl | grep -w "$number" | awk '{print $2}')" +basefile="$(basename "$chosen")" && base="${basefile%.*}" ;} + +upload() { + + #check + + listandReturn ${blog_dir}/posts + #cd ${blog_dir}/posts/${basefile} + + titlevar=$(cat ${blog_dir}/posts/${basefile}/title) + subvar1=$(cat ${blog_dir}/posts/${basefile}/.sub1) + subvar2=$(cat ${blog_dir}/posts/${basefile}/.sub2) + + echo "Add intro pic?" + if [[ $(confirm) == true ]] + then + listandReturn ${blog_dir}/posts/${basefile}/static/ + picvar=${basefile} + fi + + echo -n Mysql password: + read -s sqlpassword + + scp ${blog_dir}/posts/${basefile}/{intro.html,body.html} root@tovijaeschke.xyz:/var/lib/mysql-files/ + scp ${blog_dir}/posts/${basefile}/static/* root@tovijaeschke.xyz:/usr/share/nginx/personal/static/ + + if [[ "$picvar" == "" ]] + then + ssh root@tovijaeschke.xyz "chown mysql:mysql /var/lib/mysql-files/* && + chmod go+rw /var/lib/mysql-files/* && + mysql -u root -p${sqlpassword} -D PersonalWebsite -e \"INSERT INTO Posts (subject,subject2,title,intro,body) VALUES ('${subvar1}', '${subvar2}', '${titlevar}', LOAD_FILE('/var/lib/mysql-files/intro.html'), LOAD_FILE('/var/lib/mysql-files/body.html'));\"" + else + ssh root@tovijaeschke.xyz "chown mysql:mysql /var/lib/mysql-files/* && + chmod go+rw /var/lib/mysql-files/* && + mysql -u root -p${sqlpassword} -D PersonalWebsite -e \"INSERT INTO Posts (subject,subject2,title,pic,intro,body) VALUES ('${subvar1}', '${subvar2}', '${titlevar}', '${picvar}', LOAD_FILE('/var/lib/mysql-files/intro.html'), LOAD_FILE('/var/lib/mysql-files/body.html'));\"" + fi +} + +preview() { + mkdir -p /tmp/preview + cp -r ${blog_dir}/.preview/* /tmp/preview/ + + listandReturn ${blog_dir}/posts + + title=$(cat ${blog_dir}/posts/${basefile}/title | tr -d '\n') + intro=$(cat ${blog_dir}/posts/${basefile}/intro.html | tr -d '\n') + body=$(cat ${blog_dir}/posts/${basefile}/body.html | tr -d '\n') + + cp -r ${blog_dir}/posts/${basefile}/static/ /tmp/preview + + sed -i .bak 's|TITLE_PREVIEW|'"${title}"'|g' /tmp/preview/post.html + sed -i .bak 's|INTRO_PREVIEW|'"${intro}"'|g' /tmp/preview/post.html + sed -i .bak 's|BODY_PREVIEW|'"${body}"'|g' /tmp/preview/post.html + + if [[ $(uname) == "Linux" ]]; then + firefox /tmp/preview/post.html + else + open -a firefox -g /tmp/preview/post.html + fi +} + +deletedraft() { + echo "Which draft would you like to delete?" + listandReturn ${blog_dir}/posts + echo "Are you sure you want to delete \"$(cat ${blog_dir}/posts/${basefile}/title)?\"" + c=$(confirm) + if [ ${c} != false ] + then + rm -rf ${blog_dir}/posts/${basefile} + fi +} + +deletepost() { + echo -n Mysql password: + read -s sqlpassword + + echo -e "\nWhich post would you like to delete?" + ssh root@tovijaeschke.xyz "mysql -u root -p${sqlpassword} -D PersonalWebsite -B --disable-column-names -e \"SELECT id,title FROM Posts;\"" + read -p "\nWhich post would you like to delete?" post + ssh root@tovijaeschke.xyz "mysql -u root -p${sqlpassword} -D PersonalWebsite -e \"DELETE FROM Posts WHERE id=${post};\" && \ + post=\$(mysql -B -u root -p${sqlpassword} -D PersonalWebsite --disable-column-names -e \"SELECT MAX(id) FROM Posts;\") && \ + mysql -u root -p${sqlpassword} -D PersonalWebsite -e \"ALTER TABLE Posts AUTO_INCREMENT=\$post;\"" +} + +helpmsg() { + printf "\nBLOG UPLOAD SCRIPT\n\n\tn - new draft\n\tp - preview post\n\tu - upload post\n\tdd - delete draft\n\tdp - delete post\n\th - help message\n\n" +} + +case "$1" in + n*) newpost ;; + p*) preview ;; + u*) upload ;; + dd*) deletedraft ;; + dp*) deletepost ;; + h*) helpmsg ;; + *) helpmsg ;; +esac diff --git a/.local/bin/dmenu-bangs b/.local/bin/dmenu-bangs index cdf7e3b..97735cc 100755 --- a/.local/bin/dmenu-bangs +++ b/.local/bin/dmenu-bangs @@ -23,27 +23,27 @@ COMMANDS["clipboard"]="greenclip print | dmenu -i -l 10 -m 0 -fn 'Inconsolata:si LABELS["clipboard"]="" # search local files -COMMANDS["emoji"]="~/.local/bin/dmenu-scripts/dmenu-emoji" +COMMANDS["emoji"]="~/.bin/dmenu-scripts/dmenu-emoji" LABELS["emoji"]="" # mount drives -COMMANDS["mount"]="sudo ~/.local/bin/dmenu-scripts/dmenu-mount" +COMMANDS["mount"]="sudo ~/.bin/dmenu-scripts/dmenu-mount" LABELS["mount"]="" # umount drives -COMMANDS["unmount"]="sudo ~/.local/bin/dmenu-scripts/dmenu-mount unmount" +COMMANDS["unmount"]="sudo ~/.bin/dmenu-scripts/dmenu-mount unmount" LABELS["unmount"]="" # shutdown -COMMANDS["shutdown"]="sudo ~/.local/bin/dmenu-scripts/dmenu-shutdown" +COMMANDS["shutdown"]="sudo ~/.bin/dmenu-scripts/dmenu-shutdown" LABELS["shutdown"]="" # PDF man pages -COMMANDS["man"]="~/.local/bin/dmenu-scripts/dmenu-man" +COMMANDS["man"]="~/.bin/dmenu-scripts/dmenu-man" LABELS["man"]="" # locate files -COMMANDS["locate"]="~/.local/bin/dmenu-scripts/dmenu-locate" +COMMANDS["locate"]="~/.bin/dmenu-scripts/dmenu-locate" LABELS["locate"]="" ################################################################################ diff --git a/.local/bin/fenc b/.local/bin/fenc new file mode 100755 index 0000000..1e95ee4 Binary files /dev/null and b/.local/bin/fenc differ diff --git a/.local/bin/workflow/cabl b/.local/bin/workflow/cabl deleted file mode 100755 index 9be66a6..0000000 --- a/.local/bin/workflow/cabl +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -# Dependencies are xclip and xorg-xprop. -# qrencode required for qrcode generation. -# groff/zathura required for man pages. -prim="$(xclip -o)"; [ -z "$prim" ] && exit - -PID=$(xprop -id "$(xprop -root | awk '/_NET_ACTIVE_WINDOW\(WINDOW\)/{print $NF}')" | grep -m 1 PID | cut -d " " -f 3) -PID=$(echo "$(pstree -lpA "$PID" | tail -n 1)" | awk -F'---' '{print $NF}' | sed -re 's/[^0-9]//g') -cd "$(readlink /proc/"$PID"/cwd)" -[[ "${prim}" == *"~"* ]] && prim=$(echo "~/go/src/gitlab.com/tovijaeschke/website" | sed 's@~@'"$HOME"'@g') -[ -f "$prim" ] && xdg-open "$prim" && exit -[ -d "$prim" ] && st -c "$prim" && exit - -websearch() { "$BROWSER" "https://duckduckgo.com/?q=$@" ;} -wikipedia() { "$BROWSER" "https://en.wikipedia.org/wiki/$@" ;} -wiktionary() { "$BROWSER" "https://en.wiktionary.org/wiki/$@" ;} -piratebay() { "$BROWSER" "https://piratebays.fi/s/?q=$@" ;} -maps() { "$BROWSER" "https://www.openstreetmap.org/search?query=$@" ;} -ebay() { "$BROWSER" "https://www.ebay.com/sch/$@" ;} - -echo "$prim" | grep "^.*\.[A-Za-z]\+.*" >/dev/null && gotourl() { "$BROWSER" "$@" ;} -echo "$prim" | grep "^.*@.*\.[A-Za-z]\+$" >/dev/null && email() { xdg-email "$@" ;} -command -v qrencode >/dev/null && qrcode() { qrencode "$@" -s 10 -o /tmp/qr.png && xdg-open /tmp/qr.png ;} -man -k "^$prim$" >/dev/null && manual() { man -Tpdf "$prim" | zathura - ;} - -func="$(declare -F | awk '{print $3}' | dmenu -p "Plumb $prim to?" -i -l 15)" - -[ -z "$func" ] || "$func" "$prim" diff --git a/.local/bin/workflow/change_wp b/.local/bin/workflow/change_wp deleted file mode 100755 index de2af74..0000000 --- a/.local/bin/workflow/change_wp +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -notify-send "Changing wallpaper" -feh --bg-fill ~/pix/cyberpunk/$(ls ~/pix/cyberpunk | shuf -n 1) diff --git a/.local/bin/workflow/compile b/.local/bin/workflow/compile deleted file mode 100755 index 44a9e54..0000000 --- a/.local/bin/workflow/compile +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -case "$1" in - *.asm) nasm -f elf64 "$1" && ld "${1%.*}".o -o "${1%.*}"; rm "${1%.*}".o ;; - *.c) gcc "$1" -o "${1%.*}" ;; - *.go) go build "$1" ;; - Makefile) make ;; -esac diff --git a/.local/bin/workflow/extern_monitor b/.local/bin/workflow/extern_monitor deleted file mode 100755 index d2ec224..0000000 --- a/.local/bin/workflow/extern_monitor +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash -intern=LVDS-1 -extern=VGA-1 - -if xrandr | grep "$extern connected"; then - xrandr --output ${extern} --auto --right-of ${intern} -else - xrandr --output ${extern} --off --output ${intern} --auto -fi diff --git a/.local/bin/workflow/extract b/.local/bin/workflow/extract deleted file mode 100755 index d09a790..0000000 --- a/.local/bin/workflow/extract +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -if [ -f $1 ] ; then - # NAME=${1%.*} - # mkdir $NAME && cd $NAME - case $1 in - *.tar.bz2) tar xvjf ../$1 ;; - *.tar.gz) tar xvzf ../$1 ;; - *.tar.xz) tar xvJf ../$1 ;; - *.lzma) unlzma ../$1 ;; - *.bz2) bunzip2 ../$1 ;; - *.rar) unrar x -ad ../$1 ;; - *.gz) gunzip ../$1 ;; - *.tar) tar xvf ../$1 ;; - *.tbz2) tar xvjf ../$1 ;; - *.tgz) tar xvzf ../$1 ;; - *.zip) unzip ../$1 ;; - *.Z) uncompress ../$1 ;; - *.7z) 7z x ../$1 ;; - *.xz) unxz ../$1 ;; - *.exe) cabextract ../$1 ;; - *) echo "extract: '$1' - unknown archive method" ;; - esac -else -echo "$1 - file does not exist" - fi diff --git a/.local/bin/workflow/greenclip b/.local/bin/workflow/greenclip deleted file mode 100755 index 16f89de..0000000 Binary files a/.local/bin/workflow/greenclip and /dev/null differ diff --git a/.local/bin/workflow/lock_toggle b/.local/bin/workflow/lock_toggle deleted file mode 100755 index 1efee0c..0000000 --- a/.local/bin/workflow/lock_toggle +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -if [ $(pgrep xautolock) ] -then - killall xautolock - notify-send "🔓 Turning off xautolock" -else - xautolock -time 10 -locker slock & - notify-send "🔒 Turning on xautolock" -fi diff --git a/.local/bin/workflow/voldown b/.local/bin/workflow/voldown deleted file mode 100755 index 148560a..0000000 --- a/.local/bin/workflow/voldown +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -pactl set-sink-volume @DEFAULT_SINK@ -5% -vol=$(amixer sget Master | grep 'Right:' | awk -F'[][]' '{ print $2 }') -notify-send -t 500 "Volume: ${vol}" diff --git a/.local/bin/workflow/volup b/.local/bin/workflow/volup deleted file mode 100755 index 508d561..0000000 --- a/.local/bin/workflow/volup +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -pactl set-sink-volume @DEFAULT_SINK@ +5% -vol=$(amixer sget Master | grep 'Right:' | awk -F'[][]' '{ print $2 }') -notify-send -t 500 "Volume: ${vol}" diff --git a/.local/bin/workflow/vpn b/.local/bin/workflow/vpn deleted file mode 100755 index fd2c9e1..0000000 --- a/.local/bin/workflow/vpn +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash - - -listandReturn() { - printf "Listing contents of %s.\\n" "$1" - ls -rc "$1" | awk -F '/' '{print $NF}' | nl - read -erp "Pick an entry by number to $2, or press ctrl-c to cancel. " number - chosen="$(ls -rc "$1" | nl | grep -w "$number" | awk '{print $2}')" - basefile="$(basename "$chosen")" && base="${basefile%.*}" -} - -listandReturn ~/.openvpn/UDP\ 1194\ Normal/ - -sudo openvpn --config ~/.openvpn/UDP\ 1194\ Normal/${basefile}