Browse Source

Thu 31 Mar 2022 19:56:47 ACDT

master
Tovi Jaeschke-Rogers 3 years ago
parent
commit
a2c907d7e9
40 changed files with 554 additions and 959 deletions
  1. +4
    -101
      .bash_profile
  2. +8
    -111
      .bashrc
  3. +4
    -0
      .config/lf/cleaner
  4. +119
    -0
      .config/lf/lfrc
  5. +43
    -0
      .config/lf/scope
  6. +0
    -31
      .config/mutt/accounts/1-tovi.muttrc
  7. +0
    -4
      .config/mutt/muttrc
  8. +25
    -0
      .config/nvim/coc-settings.json
  9. +163
    -113
      .config/nvim/init.vim
  10. +27
    -0
      .config/nvim/telescope.lua
  11. +0
    -13
      .dwm/autostart.sh
  12. +0
    -169
      .local/bin/bcms
  13. +0
    -5
      .local/bin/c
  14. +0
    -98
      .local/bin/dmenu-bangs
  15. +0
    -15
      .local/bin/dmenu-scripts/dmenu-emoji
  16. +0
    -3
      .local/bin/dmenu-scripts/dmenu-locate
  17. +0
    -3
      .local/bin/dmenu-scripts/dmenu-man
  18. +0
    -28
      .local/bin/dmenu-scripts/dmenu-mount
  19. +0
    -24
      .local/bin/dmenu-scripts/dmenu-shutdown
  20. +10
    -0
      .local/bin/dwm-autostart
  21. +2
    -3
      .local/bin/dwm-sss
  22. +24
    -0
      .local/bin/lfpreview
  23. +8
    -0
      .local/bin/lock_mine
  24. +0
    -12
      .local/bin/new-repo
  25. +0
    -9
      .local/bin/nt
  26. +8
    -0
      .local/bin/pbr
  27. +0
    -10
      .local/bin/pentest/bytetoword
  28. +0
    -163
      .local/bin/pentest/leak-lookup
  29. +3
    -0
      .local/bin/screencapture
  30. +3
    -0
      .local/bin/setbg
  31. +0
    -7
      .local/bin/shellcode-gen
  32. +3
    -0
      .local/bin/spotify-next
  33. +3
    -0
      .local/bin/spotify-prev
  34. +3
    -0
      .local/bin/spotify-toggle
  35. +0
    -26
      .local/bin/vg
  36. +3
    -1
      .local/bin/voldown
  37. +3
    -1
      .local/bin/volup
  38. +16
    -9
      .xinitrc
  39. +32
    -0
      .zshrc
  40. +40
    -0
      update.sh

+ 4
- 101
.bash_profile View File

@ -1,102 +1,5 @@
#!/bin/bash
#
# ~/.bash_profile
#
set -o vi
bind -m vi-insert "\C-l":clear-screen
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
# 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' ':')$HOME/.composer/vendor/bin"
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\] "
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"
[ -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"
eval "$(thefuck --alias)"
[[ -f ~/.bashrc ]] && . ~/.bashrc

+ 8
- 111
.bashrc View File

@ -1,116 +1,13 @@
#!/bin/bash
#
# ~/.bashrc
#
export PATH=~/go/bin:/snap/bin:/usr/sandbox/:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/usr/share/games:/usr/local/sbin:/usr/sbin:/sbin:$PATH
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
set -o vi
bind -m vi-insert "\C-l":clear-screen
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'
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
}
else
aupdate() {
sudo "apt update && apt upgrade"
}
alias ls='ls --color=auto'
PS1='[\u@\h \W]\$ '
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' ':')"
fi
set -o vi
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"
[ -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"

+ 4
- 0
.config/lf/cleaner View File

@ -0,0 +1,4 @@
#!/bin/sh
if [ -n "$FIFO_UEBERZUG" ]; then
printf '{"action": "remove", "identifier": "PREVIEW"}\n' > "$FIFO_UEBERZUG"
fi

+ 119
- 0
.config/lf/lfrc View File

@ -0,0 +1,119 @@
# Luke's lf settings
# Note on Image Previews
# For those wanting image previews, like this system, there are four steps to
# set it up. These are done automatically for LARBS users, but I will state
# them here for others doing it manually.
#
# 1. ueberzug must be installed.
# 2. The scope file (~/.config/lf/scope for me), must have a command similar to
# mine to generate ueberzug images.
# 3. A `set cleaner` line as below is a cleaner script.
# 4. lf should be started through a wrapper script (~/.local/bin/lfub for me)
# that creates the environment for ueberzug. This command can be be aliased
# in your shellrc (`alias lf="lfub") or if set to a binding, should be
# called directly instead of normal lf.
# Basic vars
set shellopts '-eu'
set ifs "\n"
set scrolloff 10
set icons
set period 1
set hiddenfiles ".*:*.aux:*.log:*.bbl:*.bcf:*.blg:*.run.xml"
set cleaner '~/.config/lf/cleaner'
set previewer '~/.config/lf/scope'
# cmds/functions
cmd open ${{
case $(file --mime-type "$(readlink -f $f)" -b) in
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet) localc $fx ;;
image/vnd.djvu|application/pdf|application/octet-stream|application/postscript) setsid -f zathura $fx >/dev/null 2>&1 ;;
text/*|application/json|inode/x-empty) $EDITOR $fx;;
image/x-xcf) gimp $f >/dev/null 2>&1 ;;
image) display -- $f ;;
audio/*) mpv --audio-display=no $f ;;
video/*) mpv $f -quiet >/dev/null 2>&1 ;;
application/pdf|application/vnd*|application/epub*) zathura $fx >/dev/null 2>&1 ;;
esac
}}
cmd mkdir $mkdir -p "$(echo $* | tr ' ' '\ ')"
cmd extract ${{
clear; tput cup $(($(tput lines)/3)); tput bold
set -f
printf "%s\n\t" "$fx"
printf "extract?[y/N]"
read ans
[ $ans = "y" ] && aunpack $fx
}}
cmd delete ${{
clear; tput cup $(($(tput lines)/3)); tput bold
set -f
printf "%s\n\t" "$fx"
printf "delete?[y/N]"
read ans
[ $ans = "y" ] && rm -rf -- $fx
}}
cmd moveto ${{
clear; tput cup $(($(tput lines)/3)); tput bold
set -f
clear; echo "Move to where?"
dest="$(sed -e 's/\s*#.*//' -e '/^$/d' -e 's/^\S*\s*//' ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | fzf | sed 's|~|$HOME|')" &&
for x in $fx; do
eval mv -iv \"$x\" \"$dest\"
done &&
notify-send "🚚 File(s) moved." "File(s) moved to $dest."
}}
cmd copyto ${{
clear; tput cup $(($(tput lines)/3)); tput bold
set -f
clear; echo "Copy to where?"
dest="$(sed -e 's/\s*#.*//' -e '/^$/d' -e 's/^\S*\s*//' ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | fzf | sed 's|~|$HOME|')" &&
for x in $fx; do
eval cp -ivr \"$x\" \"$dest\"
done &&
notify-send "📋 File(s) copied." "File(s) copies to $dest."
}}
cmd setbg "$1"
cmd bulkrename $vidir
# Bindings
map <c-f> $lf -remote "send $id select '$(fzf)'"
map J $lf -remote "send $id cd $(sed -e 's/\s*#.*//' -e '/^$/d' -e 's/^\S*\s*//' ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | fzf)"
map gh
map g top
map D delete
map E extract
map C copyto
map M moveto
map <c-n> push :mkdir<space>
map <c-r> reload
map <c-s> set hidden!
map <enter> shell
map x $$f
map X !$f
map o &mimeopen $f
map O $mimeopen --ask $f
map A rename # at the very end
map c push A<c-u> # new rename
map I push A<c-a> # at the very beginning
map i push A<a-b><a-b><a-f> # before extention
map a push A<a-b> # after extention
map B bulkrename
map b $setbg $f
map <c-e> down
map <c-y> up
map V push :!nvim<space>
map W $setsid -f $TERMINAL >/dev/null 2>&1
map Y $printf "%s" "$fx" | xclip -selection clipboard

+ 43
- 0
.config/lf/scope View File

@ -0,0 +1,43 @@
#!/bin/sh
# File preview handler for lf.
set -C -f
IFS="$(printf '%b_' '\n')"; IFS="${IFS%_}"
image() {
if [ -n "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ] && command -V ueberzug >/dev/null 2>&1; then
printf '{"action": "add", "identifier": "PREVIEW", "x": "%s", "y": "%s", "width": "%s", "height": "%s", "scaler": "contain", "path": "%s"}\n' "$4" "$5" "$(($2-1))" "$(($3-1))" "$1" > "$FIFO_UEBERZUG"
else
mediainfo "$1"
fi
}
ifub() {
[ -n "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ] && command -V ueberzug >/dev/null 2>&1
}
# Note that the cache file name is a function of file information, meaning if
# an image appears in multiple places across the machine, it will not have to
# be regenerated once seen.
case "$(file --dereference --brief --mime-type -- "$1")" in
image/*) image "$1" "$2" "$3" "$4" "$5" ;;
text/html) lynx -width="$4" -display_charset=utf-8 -dump "$1" ;;
text/troff) man ./ "$1" | col -b ;;
text/* | */xml | application/json) cat "$1" ;;
application/zip) atool --list -- "$1" ;;
audio/* | application/octet-stream) mediainfo "$1" || exit 1;;
video/* )
CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/lf/thumb.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | awk '{print $1}')"
[ ! -f "$CACHE" ] && ffmpegthumbnailer -i "$1" -o "$CACHE" -s 0
image "$CACHE" "$2" "$3" "$4" "$5"
;;
*/pdf)
CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/lf/thumb.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | awk '{print $1}')"
[ ! -f "$CACHE.jpg" ] && pdftoppm -jpeg -f 1 -singlefile "$1" "$CACHE"
image "$CACHE.jpg" "$2" "$3" "$4" "$5"
;;
*opendocument*) odt2txt "$1" ;;
application/pgp-encrypted) gpg -d -- "$1" ;;
esac
exit 1

+ 0
- 31
.config/mutt/accounts/1-tovi.muttrc View File

@ -1,31 +0,0 @@
# vim: filetype=neomuttrc
# muttrc file for account tovi
set realname = "Tovi Jaeschke-Rogers"
set from = "tovi@tovijaeschke.xyz"
set sendmail = "msmtp -a tovi"
alias me Tovi Jaeschke-Rogers <tovi@tovijaeschke.xyz>
set folder = /Users/tovijaeschke-rogers/.local/share/mail/tovi
set header_cache = /Users/tovijaeschke-rogers/.cache/mutt-wizard/tovi/headers
set message_cachedir = /Users/tovijaeschke-rogers/.cache/mutt-wizard/tovi/bodies
set mbox_type = Maildir
set spoolfile = +INBOX
set postponed = +Drafts
set record = +Sent
set trash = +Trash
mailboxes $spoolfile $record $postponed $trash
set smtp_pass = "`pass mutt-wizard-tovi`"
set smtp_url = "smtp://tovi@mail.tovijaeschke.xyz:587"
set crypt_autosign = yes
set crypt_opportunistic_encrypt = yes
set pgp_self_encrypt = yes
set pgp_default_key = 78CC949ADAAF9556
bind index,pager gg noop
bind index,pager g noop
bind index,pager M noop
bind index,pager C noop
bind index gg first-entry
macro index o "<shell-escape>mailsync -V tovi<enter>" "run mbsync to sync tovi"
#unmailboxes *

+ 0
- 4
.config/mutt/muttrc View File

@ -1,4 +0,0 @@
# vim: filetype=neomuttrc
source /usr/local/share/mutt-wizard/mutt-wizard.muttrc # mw-autogenerated
source /Users/tovijaeschke-rogers/.config/mutt/accounts/1-tovi.muttrc # mw-autogenerated
macro index,pager i1 '<sync-mailbox><enter-command>source /Users/tovijaeschke-rogers/.config/mutt/accounts/1-tovi.muttrc<enter><change-folder>!<enter>;<check-stats>' "switch to tovi@tovijaeschke.xyz" # mw-autogenerated

+ 25
- 0
.config/nvim/coc-settings.json View File

@ -0,0 +1,25 @@
{
"languageserver": {
"ccls": {
"command": "ccls",
"filetypes": [
"c",
"cpp",
"objc",
"objcpp"
],
"rootPatterns": [
".ccls",
"compile_commands.json",
".vim/",
".git/",
".hg/"
],
"initializationOptions": {
"cache": {
"directory": "/tmp/ccls"
}
}
}
}
}

+ 163
- 113
.config/nvim/init.vim View File

@ -1,125 +1,175 @@
" My awesome vimrc
let mapleader =","
if ! filereadable(expand('~/.config/nvim/autoload/plug.vim'))
echo "Downloading junegunn/vim-plug to manage plugins..."
silent !mkdir -p ~/.config/nvim/autoload/
silent !curl "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim" > ~/.config/nvim/autoload/plug.vim
autocmd VimEnter * PlugInstall
echo "Downloading junegunn/vim-plug to manage plugins..."
silent !mkdir -p ~/.config/nvim/autoload/
silent !curl "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim" > ~/.config/nvim/autoload/plug.vim
autocmd VimEnter * PlugInstall
endif
function! Cond(cond, ...)
let opts = get(a:000, 0, {})
return a:cond ? opts : extend(opts, { 'on': [], 'for': [] })
endfunction
call plug#begin('~/.config/nvim/plugged')
Plug 'morhetz/gruvbox'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'ap/vim-css-color'
if !exists('g:vscode')
Plug 'neoclide/coc.nvim', Cond(!exists('g:vscode'))
Plug 'nvim-lua/popup.nvim', Cond(!exists('g:vscode'))
Plug 'nvim-lua/plenary.nvim', Cond(!exists('g:vscode'))
Plug 'nvim-telescope/telescope.nvim', Cond(!exists('g:vscode'))
Plug 'nvim-telescope/telescope-fzy-native.nvim', Cond(!exists('g:vscode'))
Plug 'vimwiki/vimwiki', Cond(!exists('g:vscode'))
Plug 'ap/vim-css-color', Cond(!exists('g:vscode'))
endif
Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }
Plug 'darrikonn/vim-gofmt', { 'do': ':GoUpdateBinaries' }
call plug#end()
let g:airline_powerline_fonts=1
call plug#end()
" Some basics:
set go=a
set mouse=a
set nohlsearch
set clipboard+=unnamedplus
set incsearch
set ignorecase
set smartcase
set linebreak
set noswapfile
set nobackup
set undodir=~/.config/nvim/undodir
set undofile
"let g:gruvbox_contrast_dark = 'hard'
"if exists('+termguicolors')
" let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
" let &t_8b = "\<Esc>[38;2;%lu;%lu;%lum"
"endif
"let g:gruvbox_invert_selection = '0'
"colorscheme gruvbox
"set background=dark
nnoremap c "_c
set nocompatible
filetype plugin on
syntax on
set encoding=utf-8
set number relativenumber
" Indent marks
"set listchars=tab:\|_
"set list
" Tab 2 spaces
filetype plugin indent on
set tabstop=2 softtabstop=2 expandtab shiftwidth=2 smarttab
" Disables automatic commenting on newline:
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
" coc
inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
nmap <leader>gd <Plug>(coc-definition)
nmap <leader>gr <Plug>(coc-references)
nmap <leader>rr <Plug>(coc-rename)
nnoremap <leader>prw :CocSearch <C-R>=expand("<cword>")<CR><CR>
inoremap <expr> <C-j> pumvisible() ? "\<Down>" : "\<C-j>"
inoremap <expr> <C-k> pumvisible() ? "\<Up>" : "\<C-k>"
" fzf remaps
"nnoremap <C-p> :GFiles<CR>
nnoremap <C-q> :GFiles<CR>
nnoremap <C-a> :Files<CR>
let g:fzf_layout = { 'window': { 'width': 0.8, 'height': 0.5, 'highlight': 'Comment' } }
" Spell-check set to <leader>o, 'o' for 'orthography':
map <leader>o :setlocal spell! spelllang=en_au<CR>
" Splits open at the bottom and right, which is non-retarded, unlike vim defaults.
set splitbelow splitright
" Shortcutting split navigation, saving a keypress:
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
" Check file in shellcheck:
map <leader>s :!clear && shellcheck %<CR>
" Replace all is aliased to S.
nnoremap <c-s> :%s//g<Left><Left>
" For chrome extension development
" nnoremap <c-h> :set syntax=
" Navigating with guides
inoremap <leader><leader> <Esc>/<++><Enter>"_c4l
vnoremap <leader><leader> <Esc>/<++><Enter>"_c4l
map <leader><leader> <Esc>/<++><Enter>"_c4l
" Remember last cursor position
autocmd BufReadPost * if @% !~# '\.git[\/\\]COMMIT_EDITMSG$' && line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
" Copy entire document
noremap <leader>y <Esc>ggyG<C-o>
map <leader>y <Esc>ggyG<C-o>
autocmd BufNewFile,BufRead *.gohtml set syntax=html
set clipboard+=unnamedplus
set nohlsearch
set incsearch
set ignorecase
if !exists('g:vscode')
set go=a
set mouse=a
set smartcase
set linebreak
set noswapfile
set nobackup
set undodir=~/.config/nvim/undodir
set undofile
nnoremap c "_c
set nocompatible
filetype plugin on
syntax on
set encoding=utf-8
set number relativenumber
" Tab 2 spaces
filetype plugin indent on
set tabstop=4 softtabstop=4 expandtab shiftwidth=4 smarttab
" Disables automatic commenting on newline:
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
" Remember last cursor position
autocmd BufReadPost * if @% !~# '\.git[\/\\]COMMIT_EDITMSG$' && line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
" Copy entire document
noremap <leader>y <Esc>ggyG<C-o>
map <leader>y <Esc>ggyG<C-o>
" Set gohtml template files to html syntax
autocmd BufNewFile,BufRead *.gohtml set syntax=html
" NETRW
let g:netrw_liststyle = 3
let g:netrw_banner = 0
let g:netrw_browse_split = 4
let g:netrw_winsize = 20
let g:netrw_altv = 1
let g:NetrwIsOpen=0
function! ToggleNetrw()
if g:NetrwIsOpen
let i = bufnr("$")
while (i >= 1)
if (getbufvar(i, "&filetype") == "netrw")
silent exe "bwipeout " . i
endif
let i-=1
endwhile
let g:NetrwIsOpen=0
else
let g:NetrwIsOpen=1
silent Lexplore
endif
endfunction
" Add your own mapping. For example:
noremap <silent> <C-p> :call ToggleNetrw()<CR>
" coc
highlight CocErrorSign ctermfg=Black ctermbg=Magenta
inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
nmap <leader>gd <Plug>(coc-definition)
nmap <leader>gr <Plug>(coc-references)
nmap <leader>rr <Plug>(coc-rename)
nnoremap <leader>prw :CocSearch <C-R>=expand("<cword>")<CR><CR>
inoremap <expr> <C-j> pumvisible() ? "\<Down>" : "\<C-j>"
inoremap <expr> <C-k> pumvisible() ? "\<Up>" : "\<C-k>"
try
nmap <silent> <leader>ej :call CocAction('diagnosticNext')<cr>
nmap <silent> <leader>ek :call CocAction('diagnosticPrevious')<cr>
endtry
" Telescope remaps
lua require("telescope")
nnoremap <leader>gs :lua require('telescope.builtin').grep_string({ search = vim.fn.input("Grep For > ")})<CR>
nnoremap <C-q> :lua require('telescope.builtin').git_files()<CR>
nnoremap <C-a> :lua require('telescope.builtin').find_files()<CR>
nnoremap <leader>fb <cmd>lua require('telescope.builtin').buffers()<cr>
" VimWiki
let pentest_wiki = {}
let pentest_wiki.path = '~/Documents/PentestWiki/'
let pentest_wiki.path_html = '~/Documents/PentestWikiHtml/'
let pentest_wiki.syntax = 'markdown'
let pentest_wiki.ext = '.md'
let pentest_wiki.custom_wiki2html = '~/.local/bin/vimwiki_convert.py'
let g:vimwiki_list = [pentest_wiki]
let g:vimwiki_ext2syntax = {'.md': 'markdown', '.markdown': 'markdown', '.mdown': 'markdown'}
au filetype vimwiki silent! iunmap <buffer> <Tab>
" Spell-check
map <leader>o :setlocal spell! spelllang=en_au<CR>
" Shortcutting split navigation, saving a keypress:
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
" Replace all is aliased to S.
nnoremap <c-s> :%s//g<Left><Left>
" Navigating with guides
inoremap <leader><leader> <Esc>/<++><Enter>"_c4l
vnoremap <leader><leader> <Esc>/<++><Enter>"_c4l
map <leader><leader> <Esc>/<++><Enter>"_c4l
endif

+ 27
- 0
.config/nvim/telescope.lua View File

@ -0,0 +1,27 @@
local actions = require('telescope.actions')
require('telescope').setup {
defaults = {
file_sorter = require('telescope.sorters').get_fzy_sorter,
prompt_prefix = ' >',
color_devicons = true,
file_previewer = require('telescope.previewers').vim_buffer_cat.new,
grep_previewer = require('telescope.previewers').vim_buffer_vimgrep.new,
qflist_previewer = require('telescope.previewers').vim_buffer_qflist.new,
mappings = {
i = {
["<C-x>"] = false,
["<C-q>"] = actions.send_to_qflist,
},
}
},
extensions = {
fzy_native = {
override_generic_sorter = false,
override_file_sorter = true,
}
}
}
require('telescope').load_extension('fzy_native')

+ 0
- 13
.dwm/autostart.sh View File

@ -1,13 +0,0 @@
#!/bin/bash
~/.local/bin/remap-keys
#pulseaudio --start &
dunst &
xautolock -time 10 -locker slock &
feh --bg-fill ~/Pictures/wp/$(ls ~/Pictures/wp/ | shuf -n 1)
#compton -b --backend xrender --config ~/.config/compton/compton.conf &
unclutter &
#transmission-daemon &
#conky -d &
~/.dwm/dwm-sss &

+ 0
- 169
.local/bin/bcms View File

@ -1,169 +0,0 @@
#!/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

+ 0
- 5
.local/bin/c View File

@ -1,5 +0,0 @@
#!/bin/bash
F=$(fzf)
[ -z "$F" ] || nvim "$F"

+ 0
- 98
.local/bin/dmenu-bangs View File

@ -1,98 +0,0 @@
#!/usr/bin/env bash
# author: unknown
# sentby: MoreChannelNoise (https://www.youtube.com/user/MoreChannelNoise)
# editby: gotbletu (https://www.youtube.com/user/gotbletu)
# demo: https://www.youtube.com/watch?v=kxJClZIXSnM
# info: this is a script to launch other rofi scripts,
# saves us the trouble of binding multiple hotkeys for each script,
# when we can just use one hotkey for everything.
declare -A LABELS
declare -A COMMANDS
###
# List of defined 'bangs'
# launch programs
COMMANDS["apps"]="dmenu_run -i -m 0 -fn 'Inconsolata:size=10' -nb '#222222' -nf '#bbbbbb' -sb '#005577' -sf '#eeeeee'"
LABELS["apps"]=""
# clipboard
COMMANDS["clipboard"]="greenclip print | dmenu -i -l 10 -m 0 -fn 'Inconsolata:size=10' -nb '#222222' -nf '#bbbbbb' -sb '#005577' -sf '#eeeeee' -p 'clipboard: ' | xclip -selection clipboard"
LABELS["clipboard"]=""
# search local files
COMMANDS["emoji"]="~/.bin/dmenu-scripts/dmenu-emoji"
LABELS["emoji"]=""
# mount drives
COMMANDS["mount"]="sudo ~/.bin/dmenu-scripts/dmenu-mount"
LABELS["mount"]=""
# umount drives
COMMANDS["unmount"]="sudo ~/.bin/dmenu-scripts/dmenu-mount unmount"
LABELS["unmount"]=""
# shutdown
COMMANDS["shutdown"]="sudo ~/.bin/dmenu-scripts/dmenu-shutdown"
LABELS["shutdown"]=""
# PDF man pages
COMMANDS["man"]="~/.bin/dmenu-scripts/dmenu-man"
LABELS["man"]=""
# locate files
COMMANDS["locate"]="~/.bin/dmenu-scripts/dmenu-locate"
LABELS["locate"]=""
################################################################################
# do not edit below
################################################################################
##
# Generate menu
##
function print_menu()
{
for key in ${!LABELS[@]}
do
echo "$key ${LABELS}"
# echo "$key ${LABELS[$key]}"
# my top version just shows the first field in labels row, not two words side by side
done
}
##
# Show rofi.
##
function start()
{
print_menu | sort | dmenu -i -m 0 -fn "Inconsolata:size=10" -nb "#222222" -nf "#bbbbbb" -sb "#005577" -sf "#eeeeee" -p "dmenu bangs: "
}
# Run it
value="$(start)"
# Split input.
# grab upto first space.
choice=${value%%\ *}
# graph remainder, minus space.
input=${value:$((${#choice}+1))}
##
# Cancelled? bail out
##
if test -z ${choice}
then
exit
fi
# check if choice exists
if test ${COMMANDS[$choice]+isset}
then
# Execute the choice
eval ${COMMANDS[$choice]}
else
eval $choice | dmenu
fi

+ 0
- 15
.local/bin/dmenu-scripts/dmenu-emoji View File

@ -1,15 +0,0 @@
#!/bin/bash
#cat ~/.emoji | dmenu -i -l 10 -m 0 -fn 'Inconsolata:size=10' -nb '#222222' -nf '#bbbbbb' -sb '#005577' -sf '#eeeeee' -p 'Emoji: '
chosen=$(grep -v "#" ~/.emoji | dmenu -i -l 20 -m 0 -fn 'Inconsolata:size=10' -nb '#222222' -nf '#bbbbbb' -sb '#005577' -sf '#eeeeee' -p 'emoji: ')
[ "$chosen" != "" ] || exit
c=$(echo "$chosen" | sed "s/ .*//")
echo "$c" | tr -d '\n' | xclip -selection clipboard
notify-send "'$c' copied to clipboard." &
s=$(echo "$chosen" | sed "s/.*; //" | awk '{print $1}')
echo "$s" | tr -d '\n' | xclip
notify-send "'$s' copied to primary." &

+ 0
- 3
.local/bin/dmenu-scripts/dmenu-locate View File

@ -1,3 +0,0 @@
#!/bin/bash
xdg-open $(locate home media | dmenu -l 20 -i -m 0 -fn "Inconsolata:size=10" -nb "#000000" -nf "#bbbbbb" -sb "#0099cc" -sf "#000000" -p "Locate: ")

+ 0
- 3
.local/bin/dmenu-scripts/dmenu-man View File

@ -1,3 +0,0 @@
#!/bin/bash
man -k . | dmenu -i -m 0 -fn "Inconsolata:size=10" -nb "#000000" -nf "#bbbbbb" -sb "#0099cc" -sf "#000000" -l 20 -p "Man: " | awk '{print $1}' | xargs -r man -Tpdf | zathura -

+ 0
- 28
.local/bin/dmenu-scripts/dmenu-mount View File

@ -1,28 +0,0 @@
#!/bin/bash
COLS="name,type,size,mountpoint"
if [[ "$1" == "unmount" ]]
then
drives="$(lsblk -rpo "$COLS" | awk '$2=="part"&&$4!=""{printf "%s (%s)\n",$1,$3}')"
[ -z "$drives" ] && exit 1
chosen="$(echo "$drives" | dmenu -i -l 10 -m 0 -fn 'Inconsolata:size=10' -nb '#222222' -nf '#bbbbbb' -sb '#005577' -sf '#eeeeee' -p 'Drive to unmount: ' | awk '{print $1}')"
[ -z "$chosen" ] && exit 1
umount $chosen && notify-send "$chosen umounted" || notfiy-send "Error unmounting $chosen"
else
drives="$(lsblk -rpo "$COLS" | awk '$2=="part"&&$4==""{printf "%s (%s)\n",$1,$3}')"
[ -z "$drives" ] && exit 1
chosen="$(echo "$drives" | dmenu -i -l 10 -m 0 -fn 'Inconsolata:size=10' -nb '#222222' -nf '#bbbbbb' -sb '#005577' -sf '#eeeeee' -p 'Drive to mount: ' | awk '{print $1}')"
[ -z "$chosen" ] && exit 1
mount "$chosen" && exit 0
mp="$(find /mnt /media /mount /home -type d -maxdepth 1 2>/dev/null | dmenu -i -l 10 -m 0 -fn 'Inconsolata:size=10' -nb '#222222' -nf '#bbbbbb' -sb '#005577' -sf '#eeeeee' -p 'Mount point: ' | awk '{print $1}')"
[ "$mp" = "" ] && exit 1
if [ ! -d "$mp" ]; then
mkdiryn=$(printf "No\\nYes" | dmenu -i -m 0 -fn 'Inconsolata:size=10' -nb '#222222' -nf '#bbbbbb' -sb '#005577' -sf '#eeeeee' -p 'Mount point does not exist, create it?')
[ "$mkdiryn" = "Yes" ] && sudo -A mkdir -p "$mp"
fi
echo $mp
mount "$chosen" "$mp" && notify-send "$chosen mounted to $mp." || notify-send "Error mounting $chosen to $mp"
fi

+ 0
- 24
.local/bin/dmenu-scripts/dmenu-shutdown View File

@ -1,24 +0,0 @@
#!/bin/bash
option=$(echo -e "Lock the screen\nReboot\nShutdown\nHibernate" | dmenu -i -m 0 -fn "Inconsolata:size=10" -nb "#000000" -nf "#bbbbbb" -sb "#0099cc" -sf "#000000" -p "Power menu: ")
answer=$(echo -e "No\nYes" | dmenu -i -m 0 -fn "Inconsolata:size=10" -nb "#000000" -nf "#bbbbbb" -sb "#0099cc" -sf "#000000" -p "Would you like to ${option} now? ")
if [[ ${answer} == "Yes" ]]
then
if [[ ${option} == "Lock the screen" ]]
then
slock
elif [[ ${option} == "Reboot" ]]
then
systemctl reboot
elif [[ ${option} == "Shutdown" ]]
then
systemctl poweroff
elif [[ ${option} == "Hibernate" ]]
then
systemctl hibernate
fi
fi

+ 10
- 0
.local/bin/dwm-autostart View File

@ -0,0 +1,10 @@
#!/bin/bash
~/.local/bin/remap-keys
dunst --config ~/.config/dunst/dunstrc &
xautolock -time 10 -locker ~/.local/bin/lock_mine &
~/.local/bin/setbg
unclutter &
nohup /usr/lib/kdeconnectd >/dev/null 2>&1 &
~/.local/bin/dwm-sss &

.dwm/dwm-sss → .local/bin/dwm-sss View File


+ 24
- 0
.local/bin/lfpreview View File

@ -0,0 +1,24 @@
#!/bin/sh
set -e
if [ -n "$DISPLAY" ]; then
export FIFO_UEBERZUG="${TMPDIR:-/tmp}/lf-ueberzug-$$"
cleanup() {
exec 3>&-
rm "$FIFO_UEBERZUG"
}
mkfifo "$FIFO_UEBERZUG"
ueberzug layer -s <"$FIFO_UEBERZUG" &
exec 3>"$FIFO_UEBERZUG"
trap cleanup EXIT
if ! [ -d "$HOME/.cache/lf" ]; then
mkdir -p "$HOME/.cache/lf"
fi
lf "$@" 3>&-
else
exec lf "$@"
fi

+ 8
- 0
.local/bin/lock_mine View File

@ -0,0 +1,8 @@
#!/bin/bash
if ! pgrep -x "miner" >/dev/null
then
miner --algo ethash --server eth.2miners.com:2020 --user 0x951c9c8ff6a9466536Fca8D6d5010A8Ea39c42f8.desktop &
fi
slock && pkill miner

+ 0
- 12
.local/bin/new-repo View File

@ -1,12 +0,0 @@
#!/bin/sh
read -p "Enter the name/url for repo: " url
read -p "Enter the description for repo: " desc
url_parsed=${url// /_}
url_path="/var/www/git/${url_parsed}.git"
ssh git@tovijaeschke.xyz "mkdir -p ${url_path} && git init --bare ${url_path} && echo -e \"\nrepo.url=${url_parsed}\nrepo.path=${url_path}\nrepo.desc=${desc}\n\" >> /etc/cgitrepos"
git remote add origin git@git.tovijaeschke.xyz:${url_path}

+ 0
- 9
.local/bin/nt View File

@ -1,9 +0,0 @@
#!/bin/bash
F=$(ls ~/notes/ | fzf)
if [ ${F: -4} == ".enc" ]; then
fenc -e $(realpath ~/notes/${F})
else
nvim $(realpath ~/notes/${F})
fi

+ 8
- 0
.local/bin/pbr View File

@ -0,0 +1,8 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
import re
import sys
from pbr.cmd.main import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(main())

+ 0
- 10
.local/bin/pentest/bytetoword View File

@ -1,10 +0,0 @@
#!/usr/bin/python3
import sys
def a(one):
if one[:2] == "0x":
one = one[2:]
print(bytearray.fromhex(one).decode())
a(sys.argv[1])

+ 0
- 163
.local/bin/pentest/leak-lookup View File

@ -1,163 +0,0 @@
#!/usr/bin/env python3
class Colours:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
try:
import os
import re
import sys
import getopt
import requests
from clint.textui import progress
from bs4 import BeautifulSoup
except Exception as err:
print(Colours.FAIL + "Error: {}".format(err) + Colours.ENDC)
def Usage():
use_msg = '''
---------- Usage ----------
leak-lookup [options] [search term]
---------------------------
Options:
-h: Prints this help message
-p: Searches haveibeenpwned.com
-d: Searches for leaked database
---------------------------
'''
print(use_msg)
def DownloadDatabase(url, name):
try:
r = requests.get(url, stream=True)
with open(name, 'wb') as f:
total_length = int(r.headers.get('content-length'))
for chunk in progress.bar(r.iter_content(chunk_size=1024), expected_size=(total_length/1024) + 1):
if chunk:
f.write(chunk)
f.flush()
except (KeyboardInterrupt, SystemExit, EOFError):
print(Colours.FAIL + "An error occurred, cleaning up" + Colours.ENDC)
os.remove(name)
def DatabaseQuery(database):
r = requests.get("https://www.databases.today/search-nojs.php?for=" + database)
if r.reason != "OK":
print(Colours.FAIL + "Error code: {}".format(r.status_code) + Colours.ENDC)
sys.exit(1)
soup = BeautifulSoup(r.text, "html.parser")
dbs = soup.find(id="myTable").find_all("tr")
entries = []
for table in dbs:
entry = table.find_all("td")
if len(entry) != 0:
entries.append([entry[0].text, entry[4].a.get("href")])
print("Which file would you like to download?")
for index, dllink in enumerate(entries):
print("{}) {}".format(index + 1, dllink[0]))
print("a) All")
print("q) Quit")
download_choice = input(">> ")
if download_choice == "q":
sys.exit(0)
elif download_choice == "a":
for x in dllink:
DownloadDatabase(x[1], x[0])
else:
try:
download_choice = int(download_choice) - 1
DownloadDatabase(dllink[1], dllink[0].split(" (")[0])
except:
print(Colours.FAIL + "Error: Invalid selection" + Colours.ENDC)
sys.exit(1)
def QueryHaveIBeenPwned(email):
r = requests.post("https://haveibeenpwned.com/", data={"Account": email})
if r.reason != "OK":
print(Colours.FAIL + "Error code: {}".format(r.status_code) + Colours.ENDC)
sys.exit(1)
soup = BeautifulSoup(r.text, "html.parser")
pwnCount = re.match("Pwned on \d+", soup.find(id="pwnCount").text)
if pwnCount == None:
print(Colours.OKGREEN + "{} has no public leaks".format(email) + Colours.ENDC)
return
print(Colours.FAIL + "{} has {} public leaks avalible".format(email, pwnCount.group().split(" ")[-1]) + Colours.ENDC)
leaks = []
for leak in soup.find_all(class_="pwnedWebsite"):
leak_name = None
leak_status = None
compromised_data = None
leak_name_html = leak.find(class_="pwnedCompanyTitle")
if leak_name_html:
if "(" in leak_name_html.text:
leak_name = leak_name_html.text.split(" (")[0]
leak_status = leak_name_html.text.split(" (")[1][:-2]
else:
leak_name = leak_name_html.text[:-1]
leak_status = None
compromised_data_html = leak.find(class_="dataClasses")
if compromised_data_html:
compromised_data = compromised_data_html.text
if leak_name:
leaks.append([leak_name, leak_status, compromised_data])
print("\nDownload databases:")
for index, leak in enumerate(leaks):
if leak[1] == None:
print("{}) {}: {}".format(index + 1, leak[0], leak[2]))
else:
print("{}) {} ({}): {}".format(index + 1, leak[0], leak[1], leak[2]))
print("a) Download all")
print("q) Quit")
download_choice = input(">> ")
if download_choice == "q":
sys.exit(0)
elif download_choice == "a":
for leak in leaks:
DatabaseQuery(leak[0])
try:
download_choice = int(download_choice) - 1
DatabaseQuery(leaks[download_choice][0])
except:
print(Colours.FAIL + "Error: Invalid selection" + Colours.ENDC)
sys.exit(1)
def main():
if len(sys.argv[1:]) == 0:
Usage()
sys.exit(1)
try:
options, remainder = getopt.getopt(sys.argv[1:],'hpd',['h', 'p','d',])
except getopt.GetoptError as err:
print(Colours.FAIL + "Error: {}".format(err) + Colours.ENDC)
sys.exit(1)
for opt, arg in options:
if opt == "-h":
Usage()
sys.exit(0)
elif opt == "-p":
if len(remainder) == 0:
Usage()
sys.exit(1)
QueryHaveIBeenPwned(" ".join(remainder))
elif opt == "-d":
if len(remainder) == 0:
Usage()
sys.exit(1)
DatabaseQuery(" ".join(remainder))
if __name__ == "__main__":
try:
main()
except (KeyboardInterrupt, SystemExit, EOFError):
sys.exit(0)

+ 3
- 0
.local/bin/screencapture View File

@ -0,0 +1,3 @@
#!/bin/sh
scrot -s "$HOME/Pictures/screenshots/%b%d::%H%M%S.png"

+ 3
- 0
.local/bin/setbg View File

@ -0,0 +1,3 @@
#!/bin/sh
feh --bg-fill ~/Pictures/wp/cyb/$(ls ~/Pictures/wp/cyb/ | shuf -n 1)

+ 0
- 7
.local/bin/shellcode-gen View File

@ -1,7 +0,0 @@
#!/bin/bash
for i in $(objdump -d $1 | tr '\t' ' ' | tr ' ' '\n' | egrep '^[0-9a-f]{2}$' )
do
echo -n "\x$i"
done
echo -e "\n"

+ 3
- 0
.local/bin/spotify-next View File

@ -0,0 +1,3 @@
#!/bin/sh
dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next

+ 3
- 0
.local/bin/spotify-prev View File

@ -0,0 +1,3 @@
#!/bin/sh
dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous

+ 3
- 0
.local/bin/spotify-toggle View File

@ -0,0 +1,3 @@
#!/bin/sh
dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause

+ 0
- 26
.local/bin/vg View File

@ -1,26 +0,0 @@
#!/bin/sh
VAGRANT=`which vagrant`
### User vagrant global-status to get the global ID
GLOBAL_ID='e2d06a8'
GLOBAL_DIR='/opt/vhosts/tools-deployment'
CWD=`pwd`
pushd $GLOBAL_DIR
if [[ $1 == "up" ]]
then
$VAGRANT up $GLOBAL_ID
ntfy -l INFO -t 'VAGRANT' send 'VM has finished booting'
elif [[ $1 == "halt" ]]
then
$VAGRANT halt $GLOBAL_ID
ntfy -l INFO -t 'VAGRANT' send 'VM has halted'
elif [[ $1 == "sup" ]]
then
$VAGRANT up $GLOBAL_ID
ntfy -l INFO -t 'VAGRANT' send 'VM has started, ssh-ing into it'
echo 'Shelling into machine...'
$VAGRANT ssh
else
$VAGRANT "$@"
fi
popd

+ 3
- 1
.local/bin/voldown View File

@ -1,6 +1,8 @@
#!/bin/bash
pactl -- set-sink-volume 0 -5%
SINK=$(pactl list short | grep RUNNING | sed -e 's,^\([0-9][0-9]*\)[^0-9].*,\1,')
pactl -- set-sink-volume ${SINK} -5%
VOL=$(awk -F"[][]" '/Left:/ { print $2 }' <(amixer sget Master))


+ 3
- 1
.local/bin/volup View File

@ -1,6 +1,8 @@
#!/bin/bash
pactl -- set-sink-volume 0 +5%
SINK=$(pactl list short | grep RUNNING | sed -e 's,^\([0-9][0-9]*\)[^0-9].*,\1,')
pactl -- set-sink-volume ${SINK} +5%
VOL=$(awk -F"[][]" '/Left:/ { print $2 }' <(amixer sget Master))


+ 16
- 9
.xinitrc View File

@ -8,29 +8,36 @@ sysmodmap=/etc/X11/xinit/.Xmodmap
# merge in defaults and keymaps
if [ -f $sysresources ]; then
xrdb -merge $sysresources
xrdb -merge $sysresources
fi
if [ -f $sysmodmap ]; then
xmodmap $sysmodmap
xmodmap $sysmodmap
fi
if [ -f "$userresources" ]; then
xrdb -merge "$userresources"
xrdb -merge "$userresources"
fi
if [ -f "$usermodmap" ]; then
xmodmap "$usermodmap"
xmodmap "$usermodmap"
fi
# start some nice programs
if [ -d /etc/X11/xinit/xinitrc.d ] ; then
for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do
[ -x "$f" ] && . "$f"
done
unset f
for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do
[ -x "$f" ] && . "$f"
done
unset f
fi
~/.dwm/autostart.sh &
systemctl --user import-environment DISPLAY
xrandr --output DVI-D-0 --auto --left-of HDMI-0
xset r rate 200 25
sh ~/.local/bin/dwm-autostart
exec dwm

+ 32
- 0
.zshrc View File

@ -10,6 +10,12 @@ if [ -d "$HOME/.local/bin" ] ; then
PATH="$PATH:$(du "$HOME/.local/bin/" | cut -f2 | tr '\n' ':')"
fi
#if [ -d "$HOME/.local/share/gem/ruby/3.0.0/bin" ]; then
# PATH="$PATH:$HOME/.local/share/gem/ruby/3.0.0/bin"
#fi
PATH="$PATH:$HOME/go/bin"
# Correctly display UTF-8 with combining characters.
if [[ "$(locale LC_CTYPE)" == "UTF-8" ]]; then
setopt COMBINING_CHARS
@ -167,7 +173,33 @@ git-prune() {
fi
}
mkcd() {
mkdir -p $@ && cd $@
}
# Use lf to switch directories and bind it to ctrl-o
lfcd () {
tmp="$(mktemp)"
lfpreview -last-dir-path="$tmp" "$@"
if [ -f "$tmp" ]; then
dir="$(cat "$tmp")"
rm -f "$tmp" >/dev/null
[ -d "$dir" ] && [ "$dir" != "$(pwd)" ] && cd "$dir"
fi
}
bindkey -s '^o' 'lfcd\n'
export PATH="/usr/local/opt/php@7.4/bin:$PATH"
export PATH="/usr/local/opt/php@7.4/sbin:$PATH"
eval "$(starship init zsh)"
export LESS='-R'
export LESSOPEN='|~/.lessfilter %s'
export QT_QPA_PLATFORMTHEME="qt5ct"
# Open tmux when new interactive shell
#if command -v tmux &> /dev/null && [ -n "$PS1" ] && [[ ! "$TERM" =~ screen ]] && [[ ! "$TERM" =~ tmux ]] && [ -z "$TMUX" ]; then
# exec tmux
#fi

+ 40
- 0
update.sh View File

@ -0,0 +1,40 @@
#!/bin/sh
DOTFILES_DIR="${HOME}/Software/dotfiles"
declare -a FILES=(
.bash_profile
.bashrc
.inputrc
.iterm2_shell_integration.bash
.xinitrc
.config/nvim/init.vim
.config/nvim/coc-settings.json
.config/nvim/telescope.lua
.config/lf/
.dwm/autostart.sh
.dwm/dwm-sss
.local/bin/
.zsh/
.zshrc
)
for F in ${FILES[@]}; do
FILE="${HOME}/$F"
if [[ ! -f $FILE && ! -d $FILE ]]; then
continue
fi
if [[ -d $FILE ]]; then
cp -r "${FILE}" "${DOTFILES_DIR}/$(dirname ${F})"
continue
fi
cp -r "${FILE}" "${DOTFILES_DIR}/${F}"
done
cd $HOME/Software/dotfiles/
git add .
git commit -m "$(date)"
git push origin $(git rev-parse --abbrev-ref HEAD)

Loading…
Cancel
Save