├── .editorconfig ├── .gitattributes ├── .gitignore ├── .gitmodules ├── assets ├── bash_logo_transparent.svg ├── compiz.png ├── e16.png ├── exwm.png ├── i3wm.png ├── tbcv1.0.png ├── tbcv2.0.png └── wpr.png ├── bootstrap.bash ├── card.txt ├── dot.files ├── .Xdefaults ├── .Xresources ├── .Xresources.d │ ├── .gitignore │ ├── mwm.Xresources │ ├── rofi.Xresources │ ├── urxvt.Xresources │ ├── xcal.Xresources │ └── xterm.Xresources ├── .bash_logout ├── .bash_profile ├── .bashrc ├── .bashrc.d │ ├── aa_variables.bash │ ├── aliases.bash │ ├── ascii.bash │ ├── colors.bash │ ├── functions.bash │ ├── stdlib │ │ ├── crypto.bash │ │ ├── distance.bash │ │ ├── mass.bash │ │ ├── math.bash │ │ ├── readme.org │ │ ├── string.bash │ │ ├── temp.bash │ │ └── time.bash │ └── xx_misc.bash ├── .config │ ├── compiz │ │ ├── compiz.sh │ │ └── compizconfig │ │ │ ├── Default.ini │ │ │ └── config │ ├── compton.conf │ ├── i3 │ │ └── config │ ├── i3status │ │ └── config │ ├── mpd │ │ └── mpd.conf │ ├── ncmpcpp │ │ └── config │ ├── openbox │ │ ├── autostart │ │ ├── environment │ │ ├── menu.xml │ │ ├── rc.xml │ │ └── scripts │ │ │ ├── date_menu.sh │ │ │ └── obam.pl │ └── tint2 │ │ ├── panel │ │ └── taskbar ├── .e16 │ ├── Init │ │ └── e16.sh │ ├── bindings.cfg │ └── menus │ │ └── user_apps.menu ├── .gitignore ├── .gvimrc ├── .local │ ├── bin │ │ ├── michaeltd │ │ ├── notes.bash │ │ ├── pimp_my_gui.bash │ │ ├── showkb.sh │ │ ├── sndvol │ │ ├── template.bash │ │ ├── template.sh │ │ ├── term_music.bash │ │ ├── wallpaper_rotate.bash │ │ └── xlock.sh │ └── sbin │ │ ├── .gitignore │ │ ├── .old │ │ ├── old.cleanup-bkps.sh │ │ ├── update-enc-bkp.sh │ │ ├── update-sys-bkp.sh │ │ ├── update-usr-bkp.sh │ │ └── update_bkps.bash.old │ │ ├── add_user.bash │ │ ├── cronjobs │ │ ├── daily │ │ │ ├── .keep │ │ │ ├── 00-update_backups.bash │ │ │ └── 10-update_cleanup.bash │ │ ├── daily_maint │ │ ├── monthly │ │ │ ├── .keep │ │ │ ├── 00-dist_upgrade.bash │ │ │ ├── 10-check_integrity.bash │ │ │ ├── 20-dist_cleanup.bash │ │ │ └── 30-dist_wrldchck.bash │ │ ├── monthly_maint │ │ ├── weekly │ │ │ ├── .keep │ │ │ ├── 00-dist_hosts.bash │ │ │ └── 10-dist_upgrade.bash │ │ └── weekly_maint │ │ ├── dist_check.bash │ │ ├── dist_cleanup.bash │ │ ├── dist_hosts.bash │ │ ├── dist_upgrade.bash │ │ ├── dist_wrldchck.bash │ │ ├── fbgrab │ │ ├── kernel_upgrade.bash │ │ ├── update_backups.bash │ │ ├── update_cleanup.bash │ │ └── update_mirror.bash ├── .muttrc ├── .profile ├── .tmux.conf ├── .toprc ├── .vimrc ├── .xinitrc └── .xsession ├── license ├── readme.org ├── setup_termux_on_android.bash └── tests.bats /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig is awesome: https://EditorConfig.org 2 | 3 | # top-most EditorConfig file 4 | root = true 5 | 6 | # Unix-style newlines with a newline ending every file 7 | [*] 8 | end_of_line = lf 9 | insert_final_newline = true 10 | 11 | # Matches multiple files with brace expansion notation 12 | # Set default charset 13 | [*.{js,py}] 14 | charset = utf-8 15 | 16 | [*.{sh, vim}] 17 | indent_style = space 18 | indent_size = 2 19 | end_of_line = 1f 20 | insert_final_newline = true 21 | charset = utf_8 22 | 23 | # 4 space indentation 24 | [*.py] 25 | indent_style = space 26 | indent_size = 2 27 | 28 | # Tab indentation (no size specified) 29 | [Makefile] 30 | indent_style = tab 31 | 32 | # Indentation override for all JS under lib directory 33 | [lib/**.js] 34 | indent_style = space 35 | indent_size = 2 36 | 37 | # Matches the exact files either package.json or .travis.yml 38 | [{package.json,.travis.yml}] 39 | indent_style = space 40 | indent_size = 2 41 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # * linguist-vendored 2 | # *.js linguist-vendored=false 3 | # *.rb linguist-language=Java 4 | # And whether to exclude files that should be considered documentation: 5 | # documented_code.rb linguist-documentation=true 6 | # special-vendored-path/* linguist-vendored 7 | # jquery.js linguist-vendored=false 8 | 9 | # special-vendored-path/* linguist-vendored 10 | # */rc.lua linguist-vendored=false 11 | # *.lua linguist-language=Shell 12 | 13 | # Sun 23 Feb 2020 04:01:42 PM EET 14 | # *.lua linguist-documentation=true 15 | # wallpaper-rotate linguist-language=Shell 16 | # .xinitrc linguist-language=Shell 17 | # dot.files/.bashrc.d/* linguist-language=Shell 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !assets/* 3 | !bootstrap.bash 4 | !card.txt 5 | !dot.files/* 6 | !license 7 | !readme.org 8 | !tests.bats 9 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | # [submodule "dot.files/.emacs.d"] 2 | # path = dot.files/.emacs.d 3 | # active = true 4 | # branch = master 5 | # url = https://github.com/michaeltd/.emacs.d.git 6 | -------------------------------------------------------------------------------- /assets/bash_logo_transparent.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | Asset 1 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /assets/compiz.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michaeltd/dots/502ddc087b7201bcd61602db2ad393884fa52f19/assets/compiz.png -------------------------------------------------------------------------------- /assets/e16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michaeltd/dots/502ddc087b7201bcd61602db2ad393884fa52f19/assets/e16.png -------------------------------------------------------------------------------- /assets/exwm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michaeltd/dots/502ddc087b7201bcd61602db2ad393884fa52f19/assets/exwm.png -------------------------------------------------------------------------------- /assets/i3wm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michaeltd/dots/502ddc087b7201bcd61602db2ad393884fa52f19/assets/i3wm.png -------------------------------------------------------------------------------- /assets/tbcv1.0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michaeltd/dots/502ddc087b7201bcd61602db2ad393884fa52f19/assets/tbcv1.0.png -------------------------------------------------------------------------------- /assets/tbcv2.0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michaeltd/dots/502ddc087b7201bcd61602db2ad393884fa52f19/assets/tbcv2.0.png -------------------------------------------------------------------------------- /assets/wpr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michaeltd/dots/502ddc087b7201bcd61602db2ad393884fa52f19/assets/wpr.png -------------------------------------------------------------------------------- /bootstrap.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env -S bash --norc --noprofile 2 | #shellcheck shell=bash disable=SC1008,SC2096 3 | # 4 | # dots/bootstrap.bash 5 | # Migrates my .dots in new systems. 6 | 7 | # Unofficial Bash Strict Mode 8 | # set -euo pipefail 9 | # IFS=$'\t\n' 10 | 11 | #shellcheck disable=SC2155 12 | declare -r sdn="$(dirname "$(realpath "${BASH_SOURCE[0]}")")" \ 13 | sbn="$(basename "$(realpath "${BASH_SOURCE[0]}")")" 14 | 15 | cd "${sdn}" || exit 1 16 | 17 | # Backup File Extension 18 | #shellcheck disable=SC2155 19 | declare -r bfe=".${sbn%%.*}.$(date -u +%s).bkp" 20 | 21 | #shellcheck disable=SC2034 22 | declare -ra compton=( 'dot.files/.config/compton.conf' ) \ 23 | tint2=( 'dot.files/.config/tint2/panel' 24 | 'dot.files/.config/tint2/taskbar' ) \ 25 | e16=( 'dot.files/.e16/Init/e16.sh' 26 | 'dot.files/.e16/bindings.cfg' 27 | 'dot.files/.e16/menus/user_apps.menu' ) \ 28 | compiz=( 'dot.files/.config/compiz/compiz.sh' 29 | 'dot.files/.config/compiz/compizconfig/Default.ini' 30 | 'dot.files/.config/compiz/compizconfig/config' ) \ 31 | i3wm=( 'dot.files/.config/i3/config' 32 | 'dot.files/.config/i3status/config' ) \ 33 | openbox=( 'dot.files/.config/openbox/autostart' 34 | 'dot.files/.config/openbox/environment' 35 | 'dot.files/.config/openbox/menu.xml' 36 | 'dot.files/.config/openbox/rc.xml' 37 | 'dot.files/.config/openbox/scripts/date_menu.sh' 38 | 'dot.files/.config/openbox/scripts/obam.pl' ) \ 39 | x11=( 'dot.files/.Xdefaults' 40 | 'dot.files/.Xresources' 41 | 'dot.files/.Xresources.d' 42 | 'dot.files/.xinitrc' 43 | 'dot.files/.xsession' ) 44 | 45 | #shellcheck disable=SC2034 46 | declare -ra xorg=( compton[@] tint2[@] e16[@] compiz[@] i3wm[@] openbox[@] x11[@] ) 47 | 48 | #shellcheck disable=SC2034 49 | declare -ra music=( 'dot.files/.config/mpd/mpd.conf' 50 | 'dot.files/.config/ncmpcpp/config' ) \ 51 | tmux=( 'dot.files/.tmux.conf' ) \ 52 | top=( 'dot.files/.toprc' ) \ 53 | mutt=( 'dot.files/.muttrc' ) \ 54 | vim=( 'dot.files/.vimrc' 'dot.files/.gvimrc' ) \ 55 | bash=( 'dot.files/.bash_logout' 56 | 'dot.files/.bash_profile' 57 | 'dot.files/.bashrc' 58 | 'dot.files/.profile' 59 | 'dot.files/.local/bin/michaeltd' 60 | 'dot.files/.local/bin/pimp_my_gui.bash' 61 | 'dot.files/.local/bin/showkb.sh' 62 | 'dot.files/.local/bin/sndvol' 63 | 'dot.files/.local/bin/term_music.bash' 64 | 'dot.files/.local/bin/notes.bash' 65 | 'dot.files/.local/bin/wallpaper_rotate.bash' 66 | 'dot.files/.local/bin/xlock.sh' 67 | 'dot.files/.local/sbin' ) 68 | 69 | #shellcheck disable=SC2034 70 | declare -ra console=( music[@] tmux[@] top[@] mutt[@] vim[@] bash[@] ) 71 | # Build menus and help messages. 72 | declare -ra TUI_OPS=( "quit" "help" "everything" "xorg" "console" 73 | "compton" "tint2" "e16" "compiz" "i3wm" "openbox" "x11" 74 | "music" "tmux" "top" "mutt" "vim" "bash" ) 75 | 76 | declare -ra DESC=( "Exit this script" 77 | "show this Help screen" 78 | "link Everything available" 79 | "link all Xorg related configs" 80 | "link all Console related configs" 81 | "link Compton config" 82 | "link Tint2 configs" 83 | "link E16 configs" 84 | "link Compiz configs" 85 | "link i3wm and i3status configs" 86 | "link openbox config files" 87 | "link X11 rc files" 88 | "link Music mpc, mpd, npmpcpp config files" 89 | "link Tmux's tmux.conf" 90 | "link Top's toprc" 91 | "link Mutt rc" 92 | "link Gvim/Vim rc files" 93 | "link Bash related files" 94 | ) 95 | 96 | declare -r myusage=" 97 | 98 | Usage: ${BASH_SOURCE[0]##*/} -(-a)ll|-(-c)onsole|-(-x)org|-(-m)enu|-(-h)elp 99 | 100 | -(-a)ll to link everything 101 | -(-c)onsole to link console related configs 102 | -(-x)org to link Xorg related configs 103 | -(-m)enu to show a menu with all available options 104 | -(-h)elp for this help message 105 | 106 | " 107 | 108 | is_link_set() { 109 | [[ -L "${HOME}${1:9}" ]] && [[ "$(realpath "${HOME}${1:9}")" == "$(realpath "${1}")" ]] 110 | } 111 | 112 | all_links_set() { 113 | eval "arr=(\"\${$1[@]}\")" 114 | #shellcheck disable=SC2154 115 | for i in "${arr[@]}"; do 116 | if ! is_link_set "${i}"; then 117 | return 1 118 | fi 119 | done 120 | } 121 | 122 | no_links_set() { 123 | eval "arr=(\"\${$1[@]}\")" 124 | for i in "${arr[@]}"; do 125 | if is_link_set "${i}"; then 126 | return 1 127 | fi 128 | done 129 | } 130 | 131 | check_arr() { 132 | eval "arr=(\"\${$1[@]}\")" 133 | for i in "${arr[@]}"; do 134 | if [[ ! -e "${i}" ]]; then 135 | echo "fatal: ${i} not found" 136 | return 1 137 | fi 138 | done 139 | } 140 | 141 | link_arr() { 142 | eval "arr=(\"\${$1[@]}\")" 143 | for i in "${arr[@]}"; do 144 | do_link "$(realpath "${i}")" "${HOME}${i:9}" 145 | done 146 | } 147 | 148 | check_assoc() { 149 | eval "assoc=(\"\${$1[@]}\")" 150 | for x in "${!assoc[@]}"; do 151 | local i=0 152 | while [[ -n "${!assoc[x]:i:1}" ]]; do 153 | if [[ ! -e "${!assoc[x]:i:1}" ]]; then 154 | echo "fatal: ${!assoc[x]:i:1} not found" 155 | return 1 156 | fi 157 | (( ++i )) 158 | done 159 | done 160 | } 161 | 162 | link_assoc() { 163 | eval "assoc=(\"\${$1[@]}\")" 164 | for x in "${!assoc[@]}"; do 165 | local i=0 166 | while [[ -n "${!assoc[x]:i:1}" ]]; do 167 | local repofile="${!assoc[x]:i:1}" 168 | local realfile="$(realpath "${repofile}")" 169 | local homefile="${HOME}${repofile:9}" 170 | do_link "${realfile}" "${homefile}" 171 | (( ++i )) 172 | done 173 | done 174 | } 175 | 176 | do_link() { 177 | # ln force switch for directory links appears broken, so there ... 178 | if [[ -e "${2}" ]]; then 179 | mv -v "${2}" "${2}.${bfe}" 180 | fi 181 | #ln --verbose --symbolic --force --backup --suffix=".${BFE}" "${1}" "${2}" 182 | mkdir -vp "$(dirname "${2}")" 183 | ln -vs "${1}" "${2}" 184 | } 185 | 186 | do_arr() { 187 | check_arr "${1}" || exit $? 188 | link_arr "${1}" 189 | } 190 | 191 | do_assoc() { 192 | check_assoc "${1}" || exit $? 193 | link_assoc "${1}" 194 | } 195 | 196 | do_everything() { 197 | for assoc in "console" "xorg"; do 198 | check_assoc "${assoc}" || exit $? 199 | link_assoc "${assoc}" 200 | done 201 | } 202 | 203 | menu() { 204 | local -a TUI_MENU=() TUI_HMSG=("${myusage}") 205 | for ((x = 0; x < ${#TUI_OPS[*]}; x++)); do 206 | TUI_MENU+=("${x}:${TUI_OPS[x]}") 207 | (((x + 1) % 4 == 0)) && TUI_MENU+=("\n") || TUI_MENU+=("\t") 208 | TUI_HMSG+=("Use ${x}, which will ${DESC[x]}\n") 209 | done 210 | 211 | while :; do 212 | # echo -ne " ${TUI_MENU[*]}"|column -t -s $'\t' # column not playing nice on *BSD 213 | echo -ne " ${TUI_MENU[*]}\n" 214 | read -rp "Choose[0-$((${#TUI_OPS[*]}-1))]: " USRINPT 215 | case "${USRINPT}" in 216 | 0) return $?;; 217 | 1) echo -ne "${TUI_HMSG[*]}";; 218 | 2) do_"${TUI_OPS[$USRINPT]}";; 219 | [3-4]) do_assoc "${TUI_OPS[$USRINPT]}";; 220 | [5-9]|1[0-7]) do_arr "${TUI_OPS[$USRINPT]}";; 221 | *) echo -ne "Invalid selection: ${USRINPT}. Choose from 0 to $((${#TUI_OPS[*]}-1))\n" >&2;; 222 | esac 223 | done 224 | } 225 | 226 | main() { 227 | case "${1}" in 228 | -a|--all) do_everything ;; 229 | -c|--console) do_assoc "console" ;; 230 | -x|--xorg) do_assoc "xorg" ;; 231 | -m|--menu) menu ;; 232 | *) echo -ne "${myusage}"; return 1 ;; 233 | esac 234 | } 235 | 236 | [[ "${BASH_SOURCE[0]}" == "${0}" ]] && main "${@}" 237 | -------------------------------------------------------------------------------- /card.txt: -------------------------------------------------------------------------------- 1 |  2 |  ╭───────────────────────────────────────────────────╮ 3 |  │ │ 4 |  │ Michael Tsouchlarakis / michaeltd │ 5 |  │ │ 6 |  │ Work: tsouchlarakis@gmail.com │ 7 |  │ FOSS: Gentoo Linux avocado. │ 8 |  │ │ 9 |  │ Web: https://michaeltd.netlify.com/ │ 10 |  │ GitLab: https://gitlab.com/michaeltd │ 11 |  │ npm: https://npmjs.com/~michaeltd │ 12 |  │ Toots: https://mastodon.technology/@michaeltd │ 13 |  │ │ 14 |  │ Card: curl -sL tinyurl.com/mick-card │ 15 |  │ │ 16 |  ╰───────────────────────────────────────────────────╯ 17 |  18 | -------------------------------------------------------------------------------- /dot.files/.Xdefaults: -------------------------------------------------------------------------------- 1 | #include ".Xresources" 2 | -------------------------------------------------------------------------------- /dot.files/.Xresources: -------------------------------------------------------------------------------- 1 | Xft.dpi: 96 2 | ! Put this file as ~/.Xresources in your home directory 3 | 4 | #include ".Xresources.d/xterm.Xresources" 5 | #include ".Xresources.d/urxvt.Xresources" 6 | #include ".Xresources.d/mwm.Xresources" 7 | #include ".Xresources.d/rofi.Xresources" 8 | #include ".Xresources.d/xcal.Xresources" 9 | 10 | *.faceName: SourceCodePro 11 | !*.font: SourceCodePro 12 | 13 | ! https://draculatheme.com/xresources/ 14 | ! Dracula Xresources palette 15 | ! *.foreground: #F8F8F2 16 | ! *.background: #282A36 17 | ! *.color0: #000000 18 | ! *.color8: #4D4D4D 19 | ! *.color1: #FF5555 20 | ! *.color9: #FF6E67 21 | ! *.color2: #50FA7B 22 | ! *.color10: #5AF78E 23 | ! *.color3: #F1FA8C 24 | ! *.color11: #F4F99D 25 | ! *.color4: #BD93F9 26 | ! *.color12: #CAA9FA 27 | ! *.color5: #FF79C6 28 | ! *.color13: #FF92D0 29 | ! *.color6: #8BE9FD 30 | ! *.color14: #9AEDFE 31 | ! *.color7: #BFBFBF 32 | ! *.color15: #E6E6E6 33 | 34 | !Theme One 35 | *background: rgb:00/00/00 36 | *foreground: rgb:a8/a8/a8 37 | *color0: rgb:00/00/00 38 | *color1: rgb:a8/00/00 39 | *color2: rgb:00/a8/00 40 | *color3: rgb:a8/54/00 41 | *color4: rgb:00/00/a8 42 | *color5: rgb:a8/00/a8 43 | *color6: rgb:00/a8/a8 44 | *color7: rgb:a8/a8/a8 45 | *color8: rgb:54/50/54 46 | *color9: rgb:f8/54/50 47 | *color10: rgb:50/fc/50 48 | *color11: rgb:f8/fc/50 49 | *color12: rgb:50/54/f8 50 | *color13: rgb:f8/54/f8 51 | *color14: rgb:50/fc/f8 52 | *color15: rgb:f8/fc/f8 53 | !2007-02-26T22:18:49-08:00 54 | 55 | 56 | -------------------------------------------------------------------------------- /dot.files/.Xresources.d/.gitignore: -------------------------------------------------------------------------------- 1 | .bkp/* -------------------------------------------------------------------------------- /dot.files/.Xresources.d/mwm.Xresources: -------------------------------------------------------------------------------- 1 | ! MWM Resources -- These are only run if you are using the mwm window 2 | ! manager. Run "man mwm" for details. 3 | 4 | ! Causes icon box to scroll horizontally only 5 | !Mwm*iconBoxSBDisplayPolicy: vertical 6 | ! Creates a box to place your icons 7 | !Mwm*useIconBox: False 8 | ! Sets the icon boxs size and location 9 | !Mwm*iconBoxGeometry: 10x1+160-0 10 | ! Sets the icon boxs title 11 | !Mwm*iconBoxTitle: MWM Icon Manager 12 | ! Sets where the icons will appear (on the screen, or in an icon box if it 13 | ! exists) 14 | !Mwm*iconPlacement: left top 15 | ! "fades" icon of applications that are active 16 | !Mwm*fadeNormalIcon: True 17 | ! Causes whatever your pointer is over to become the active application 18 | !Mwm*keyboardFocusPolicy: click 19 | ! Causes all border and title decoration to appear on xclock applications 20 | !Mwm*XClock.clientDecoration: +all 21 | ! Causes all border and title decoration to appear on xbiff applications 22 | !Mwm*xbiff.clientDecoration: +all 23 | ! Lets you select by hand the location of a new application (unless a specific 24 | ! location is indicated when you run it) 25 | !Mwm*interactivePlacement: False 26 | ! Sets a foreground color for every application 27 | Mwm*foreground: black 28 | ! Sets a background color for every application 29 | Mwm*background: DarkGrey 30 | ! Sets a foreground color for the active application 31 | Mwm*activeForeground: white 32 | ! Sets a background color for the active application 33 | Mwm*activeBackground: black 34 | ! Sets a foreground color for your menu 35 | Mwm*menu*foreground: white 36 | ! Sets a background color for your menu 37 | Mwm*menu*background: DarkGrey 38 | ! Default font for your application titles 39 | !Mwm*fontList: -adobe-helvetica-bold-r-normal--*-120-*-*-*-*-*-* 40 | ! Default font for your menus 41 | !Mwm*menu*fontList: -adobe-helvetica-bold-r-normal--*-120-*-*-*-*-*-* 42 | ! Cause the xclock icon not to show up in the icon box 43 | !Mwm*XClock*clientFunctions: -minimize 44 | ! Cause the xbiff icon not to show up in the icon box 45 | !Mwm*xbiff*clientFunctions: -minimize 46 | -------------------------------------------------------------------------------- /dot.files/.Xresources.d/rofi.Xresources: -------------------------------------------------------------------------------- 1 | ! https://gist.github.com/rawsh/9ae04a2bdbfce513ad0851d9277515d2 2 | ! === rofi === 3 | 4 | rofi.modi: ssh,window,drun,run,keys 5 | rofi.sidebar-mode: true 6 | rofi.terminal: st 7 | rofi.ssh-client: ssh 8 | rofi.ssh-command: {terminal} -e "{ssh-client} {host}" 9 | rofi.opacity: 75 10 | rofi.width: 25 11 | rofi.lines: 5 12 | rofi.columns: 1 13 | rofi.font: SourceCodePro 10 14 | rofi.fg: #5294E2 15 | rofi.bg: #5d729f 16 | rofi.fg-active: #34405a 17 | rofi.fg-urgent: #34405a 18 | rofi.hlfg-active: #5e73a0 19 | rofi.hlfg-urgent: #5e73a0 20 | rofi.bg-active: #34405a 21 | rofi.bg-urgent: #34405a 22 | rofi.hlbg-active: #5d729f 23 | rofi.hlbg-urgent: #5d729f 24 | rofi.bgalt: #5671a0 25 | rofi.hlfg: #34405a 26 | rofi.hlbg: #34405a 27 | rofi.bc: #789ee1 28 | !State: 'bg', 'fg', 'bgalt', 'hlbg', 'hlfg' 29 | rofi.color-normal: #353944, #FFFFFF, #353944, #5294E2, #FFFFFF 30 | ! 'background', 'border' 31 | rofi.color-window: #353944, #404552 32 | rofi.bw: 10 33 | ! https://blog.wizardsoftheweb.pro/rofi-change-window-location/ 34 | ! Theres a config option, location, that allows us to change that position. We can instead place the launcher on any of the cardinals, any of the ordinals, or dead center. The locations follow a pattern like this: 35 | ! 1 2 3 36 | ! 8 0 4 37 | ! 7 6 5 38 | rofi.location: 0 39 | rofi.padding: 20 40 | rofi.levenshtein-sort: true 41 | rofi.case-sensitive: false 42 | rofi.fuzzy: false 43 | rofi.line-margin: 2 44 | rofi.separator-style: solid 45 | rofi.hide-scrollbar: true 46 | rofi.markup-rows: false 47 | rofi.scrollbar-width: 8 48 | ! rofi.theme: android_notification.rasi 49 | ! rofi.theme: blue.rasi 50 | ! rofi.theme: gruve_box_dark.rasi 51 | ! rofi.theme: dmenu.rasi 52 | ! rofi.theme: arthur.rasi 53 | rofi.theme: sidebar.rasi 54 | ! rofi.theme: Arc-Dark.rasi 55 | ! rofi.theme: gruvbox-dark 56 | -------------------------------------------------------------------------------- /dot.files/.Xresources.d/xcal.Xresources: -------------------------------------------------------------------------------- 1 | *firstDay: 1 2 | *daynumbers*Foreground: Grey 3 | *daynumbers.1*Foreground: White 4 | *daynumbers.8*Foreground: White 5 | *daynumbers.15*Foreground: White 6 | *daynumbers.22*Foreground: White 7 | *daynumbers.29*Foreground: White 8 | *daynumbers.36*Foreground: White 9 | *daynumbers.7*Foreground: Red 10 | *daynumbers.14*Foreground: Red 11 | *daynumbers.21*Foreground: Red 12 | *daynumbers.28*Foreground: Red 13 | *daynumbers.35*Foreground: Red 14 | *daynumbers.42*Foreground: Red 15 | -------------------------------------------------------------------------------- /dot.files/.Xresources.d/xterm.Xresources: -------------------------------------------------------------------------------- 1 | ! =========================================================================== 2 | ! XTerm resources 3 | ! Look similar to the Linux Console 4 | ! --------------------------------------------------------------------------- 5 | 6 | ! https://unix4lyfe.org/xterm/ 7 | xterm*faceName: SourceCodePro 8 | xterm*faceSize: 10 9 | xterm*renderFont: true 10 | ! xterm*font: fixed 11 | ! xterm*boldFont: fixed 12 | xterm*cursorBlink: true 13 | xterm*loginShell: true 14 | xterm*vt100*geometry: 80x26 15 | xterm*saveLines: 999999 16 | xterm*charClass: 33:48,35:48,37:48,43:48,45-47:48,64:48,95:48,126:48 17 | xterm*termName: xterm-256color 18 | xterm*eightBitInput: false 19 | !--> On 20200304 20 | xterm*foreground: rgb:ff/ff/ff 21 | xterm*background: rgb:00/00/00 22 | !<-- 23 | xterm*boldMode: false 24 | xterm*colorBDMode: true 25 | !--> Off 20200304 26 | ! xterm*colorBD: rgb:fc/fc/fc 27 | !<-- 28 | -------------------------------------------------------------------------------- /dot.files/.bash_logout: -------------------------------------------------------------------------------- 1 | # ~/.bash_logout: executed by bash(1) when login shell exits. 2 | 3 | # when leaving the console clear the screen to increase privacy 4 | 5 | if [ "$SHLVL" = 1 ]; then 6 | [ -x /usr/bin/clear_console ] && /usr/bin/clear_console -q 7 | fi 8 | 9 | clear 10 | 11 | 12 | -------------------------------------------------------------------------------- /dot.files/.bash_profile: -------------------------------------------------------------------------------- 1 | # /etc/skel/.bash_profile 2 | 3 | # This file is sourced by bash for login shells. The following line 4 | # runs your .bashrc and is recommended by the bash info pages. 5 | if [[ -f ~/.bashrc ]] ; then 6 | source ~/.bashrc 7 | fi 8 | 9 | if [ -x /usr/bin/fortune ] ; then /usr/bin/fortune freebsd-tips ; fi 10 | -------------------------------------------------------------------------------- /dot.files/.bashrc: -------------------------------------------------------------------------------- 1 | # This file is sourced by all *interactive* bash shells on startup, 2 | # including some apparently interactive shells such as scp and rcp 3 | # that can't tolerate any output. So make sure this doesn't display 4 | # anything or bad things will happen ! 5 | 6 | # Test for an interactive shell. There is no need to set anything 7 | # past this point for scp and rcp, and it's important to refrain from 8 | # outputting anything in those cases. 9 | if [[ $- != *i* ]]; then 10 | # Shell is non-interactive. Be done now! 11 | return 12 | fi 13 | 14 | # Put your fun stuff here. 15 | 16 | brcd="$(dirname $(realpath ${BASH_SOURCE[0]}))/.bashrc.d" 17 | if [[ -d "${brcd}" ]]; then # Load files from ~/.bashrc.d 18 | for file in "${brcd}"/*.bash; do 19 | source "${file}" 20 | done 21 | fi 22 | unset brcd 23 | 24 | gps="/usr/share/git/git-prompt.sh" 25 | [[ -r "${gps}" ]] && source "${gps}" 26 | unset gps 27 | 28 | -------------------------------------------------------------------------------- /dot.files/.bashrc.d/aa_variables.bash: -------------------------------------------------------------------------------- 1 | # 2 | # environment variables 3 | #shellcheck shell=bash disable=SC2155 4 | 5 | appendpath() { 6 | 7 | local envar="${1}" 8 | 9 | if [[ -n "${envar}" ]]; then 10 | [[ "${!envar}" != *${2}* ]] && [[ -d "${2}" ]] && export "${envar}"+=":${2}" 11 | else 12 | [[ -d "${2}" ]] && export "${envar}"="${2}" 13 | fi 14 | } 15 | 16 | # OPT 17 | [[ -d "/opt" ]] && export OPT="/opt" 18 | # JAVA 19 | [[ -d "${HOME}/.jdk" ]] && export JAVA_HOME="${HOME}/.jdk" 20 | [[ -d "${HOME}/.ant" ]] && export ANT="${HOME}/.ant" 21 | [[ -d "${HOME}/.maven" ]] && export MAVEN="${HOME}/.maven" 22 | [[ -d "${HOME}/.gradle" ]] && export GRADLE="${HOME}/.gradle" 23 | # GO 24 | [[ -d "${HOME}/.go" ]] && export GOPATH="${HOME}/.go" 25 | # RUST 26 | [[ -d "${HOME}/.cargo" ]] && export RUST="${HOME}/.cargo" 27 | # ZIG 28 | [[ -d "${HOME}/.zig" ]] && export ZIGPATH="${HOME}/.zig" 29 | # NODE 30 | [[ -d "${HOME}/.node" ]] && export NODE="${HOME}/.node" 31 | # DENO 32 | [[ -d "${HOME}/.deno" ]] && export DENO="${HOME}/.deno" 33 | # MONGODB 34 | [[ -d "${HOME}/.mongodb" ]] && export MONGODB="${HOME}/.mongodb" 35 | 36 | appendpath "PATH" "${HOME}/.local/bin" 37 | # OPT 38 | [[ -n "${OPT}" ]] && appendpath "PATH" "${OPT}/bin" 39 | appendpath "PATH" "${HOME}/bin" 40 | # JAVA 41 | [[ -n "${JAVA_HOME}" ]] && appendpath "PATH" "${JAVA_HOME}/bin" 42 | [[ -n "${ANT}" ]] && appendpath "PATH" "${ANT}/bin" 43 | [[ -n "${MAVEN}" ]] && appendpath "PATH" "${MAVEN}/bin" 44 | [[ -n "${GRADLE}" ]] && appendpath "PATH" "${GRADLE}/bin" 45 | [[ -n "${GOPATH}" ]] && appendpath "PATH" "${GOPATH}/bin" 46 | # RUST 47 | [[ -n "${RUST}" ]] && appendpath "PATH" "${RUST}/bin" 48 | # ZIG 49 | [[ -n "${ZIGPATH}" ]] && appendpath "PATH" "${ZIGPATH}" 50 | # NODE 51 | [[ -n "${NODE}" ]] && appendpath "PATH" "${NODE}/bin" 52 | # DENO 53 | [[ -n "${DENO}" ]] && appendpath "PATH" "${DENO}/bin" 54 | # MONGODB 55 | [[ -n "${MONGODB}" ]] && appendpath "PATH" "${MONGODB}/bin" 56 | 57 | appendpath "MANPATH" "${HOME}/.local/share/man" 58 | appendpath "MANPATH" "${HOME}/opt/share/man" 59 | 60 | [[ -n "${JAVA_HOME}" ]] && appendpath "CLASSPATH" "${JAVA_HOME}/lib" 61 | [[ -n "${ANT}" ]] && appendpath "CLASSPATH" "${ANT}/lib" 62 | [[ -n "${MAVEN}" ]] && appendpath "CLASSPATH" "${MAVEN}/lib" 63 | 64 | # Clean up functions 65 | unset -f appendpath 66 | # Used by mc themes 67 | export COLORTERM="truecolor" 68 | 69 | # SUDO_ASKPASS 70 | export SUDO_ASKPASS="$(type -P x11-ssh-askpass||type -P ssh-askpass-fullscreen)" 71 | 72 | # Used by emacsclient in case of server not running. 73 | export ALTERNATE_EDITOR="$(type -P emacs||type -P gvim||type -P kate||type -P gedit||type -P mousepad)" \ 74 | TERMINAL_EDITOR="$(type -P emacs||type -P vim||type -P micro||type -P nano)" 75 | 76 | export EDITOR="${TERMINAL_EDITOR}" VISUAL="${ALTERNATE_EDITOR}" 77 | 78 | if [[ -n "${DISPLAY}" ]]; then 79 | export BROWSER="$(type -P firefox ||type -P seamonkey)" 80 | else 81 | export BROWSER="$(type -P w3m||type -P links||type -P lynx)" 82 | fi 83 | 84 | export TERMINAL="$(type -P sakura||type -P xterm||type -P konsole||type -P gnome-terminal||type -P terminology||type -P xfce4-terminal)" 85 | 86 | # most > less > more in order of preference 87 | export PAGER="$(type -P less 2>/dev/null || type -P most 2>/dev/null || type -P more 2>/dev/null)" 88 | 89 | # manpager in case you'd like your manpages in your favorite editor 90 | # export MANPAGER="env MAN_PN=1 vim -M +MANPAGER -" 91 | 92 | # Man page wrapper 93 | if type -P tput &>/dev/null; then 94 | man() { 95 | # Color man pages 96 | env LESS_TERMCAP_mb="$(printf "%s" "$(tput bold)$(tput setaf 1)")" \ 97 | LESS_TERMCAP_md="$(printf "%s" "$(tput bold)$(tput setaf 1)")" \ 98 | LESS_TERMCAP_me="$(printf "%s" "$(tput sgr0)")" \ 99 | LESS_TERMCAP_se="$(printf "%s" "$(tput sgr0)")" \ 100 | LESS_TERMCAP_so="$(printf "%s" "$(tput bold)$(tput setab 4)$(tput setaf 3)")" \ 101 | LESS_TERMCAP_ue="$(printf "%s" "$(tput sgr0)")" \ 102 | LESS_TERMCAP_us="$(printf "%s" "$(tput bold)$(tput setaf 2)")" \ 103 | "$(type -P man)" "$@" 104 | } 105 | else 106 | man() { 107 | # Colorfull manpages (works with less as a pager) 108 | # https://www.tecmint.com/view-colored-man-pages-in-linux/ 109 | env LESS_TERMCAP_mb=$'\e[1;32m' \ 110 | LESS_TERMCAP_md=$'\e[1;32m' \ 111 | LESS_TERMCAP_me=$'\e[0m' \ 112 | LESS_TERMCAP_se=$'\e[0m' \ 113 | LESS_TERMCAP_so=$'\e[01;33m' \ 114 | LESS_TERMCAP_ue=$'\e[0m' \ 115 | LESS_TERMCAP_us=$'\e[1;4;31m' \ 116 | "$(type -P man)" "${@}" 117 | } 118 | fi 119 | 120 | superman() { 121 | man $1 || $1 --help 122 | } 123 | 124 | alias man=superman 125 | # export LANG="en_US.utf8" 126 | # export LC_COLLATE="C" 127 | 128 | export GIT_PS1_SHOWDIRTYSTATE=yes 129 | export GIT_PS1_SHOWSTASHSTATE=yes 130 | export GIT_PS1_SHOWUNTRACKEDFILES=true 131 | export GIT_PS1_SHOWUPSTREAM=yes 132 | 133 | -------------------------------------------------------------------------------- /dot.files/.bashrc.d/aliases.bash: -------------------------------------------------------------------------------- 1 | # 2 | #shellcheck shell=bash disable=SC2154 3 | # Perfect alias candidates are one liners or functions that take no arguments. 4 | # https://www.cyberciti.biz/tips/bash-aliases-mac-centos-linux-unix.html 5 | 6 | # Distro independent utils 7 | # Package Search, Install, Remove 8 | # Distro Update, Upgrade, Cleanup 9 | if type -P apt-get &>/dev/null; then 10 | alias psearch='apt search' pinstall='sudo apt-get install' \ 11 | premove='sudo apt-get remove --purge' 12 | alias dupdate='sudo apt-get update' dupgrade='sudo apt-get dist-upgrade' \ 13 | dcleanup='sudo apt-get autoremove' 14 | elif type -P zypper &>/dev/null; then 15 | alias psearch='zypper search' pinstall='sudo zypper install' \ 16 | premove='sudo zypper remove --clean-deps' 17 | alias dupdate='sudo zypper refresh' dupgrade='sudo zypper update' \ 18 | dcleanup='sudo zypper rm -u' 19 | elif type -P yum &>/dev/null; then 20 | alias psearch='yum search' pinstall='sudo yum install' \ 21 | premove='sudo yum remove' 22 | alias dupdate='sudo yum check-update' dupgrade='sudo yum update' \ 23 | dcleanup='sudo yum autoremove' 24 | elif type -P pacman &>/dev/null; then 25 | alias psearch='pacman -Ss' pinstall='sudo pacman -S' \ 26 | premove='sudo pacman -R' 27 | alias dupdate='sudo pacman -Sy' dupgrade='sudo pacman -Syu' \ 28 | dcleanup='sudo pacman -Rsn' 29 | elif type -P emerge &>/dev/null; then 30 | alias psearch='emerge -s' pinstall='sudo emerge -av --autounmask' \ 31 | premove='sudo emerge -avC' 32 | alias dupdate='sudo emerge --sync' dupgrade='sudo emerge -avuND @world' \ 33 | dcleanup='sudo emerge --ask --depclean' 34 | elif type -P pkg &>/dev/null; then 35 | alias psearch='pkg search' pinstall='sudo pkg install' \ 36 | premove='sudo pkg remove' 37 | alias dupdate='sudo IGNORE_OSVERSION=yes pkg update' dupgrade='sudo IGNORE_OSVERSION=yes pkg upgrade' \ 38 | dcleanup='sudo pkg autoremove' 39 | fi 40 | 41 | # Get distro ID, NAME, etc 42 | # source /etc/os-release 43 | 44 | # if [[ "${NAME}" =~ BSD$ ]]; then 45 | if [[ "$(uname -s)" =~ BSD$ ]]; then 46 | alias ls='ls --color=auto' 47 | alias la='ls -ah --color=auto' 48 | alias ll='ls -lah --color=auto -D "+%F %T"' 49 | alias grep='grep --color=auto -in' 50 | alias egrep='egrep --color=auto' 51 | alias fgrep='fgrep --color=auto' 52 | elif type -P dircolors &>/dev/null; then 53 | alias ls='ls --color=auto --group-directories-first' 54 | alias la='ls --all --human-readable --color=auto --group-directories-first' 55 | alias ll='ls -l --all --human-readable --color=auto --group-directories-first --time-style="+%F %T"' 56 | alias grep='grep --color=auto -in' 57 | alias egrep='egrep --color=auto' 58 | alias fgrep='fgrep --color=auto' 59 | else 60 | alias ls='ls --group-directories-first' 61 | alias la='ls --all --human-readable --group-directories-first' 62 | alias ll='ls -l --all --human-readable --group-directories-first --time-style="+%F %T"' 63 | alias grep='grep -in' 64 | fi 65 | 66 | # Clean up temp sources (source /etc/os-release) 67 | # unset NAME VERSION VERSION_ID ID ANSI_COLOR PRETTY_NAME CPE_NAME HOME_URL BUG_REPORT_URL 68 | 69 | # Interactive & Verbose copy, move and remove commands 70 | alias cp='cp -iv' mv='mv -iv' rm='rm -iv' 71 | 72 | # Add --human-readable for various commands 73 | alias du='du -hx' ncdu='ncdu -x' df='df -h' 74 | alias duthis='du -hx --max-depth=1 | sort -hr|head' 75 | 76 | # Midnight Commander Safe Terminal 77 | # alias mcst='mc -a' # In case of malconfigured terminals 78 | # Midnight Commander wrapper script 79 | # alias mc='source /usr/share/mc/mc-wrapper.sh' 80 | 81 | # Emacs alias 82 | if type -P emacs &> /dev/null; then 83 | # EmaX No X11 84 | alias exnx='emacs -nw' 85 | # EmacsClient No X11 86 | alias ecnx='emacsclient -t' 87 | # EmacsClient Kill Daemon # Kill an emacs --daemon gracefully 88 | alias eckd='emacsclient --eval="(kill-emacs)"' 89 | fi 90 | 91 | # Various utils 92 | alias cronobash='time bash -ic exit' 93 | alias cronoemacs="time emacs --eval='(kill-emacs)'" 94 | alias termgeom='echo "${COLUMNS}x${LINES}"' 95 | 96 | # calendar 97 | # alias cal='cal -m' # First Day Monday Calendars 98 | 99 | # cloc 100 | #alias cloc='cloc --by-file-by-lang' 101 | 102 | # fonts for st 103 | #alias st='st -g 80x25 -f SourceCodePro-Regular' 104 | 105 | # NET 106 | # alias fixnet='ping -c 1 www.gentoo.org||sudo rc-service NetworkManager restart' 107 | alias netis='if ping -c 1 www.gentoo.org &> /dev/null; then echo "... UP!"; else echo "... Down!"; fi;' 108 | 109 | type -P ip &> /dev/null && \ 110 | alias show_interfaces="sudo ip -brief -color address show" 111 | 112 | # https://twitter.com/qusaialhaddad/status/1577278610410307584 113 | # curl wtfismyip.com/json 114 | 115 | # Help wan-ip-howto 116 | if type -P curl &> /dev/null; then 117 | alias wip4='curl ipv4.whatismyip.akamai.com;echo' 118 | alias wip6='curl ipv6.whatismyip.akamai.com;echo' 119 | elif type -P wget &> /dev/null; then 120 | alias wip4='wget -qO - ipv4.whatismyip.akamai.com;echo' 121 | alias wip6='wget -qO - ipv6.whatismyip.akamai.com;echo' 122 | fi 123 | 124 | # Show open ports # With sudo for service names 125 | type -P netstat &> /dev/null && \ 126 | alias lsnet='sudo netstat -tulapn' 127 | 128 | type -P lsof &> /dev/null && \ 129 | alias lsports="sudo lsof -i TCP -i UDP" 130 | 131 | # Shutdown > halt & reboot & poweroff 132 | # alias halt='sudo shutdown -h' 133 | # alias reboot='sudo shutdown -r' 134 | 135 | # ReMove Dead Links from current directory 136 | alias rmdl='find -L . -name . -o -type d -prune -o -type l -exec rm -i {} +' 137 | 138 | # Times table 139 | # https://twitter.com/climagic/status/1187089764496891904 140 | # Print a multiplication table. Great for those 3rd grader CLI users but also a great demo. :) 141 | # alias multab='printf "%3d %3d %3d %3d %3d %3d %3d %3d %3d %3d\n" $( echo {1..10}\*{1..10}\; | bc )' 142 | alias multab='printf "$(echo %3d$_{1..10})\n" $(echo {1..10}\*{1..10}\;|bc)' 143 | alias propaideia='for x in {1..9}; do for y in $(seq 1 $x); do printf "%dx%d=%2d\t" $y $x $((y*x));done;printf "\n";done' 144 | # alias ttt='for x in {1..10}; do let tt="${x} * 10";for y in $(seq $x $x $tt);do printf "%4d" $y;done; printf "\n";done' 145 | 146 | # https://twitter.com/liamosaur/status/506975850596536320 147 | alias hugit='sudo $(history -p \!\!)' # fuckit='sudo $(history -p \!\!)' Political stup... err correctess canceled this one 148 | 149 | # https://gist.github.com/seungwon0/802470 150 | # curl -s http://whatthecommit.com | perl -p0e '($_)=m{

(.+?)

}s' 151 | # curl -L -s http://whatthecommit.com/ | grep -A 1 "\"c" | tail -1 | sed 's/

//' 152 | # curl -s http://whatthecommit.com/index.txt 153 | 154 | if type -P git &> /dev/null; then 155 | # GIT 156 | alias gcl='git clone' 157 | alias gfc='git fetch' 158 | alias gst='git status' 159 | alias gdf='git diff' 160 | alias gaa='git add --all' 161 | alias gad='git add .' 162 | # alias gcm='git commit -m "$(curl -s whatthecommit.com/index.txt)"' 163 | alias gcm='git commit -m "$(date +%s)"' 164 | alias gps='git push' 165 | alias gal='gaa && gcm && gps' 166 | alias glp='git log -p' 167 | alias glg='git log --graph --pretty="%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset" --abbrev-commit' 168 | # alias gco='git checkout' 169 | alias gpl='git pull --rebase' 170 | # alias grb='git rebase' 171 | fi 172 | 173 | # NETRIS 174 | # https://git.sr.ht/~tslocum/netris?0.1.2 175 | alias netris='ssh netris.rocketnine.space' 176 | 177 | # TermBin https://termbin.com/ 178 | # Usage: "command | termbin" or termbin <<<$(command) 179 | alias termbin='nc termbin.com 9999' 180 | 181 | if type -P youtube-dl &> /dev/null; then 182 | alias ytdla='${HOME}/git/scrap/youtube-dl/youtube-dl --extract-audio --audio-format mp3 --prefer-ffmpeg --ignore-errors --no-check-certificate' 183 | alias ytdlv='${HOME}/git/scrap/youtube-dl/youtube-dl --format mp4 --prefer-ffmpeg --ignore-errors --no-check-certificate' 184 | fi 185 | 186 | [[ -r ~/git/vacuum_cleaner/databases/database.db ]] && type -P sqlite3 &> /dev/null && \ 187 | alias sql2data="sqlite3 \${HOME}/git/vacuum_cleaner/databases/database.db" 188 | 189 | alias fixdevnull='su -lc "rm -rf /dev/null && mknod /dev/null c 1 3 && chmod 777 /dev/null"' 190 | 191 | # alias materm='while :;do echo $LINES $COLUMNS $(( $RANDOM % $COLUMNS)) $(printf "\U$(($RANDOM % 500))");sleep 0.05;done|gawk \'{a[$3]=0;for (x in a){o=a[x];a[x]=a[x]+1;printf "\033[%s;%sH\033[2;32m%s",o,x,$4;printf "\033[%s;%sH\033[1;37m%s\033[0;0H",a[x],x,$4;if (a[x]>=$1){a[x]=0;}}}\'' 192 | -------------------------------------------------------------------------------- /dot.files/.bashrc.d/ascii.bash: -------------------------------------------------------------------------------- 1 | # 2 | # various ascii art ============================================================ 3 | #shellcheck shell=bash disable=SC2015,SC2154,SC2207 4 | 5 | pukeskull() { 6 | ##!/bin/sh 7 | # 8 | # ┳━┓┳━┓0┏┓┓┳━┓┏━┓┓ ┳ 9 | # ┃┳┛┃━┫┃┃┃┃┃━┃┃ ┃┃┃┃ 10 | # ┃┗┛┛ ┃┃┃┗┛┻━┛┛━┛┗┻┛ 11 | # ┳━┓┳ ┓┳┏ ┳━┓ 12 | # ┃━┛┃ ┃┣┻┓┣━ 13 | # ┇ ┗━┛┃ ┛┻━┛ 14 | # ┓━┓┳┏ ┳ ┓┳ ┳ 15 | # ┗━┓┣┻┓┃ ┃┃ ┃ 16 | # ━━┛┇ ┛┗━┛┗━┛┗━┛ 17 | # 18 | # the worst color script 19 | # by xero 20 | 21 | cat << 'EOF' 22 |  ................. 23 |  .syhhso++++++++/++osyyhys+. 24 |  -oddyo+o+++++++++++++++o+oo+osdms: 25 |  :dmyo++oosssssssssssssssooooooo+/+ymm+` 26 |  hmyo++ossyyhhddddddddddddhyyyssss+//+ymd- 27 |  -mho+oosyhhhddmmmmmmmmmmmmmmddhhyyyso+//+hN+ 28 |  my+++syhhhhdmmNNNNNNNNNNNNmmmmmdhhyyyyo//+sd: 29 |  hs//+oyhhhhdmNNNNNNNNNNNNNNNNNNmmdhyhhhyo//++y 30 |  s+++shddhhdmmNNNNNNNNNNNNNNNNNNNNmdhhhdhyo/++/ 31 |  'hs+shmmmddmNNNNNNNNNNNNNNNNNNNNNmddddddhs+oh/ 32 |  shsshdmmmmmNNMMMMMMMMMMMNNNNNNNNmmmmmmdhssdh- 33 |  +ssohdmmmmNNNNNMMMMMMMMNNNNNNmmmmmNNmdhhhs:` 34 |  -+oo++////++sydmNNNNNNNNNNNNNNNNNNNdyyys/--://+//: 35 |  d/+hmNNNmmdddhhhdmNNNNNNNNNNNNNNNmdhyyyhhhddmmNmdyd- 36 |  ++--+ymNMMNNNNNNmmmmNNNNNNNNNNNmdhddmNNMMMMMMNmhyss 37 |  /d+` -+ydmNMMMMMMNNmNMMMMMMMmmmmNNMMMMMNNmh- :sdo 38 |  sNo ` /ohdmNNMMMMNNMMMMMNNNMMMMMNmdyo/ ` hNh 39 |  M+' ``-/oyhmNNMNhNMNhNMMMMNmho/ ` 'MN/ 40 |  d+' `-+osydh0w.nzmNNmho: 'mN: 41 |  +o/ ` :oo+:s :+o/-` -dds 42 |  :hdo x `-/ooss:':+ooo: ` 0 :sdm+ 43 |  +dNNNh+ :ydmNNm' `sddmyo +hmNmds 44 |  dhNMMNNNNmddhsyhdmmNNNM: NNmNmhyo+oyyyhmNMMNmysd 45 |  ydNNNNNh+/++ohmMMMMNMNh oNNNNNNNmho++++yddhyssy 46 |  `:sNMMMMN' `mNMNNNd/` 47 | XXXXXXXXX y/hMMNm/ .dXb. -hdmdy: ` XXXXXXX 48 | XXXXXXXX `o+hNNds. -ymNNy- .yhys+/`` XXXXXX 49 | XXXXXXXX +-+//o/+odMNMMMNdmh++////-/s XXXXXX 50 | XXXXXXX mhNd -+d/+myo++ysy/hs -mNsdh/ XXXXXX 51 | XXXXXXXX mhMN+ dMm-/-smy-::dMN/sMMmdo XXXXXX 52 | XXXXXXXXXX NMy+NMMh oMMMs yMMMyNMMs+ XXXXXXX 53 | XXXXXXXXXXX dy-hMMm+dMMMdoNMMh ydo XXXXXXXXX 54 | XXXXXXXXXXXXX  smm 'NMMy dms sm XXXXXXXXXX 55 | XXXXXXXXXXXXXX XXXXXXXXXXX 56 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 57 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 58 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 59 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 60 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 61 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 62 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 63 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 64 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 65 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 66 | EOF 67 | } 68 | 69 | dennis_ritchie() { 70 | #original artwork by https://sanderfocus.nl/portfolio/tech-heroes/ 71 | #converted to shell by #nixers @ irc.unix.chat. 72 | cat << 'eof' 73 | ,_ ,_==▄▂ 74 | , ▂▃▄▄▅▅▅▂▅¾. / / 75 | ▄▆<´ "»▓▓▓%\ / / / / 76 | ,▅7" ´>▓▓▓% / / > / >/% 77 | ▐¶▓ ,»▓▓¾´ /> %/%// / / 78 | ▓▃▅▅▅▃,,▄▅▅▅Æ\// ///>// />/ / 79 | V║«¼.;→ ║<«.,`=// />//%/% / / 80 | //╠<´ -²,)(▓~"-╝/¾/ %/>/ /> 81 | / / / ▐% -./▄▃▄▅▐, /7//;//% / / 82 | / ////`▌▐ %zWv xX▓▇▌//&;% / / 83 | / / / %//%/¾½´▌▃▄▄▄▄▃▃▐¶\/& / 84 | </ /)VY>7; \_ 86 | / /</ //<///<_/%\▓ V%W%£)XY _/%‾\_, 87 | / / //%/_,=--^/%/%%\¾%¶%%} /%%%%%%;\, 88 | %/< /_/ %%%%%;X%%\%%;, _/%%%;, \ 89 | / / %%%%%%;, \%%l%%;// _/%;, dmr 90 | / %%%;, <;\-=-/ / 91 | ;, l 92 | UNIX is very simple, It just needs a 93 | GENIUS to understand its simplicity! 94 | eof 95 | } 96 | 97 | fancy4tune() { 98 | local -r myusage=" 99 | Description: Fancy fortune. 100 | Usage: ${FUNCNAME[0]} [ -(-f)ile cowsay_file ] [ -(-m)sg 'message' ] 101 | Example: ${FUNCNAME[0]} -f default -m 'Hello Lolcat!' 102 | Notes: When misspelled or no --file given, a random will be used. 103 | You can try: 'cowsay -l' for a list of available files. 104 | Requires: fortune, cowsay and lolcat.\n\n" 105 | 106 | local msg='' file='' 107 | 108 | type -P fortune &> /dev/null && \ 109 | type -P cowsay &> /dev/null && \ 110 | type -P lolcat &> /dev/null || \ 111 | { echo -ne "${myusage}" >&2; return 1; } 112 | 113 | local -ar cowsay_files=( $(cowsay -l|awk 'NR != 1 { print $0 }') ) 114 | 115 | while [[ -n "${1}" ]]; do 116 | case "${1}" in 117 | -m|--msg) shift; local msg="${1}";; 118 | -f|--file) shift; local file="${1}";; 119 | *) echo -ne "${myusage}" >&2; return 1;; 120 | esac 121 | shift 122 | done 123 | 124 | # { [[ -n "${msg}" ]] && echo "${msg}" || fortune -s; } | \ 125 | # { [[ -n "${file}" && "${cowsay_files[*]}" =~ ${file} ]] && cowsay -f "${file}" || cowsay -f "${cowsay_files[$(shuf -n 1 -i 0-"$((${#cowsay_files[*]}-1))")]}"; } | \ 126 | # lolcat 127 | { [[ -n "${msg}" ]] && echo "${msg}" || fortune; } | \ 128 | { [[ -n "${file}" && "${cowsay_files[*]}" =~ ${file} ]] && cowsay -f "${file}" || cowsay -f "${cowsay_files[$(( RANDOM % ${#cowsay_files[*]} ))]}"; } | \ 129 | lolcat 130 | } 131 | 132 | list_cow_files() { 133 | for i in $(cowsay -l|awk 'NR != 1 { print $0 }'); do 134 | funky4tune -m "Hello ${i} !" -f "${i}" || return 1 135 | done 136 | } 137 | 138 | magiccow() { 139 | # https://twitter.com/climagic/status/1299435679710154753 140 | # Magic Cow answers for all. Works better with cowsay and lolcat. 141 | # echo 'Yes!,Moooo!,Mooost likely!,Cannot predict cow!,Without a doubt!,My horses say no!,Ask again l8r!' | \ 142 | # tr ',' '\n' | sort -R | head -1 | { cowsay 2> /dev/null || cat; } | { lolcat 2> /dev/null || cat; } 143 | 144 | local -ar answ=( 145 | "It is certain." "It is decidedly so." "Without a doubt." "Yes – definitely." "You may rely on it." 146 | "As I see it, yes." "Most likely." "Outlook good." "Yes." "Signs point to yes." 147 | "Reply hazy, try again." "Ask again later." "Better not tell you now." "Cannot predict now." "Concentrate and ask again." 148 | "Don't count on it." "My reply is no." "My sources say no." "Outlook not so good." "Very doubtful." 149 | ) 150 | 151 | echo "${answ[$(( RANDOM % ${#answ[*]} ))]}" | \ 152 | { type -P cowsay &> /dev/null && cowsay || cat; } | \ 153 | { type -P lolcat &> /dev/null && lolcat || cat; } 154 | } 155 | 156 | mycountdown() { 157 | local -r myusage=" 158 | Description: Fancy countdown. 159 | Usage: ${FUNCNAME[0]} [#countdown seconds] 160 | Example: ${FUNCNAME[0]} 60 161 | Requires: figlet, lolcat and sox.\n" 162 | #shellcheck disable=SC2015 163 | type -P figlet &> /dev/null && \ 164 | type -P lolcat &> /dev/null && \ 165 | type -P play &> /dev/null || \ 166 | { echo -e "${myusage}" >&2; return 1; } 167 | 168 | for i in $(seq "${1:-10}" -1 0); do 169 | clear 170 | printf "%04d\n" "${i}" |figlet |lolcat 171 | sleep 1 172 | done 173 | play -q -n synth .8 sine 4100 fade q 0.1 .3 0.1 repeat 3 174 | } 175 | 176 | touch_type(){ 177 | # https://twitter.com/climagic/status/1324072754228899840 178 | # Simulate someone slowly typing out characters from a file. 179 | # cat /etc/passwd | while read -N1 l ; do printf "$l" ; sleep 0.$[5000+$RANDOM] ; done 180 | while read -rN1 l ; do printf "%c" "${l}" ; sleep "0.0$((1000+RANDOM))" ; done 181 | } 182 | 183 | # Static, Good luck with high lvl lang implementations of lolcat. 184 | # Recomended lolcat is: https://github.com/jaseg/lolcat 185 | type -P lolcat &> /dev/null && \ 186 | alias static='P=( " " █ ░ ▒ ▓ );while :;do printf "\e[$[RANDOM%LINES+1];$[RANDOM%COLUMNS+1]f${P[$RANDOM%5]}";done|lolcat' 187 | 188 | # https://twitter.com/climagic/status/1327689059666419725 189 | alias sunrise='p=3.14;for i in $( seq 0 0.04 100 );do r=$( printf "128+127*s($i)\n" |bc -l |cut -d. -f1) g=$( printf "128+127*s($i+$p*(1/3))\n" |bc -l |cut -d. -f1 ) b=$( printf "128+127*s($i+$p*(2/3))\n" |bc -l |cut -d. -f1 ); printf "\e[48;2;$r;$g;${b}m\n"; done' 190 | -------------------------------------------------------------------------------- /dot.files/.bashrc.d/colors.bash: -------------------------------------------------------------------------------- 1 | # 2 | # colors for general/ls use 3 | #shellcheck shell=bash 4 | 5 | # https://robotmoon.com/256-colors/ 6 | # https://github.com/philosophos/Xresources 7 | # https://jonasjacek.github.io/colors/ 8 | # https://jonasjacek.github.io/colors/data.json 9 | # https://github.com/jonasjacek/colors 10 | # https://stackoverflow.com/questions/1955505/parsing-json-with-unix-tools 11 | # https://opensource.com/article/19/9/linux-terminal-colors 12 | # 13 | # curl -s 'https://jonasjacek.github.io/colors/data.json' | sed -e 's/[{}]//g' | awk -v RS=',"' -F: '/^name/ {print $2}'|sed 's/\(^"\|"$\)//g' 14 | 15 | # For your reference, here are the foreground and background color codes. Foreground colors are in the 30 range, while background colors are in the 40 range: 16 | # Color Foreground Background 17 | # Black \033[30m \033[40m 18 | # Red \033[31m \033[41m 19 | # Green \033[32m \033[42m 20 | # Orange \033[33m \033[43m 21 | # Blue \033[34m \033[44m 22 | # Magenta \033[35m \033[45m 23 | # Cyan \033[36m \033[46m 24 | # Light gray \033[37m \033[47m 25 | # Fallback \033[39m \033[49m 26 | # to defaults 27 | 28 | # There are some additional colors available for the background: 29 | # Color Background 30 | # Dark gray \033[100m 31 | # Light red \033[101m 32 | # Light green \033[102m 33 | # Yellow \033[103m 34 | # Light blue \033[104m 35 | # Light purple \033[105m 36 | # Teal \033[106m 37 | # White \033[107m 38 | 39 | # infocmp 40 | 41 | # Font attributes # Font colors # Font background colors 42 | # export reset="$(tput sgr0)" bold="$(tput bold)" dim="$(tput dim)" blink="$(tput blink)" underline="$(tput smul)" end_underline="$(tput rmul)" reverse="$(tput rev)" hidden="$(tput invis)" \ 43 | # black="$(tput setaf 0)" red="$(tput setaf 1)" green="$(tput setaf 2)" yellow="$(tput setaf 3)" blue="$(tput setaf 4)" magenta="$(tput setaf 5)" cyan="$(tput setaf 6)" white="$(tput setaf 7)" default="$(tput setaf 9)" \ 44 | # bg_black="$(tput setab 0)" bg_red="$(tput setab 1)" bg_green="$(tput setab 2)" bg_yellow="$(tput setab 3)" bg_blue="$(tput setab 4)" bg_magenta="$(tput setab 5)" bg_cyan="$(tput setab 6)" bg_white="$(tput setab 7)" bg_default="$(tput setab 9)" 45 | 46 | # Colors Foreground, Background: 47 | # export LIGHT_BLACK='\e[1;30m' LIGHT_RED='\e[1;31m' LIGHT_GREEN='\e[1;32m' LIGHT_YELLOW='\e[1;33m' LIGHT_BLUE='\e[1;34m' LIGHT_MAGENT='\e[1;35m' LIGHT_CYAN='\e[1;36m' LIGHT_WHITE='\e[1;37m' \ 48 | # DARK_BLACK='\e[0;30m' DARK_RED='\e[0;31m' DARK_GREEN='\e[0;32m' DARK_YELLOW='\e[0;33m' DARK_BLUE='\e[0;34m' DARK_MAGENT='\e[0;35m' DARK_CYAN='\e[0;36m' DARK_WHITE='\e[0;37m' 49 | 50 | # <2020-04-15 Wed> LS_COLORS from here: https://github.com/trapd00r/LS_COLORS 51 | # dircolors -b LS_COLORS >> ~/git/dots/dot.files/.bashrc.d/00_colors.bash 52 | # https://raw.githubusercontent.com/trapd00r/LS_COLORS/master/LS_COLORS 53 | export LS_COLORS='bd=38;5;68:ca=38;5;17:cd=38;5;113;1:di=38;5;30:do=38;5;127:ex=38;5;208;1:pi=38;5;126:fi=0:ln=target:mh=38;5;222;1:no=0:or=48;5;196;38;5;232;1:ow=38;5;220;1:sg=48;5;3;38;5;0:su=38;5;220;1;3;100;1:so=38;5;197:st=38;5;86;48;5;234:tw=48;5;235;38;5;139;3:*LS_COLORS=48;5;89;38;5;197;1;3;4;7:*README=38;5;220;1:*README.rst=38;5;220;1:*README.md=38;5;220;1:*LICENSE=38;5;220;1:*COPYING=38;5;220;1:*INSTALL=38;5;220;1:*COPYRIGHT=38;5;220;1:*AUTHORS=38;5;220;1:*HISTORY=38;5;220;1:*CONTRIBUTORS=38;5;220;1:*PATENTS=38;5;220;1:*VERSION=38;5;220;1:*NOTICE=38;5;220;1:*CHANGES=38;5;220;1:*.log=38;5;190:*.txt=38;5;253:*.etx=38;5;184:*.info=38;5;184:*.markdown=38;5;184:*.md=38;5;184:*.mkd=38;5;184:*.nfo=38;5;184:*.pod=38;5;184:*.rst=38;5;184:*.tex=38;5;184:*.textile=38;5;184:*.bib=38;5;178:*.json=38;5;178:*.jsonl=38;5;178:*.ndjson=38;5;178:*.msg=38;5;178:*.pgn=38;5;178:*.rss=38;5;178:*.xml=38;5;178:*.fxml=38;5;178:*.toml=38;5;178:*.yaml=38;5;178:*.yml=38;5;178:*.RData=38;5;178:*.rdata=38;5;178:*.xsd=38;5;178:*.dtd=38;5;178:*.sgml=38;5;178:*.rng=38;5;178:*.rnc=38;5;178:*.cbr=38;5;141:*.cbz=38;5;141:*.chm=38;5;141:*.djvu=38;5;141:*.pdf=38;5;141:*.PDF=38;5;141:*.mobi=38;5;141:*.epub=38;5;141:*.docm=38;5;111;4:*.doc=38;5;111:*.docx=38;5;111:*.odb=38;5;111:*.odt=38;5;111:*.rtf=38;5;111:*.odp=38;5;166:*.pps=38;5;166:*.ppt=38;5;166:*.pptx=38;5;166:*.ppts=38;5;166:*.pptxm=38;5;166;4:*.pptsm=38;5;166;4:*.csv=38;5;78:*.tsv=38;5;78:*.ods=38;5;112:*.xla=38;5;76:*.xls=38;5;112:*.xlsx=38;5;112:*.xlsxm=38;5;112;4:*.xltm=38;5;73;4:*.xltx=38;5;73:*.pages=38;5;111:*.numbers=38;5;112:*.key=38;5;166:*config=1:*cfg=1:*conf=1:*rc=1:*authorized_keys=1:*known_hosts=1:*.ini=1:*.plist=1:*.viminfo=1:*.pcf=1:*.psf=1:*.hidden-color-scheme=1:*.hidden-tmTheme=1:*.last-run=1:*.merged-ca-bundle=1:*.sublime-build=1:*.sublime-commands=1:*.sublime-keymap=1:*.sublime-settings=1:*.sublime-snippet=1:*.sublime-project=1:*.sublime-workspace=1:*.tmTheme=1:*.user-ca-bundle=1:*.epf=1:*.git=38;5;197:*.gitignore=38;5;240:*.gitattributes=38;5;240:*.gitmodules=38;5;240:*.awk=38;5;172:*.bash=38;5;172:*.bat=38;5;172:*.BAT=38;5;172:*.sed=38;5;172:*.sh=38;5;172:*.zsh=38;5;172:*.vim=38;5;172:*.kak=38;5;172:*.ahk=38;5;41:*.py=38;5;41:*.ipynb=38;5;41:*.rb=38;5;41:*.gemspec=38;5;41:*.pl=38;5;208:*.PL=38;5;160:*.t=38;5;114:*.msql=38;5;222:*.mysql=38;5;222:*.pgsql=38;5;222:*.sql=38;5;222:*.tcl=38;5;64;1:*.r=38;5;49:*.R=38;5;49:*.gs=38;5;81:*.clj=38;5;41:*.cljs=38;5;41:*.cljc=38;5;41:*.cljw=38;5;41:*.scala=38;5;41:*.dart=38;5;51:*.asm=38;5;81:*.cl=38;5;81:*.lisp=38;5;81:*.rkt=38;5;81:*.lua=38;5;81:*.moon=38;5;81:*.c=38;5;81:*.C=38;5;81:*.h=38;5;110:*.H=38;5;110:*.tcc=38;5;110:*.c++=38;5;81:*.h++=38;5;110:*.hpp=38;5;110:*.hxx=38;5;110:*.ii=38;5;110:*.M=38;5;110:*.m=38;5;110:*.cc=38;5;81:*.cs=38;5;81:*.cp=38;5;81:*.cpp=38;5;81:*.cxx=38;5;81:*.cr=38;5;81:*.go=38;5;81:*.f=38;5;81:*.F=38;5;81:*.for=38;5;81:*.ftn=38;5;81:*.f90=38;5;81:*.F90=38;5;81:*.f95=38;5;81:*.F95=38;5;81:*.f03=38;5;81:*.F03=38;5;81:*.f08=38;5;81:*.F08=38;5;81:*.nim=38;5;81:*.nimble=38;5;81:*.s=38;5;110:*.S=38;5;110:*.rs=38;5;81:*.scpt=38;5;219:*.swift=38;5;219:*.sx=38;5;81:*.vala=38;5;81:*.vapi=38;5;81:*.hi=38;5;110:*.hs=38;5;81:*.lhs=38;5;81:*.agda=38;5;81:*.lagda=38;5;81:*.lagda.tex=38;5;81:*.lagda.rst=38;5;81:*.lagda.md=38;5;81:*.agdai=38;5;110:*.zig=38;5;81:*.pyc=38;5;240:*.tf=38;5;168:*.tfstate=38;5;168:*.tfvars=38;5;168:*.css=38;5;125;1:*.less=38;5;125;1:*.sass=38;5;125;1:*.scss=38;5;125;1:*.htm=38;5;125;1:*.html=38;5;125;1:*.jhtm=38;5;125;1:*.mht=38;5;125;1:*.eml=38;5;125;1:*.mustache=38;5;125;1:*.coffee=38;5;074;1:*.java=38;5;074;1:*.js=38;5;074;1:*.mjs=38;5;074;1:*.jsm=38;5;074;1:*.jsp=38;5;074;1:*.php=38;5;81:*.ctp=38;5;81:*.twig=38;5;81:*.vb=38;5;81:*.vba=38;5;81:*.vbs=38;5;81:*Dockerfile=38;5;155:*.dockerignore=38;5;240:*Makefile=38;5;155:*MANIFEST=38;5;243:*pm_to_blib=38;5;240:*.nix=38;5;155:*.dhall=38;5;178:*.rake=38;5;155:*.am=38;5;242:*.in=38;5;242:*.hin=38;5;242:*.scan=38;5;242:*.m4=38;5;242:*.old=38;5;242:*.out=38;5;242:*.SKIP=38;5;244:*.diff=48;5;197;38;5;232:*.patch=48;5;197;38;5;232;1:*.bmp=38;5;97:*.dicom=38;5;97:*.tiff=38;5;97:*.tif=38;5;97:*.TIFF=38;5;97:*.cdr=38;5;97:*.flif=38;5;97:*.gif=38;5;97:*.icns=38;5;97:*.ico=38;5;97:*.jpeg=38;5;97:*.JPG=38;5;97:*.jpg=38;5;97:*.nth=38;5;97:*.png=38;5;97:*.psd=38;5;97:*.pxd=38;5;97:*.pxm=38;5;97:*.xpm=38;5;97:*.webp=38;5;97:*.ai=38;5;99:*.eps=38;5;99:*.epsf=38;5;99:*.drw=38;5;99:*.ps=38;5;99:*.svg=38;5;99:*.avi=38;5;114:*.divx=38;5;114:*.IFO=38;5;114:*.m2v=38;5;114:*.m4v=38;5;114:*.mkv=38;5;114:*.MOV=38;5;114:*.mov=38;5;114:*.mp4=38;5;114:*.mpeg=38;5;114:*.mpg=38;5;114:*.ogm=38;5;114:*.rmvb=38;5;114:*.sample=38;5;114:*.wmv=38;5;114:*.3g2=38;5;115:*.3gp=38;5;115:*.gp3=38;5;115:*.webm=38;5;115:*.gp4=38;5;115:*.asf=38;5;115:*.flv=38;5;115:*.ts=38;5;115:*.ogv=38;5;115:*.f4v=38;5;115:*.VOB=38;5;115;1:*.vob=38;5;115;1:*.ass=38;5;117:*.srt=38;5;117:*.ssa=38;5;117:*.sub=38;5;117:*.sup=38;5;117:*.vtt=38;5;117:*.3ga=38;5;137;1:*.S3M=38;5;137;1:*.aac=38;5;137;1:*.amr=38;5;137;1:*.au=38;5;137;1:*.caf=38;5;137;1:*.dat=38;5;137;1:*.dts=38;5;137;1:*.fcm=38;5;137;1:*.m4a=38;5;137;1:*.mid=38;5;137;1:*.mod=38;5;137;1:*.mp3=38;5;137;1:*.mp4a=38;5;137;1:*.oga=38;5;137;1:*.ogg=38;5;137;1:*.opus=38;5;137;1:*.s3m=38;5;137;1:*.sid=38;5;137;1:*.wma=38;5;137;1:*.ape=38;5;136;1:*.aiff=38;5;136;1:*.cda=38;5;136;1:*.flac=38;5;136;1:*.alac=38;5;136;1:*.midi=38;5;136;1:*.pcm=38;5;136;1:*.wav=38;5;136;1:*.wv=38;5;136;1:*.wvc=38;5;136;1:*.afm=38;5;66:*.fon=38;5;66:*.fnt=38;5;66:*.pfb=38;5;66:*.pfm=38;5;66:*.ttf=38;5;66:*.otf=38;5;66:*.woff=38;5;66:*.woff2=38;5;66:*.PFA=38;5;66:*.pfa=38;5;66:*.7z=38;5;40:*.a=38;5;40:*.arj=38;5;40:*.bz2=38;5;40:*.cpio=38;5;40:*.gz=38;5;40:*.lrz=38;5;40:*.lz=38;5;40:*.lzma=38;5;40:*.lzo=38;5;40:*.rar=38;5;40:*.s7z=38;5;40:*.sz=38;5;40:*.tar=38;5;40:*.tgz=38;5;40:*.xz=38;5;40:*.z=38;5;40:*.zip=38;5;40:*.zipx=38;5;40:*.zoo=38;5;40:*.zpaq=38;5;40:*.zst=38;5;40:*.zstd=38;5;40:*.zz=38;5;40:*.apk=38;5;215:*.ipa=38;5;215:*.deb=38;5;215:*.rpm=38;5;215:*.jad=38;5;215:*.jar=38;5;215:*.cab=38;5;215:*.pak=38;5;215:*.pk3=38;5;215:*.vdf=38;5;215:*.vpk=38;5;215:*.bsp=38;5;215:*.dmg=38;5;215:*.r[0-9]{0,2}=38;5;239:*.zx[0-9]{0,2}=38;5;239:*.z[0-9]{0,2}=38;5;239:*.part=38;5;239:*.iso=38;5;124:*.bin=38;5;124:*.nrg=38;5;124:*.qcow=38;5;124:*.sparseimage=38;5;124:*.toast=38;5;124:*.vcd=38;5;124:*.vmdk=38;5;124:*.accdb=38;5;60:*.accde=38;5;60:*.accdr=38;5;60:*.accdt=38;5;60:*.db=38;5;60:*.fmp12=38;5;60:*.fp7=38;5;60:*.localstorage=38;5;60:*.mdb=38;5;60:*.mde=38;5;60:*.sqlite=38;5;60:*.typelib=38;5;60:*.nc=38;5;60:*.pacnew=38;5;33:*.un~=38;5;241:*.orig=38;5;241:*.BUP=38;5;241:*.bak=38;5;241:*.o=38;5;241:*core=38;5;241:*.mdump=38;5;241:*.rlib=38;5;241:*.dll=38;5;241:*.swp=38;5;244:*.swo=38;5;244:*.tmp=38;5;244:*.sassc=38;5;244:*.pid=38;5;248:*.state=38;5;248:*lockfile=38;5;248:*lock=38;5;248:*.err=38;5;160;1:*.error=38;5;160;1:*.stderr=38;5;160;1:*.aria2=38;5;241:*.dump=38;5;241:*.stackdump=38;5;241:*.zcompdump=38;5;241:*.zwc=38;5;241:*.pcap=38;5;29:*.cap=38;5;29:*.dmp=38;5;29:*.DS_Store=38;5;239:*.localized=38;5;239:*.CFUserTextEncoding=38;5;239:*.allow=38;5;112:*.deny=38;5;196:*.service=38;5;45:*@.service=38;5;45:*.socket=38;5;45:*.swap=38;5;45:*.device=38;5;45:*.mount=38;5;45:*.automount=38;5;45:*.target=38;5;45:*.path=38;5;45:*.timer=38;5;45:*.snapshot=38;5;45:*.application=38;5;116:*.cue=38;5;116:*.description=38;5;116:*.directory=38;5;116:*.m3u=38;5;116:*.m3u8=38;5;116:*.md5=38;5;116:*.properties=38;5;116:*.sfv=38;5;116:*.theme=38;5;116:*.torrent=38;5;116:*.urlview=38;5;116:*.webloc=38;5;116:*.lnk=38;5;39:*CodeResources=38;5;239:*PkgInfo=38;5;239:*.nib=38;5;57:*.car=38;5;57:*.dylib=38;5;241:*.entitlements=1:*.pbxproj=1:*.strings=1:*.storyboard=38;5;196:*.xcconfig=1:*.xcsettings=1:*.xcuserstate=1:*.xcworkspacedata=1:*.xib=38;5;208:*.asc=38;5;192;3:*.bfe=38;5;192;3:*.enc=38;5;192;3:*.gpg=38;5;192;3:*.signature=38;5;192;3:*.sig=38;5;192;3:*.p12=38;5;192;3:*.pem=38;5;192;3:*.pgp=38;5;192;3:*.p7s=38;5;192;3:*id_dsa=38;5;192;3:*id_rsa=38;5;192;3:*id_ecdsa=38;5;192;3:*id_ed25519=38;5;192;3:*.32x=38;5;213:*.cdi=38;5;213:*.fm2=38;5;213:*.rom=38;5;213:*.sav=38;5;213:*.st=38;5;213:*.a00=38;5;213:*.a52=38;5;213:*.A64=38;5;213:*.a64=38;5;213:*.a78=38;5;213:*.adf=38;5;213:*.atr=38;5;213:*.gb=38;5;213:*.gba=38;5;213:*.gbc=38;5;213:*.gel=38;5;213:*.gg=38;5;213:*.ggl=38;5;213:*.ipk=38;5;213:*.j64=38;5;213:*.nds=38;5;213:*.nes=38;5;213:*.sms=38;5;213:*.8xp=38;5;121:*.8eu=38;5;121:*.82p=38;5;121:*.83p=38;5;121:*.8xe=38;5;121:*.stl=38;5;216:*.dwg=38;5;216:*.ply=38;5;216:*.wrl=38;5;216:*.pot=38;5;7:*.pcb=38;5;7:*.mm=38;5;7:*.gbr=38;5;7:*.scm=38;5;7:*.xcf=38;5;7:*.spl=38;5;7:*.Rproj=38;5;11:*.sis=38;5;7:*.1p=38;5;7:*.3p=38;5;7:*.cnc=38;5;7:*.def=38;5;7:*.ex=38;5;7:*.example=38;5;7:*.feature=38;5;7:*.ger=38;5;7:*.ics=38;5;7:*.map=38;5;7:*.mf=38;5;7:*.mfasl=38;5;7:*.mi=38;5;7:*.mtx=38;5;7:*.pc=38;5;7:*.pi=38;5;7:*.plt=38;5;7:*.pm=38;5;7:*.rdf=38;5;7:*.ru=38;5;7:*.sch=38;5;7:*.sty=38;5;7:*.sug=38;5;7:*.tdy=38;5;7:*.tfm=38;5;7:*.tfnt=38;5;7:*.tg=38;5;7:*.vcard=38;5;7:*.vcf=38;5;7:*.xln=38;5;7:*.iml=38;5;166:'; 54 | 55 | -------------------------------------------------------------------------------- /dot.files/.bashrc.d/stdlib/crypto.bash: -------------------------------------------------------------------------------- 1 | # 2 | # cryptographic functions 3 | #shellcheck shell=bash disable=SC2005,SC2155,SC2086 4 | 5 | gen_rnum() { 6 | LC_CTYPE=C tr -dc [:digit:] < /dev/urandom | \ 7 | dd ibs=1 obs=1 count="${1:-16}" 2>/dev/null 8 | echo 9 | } 10 | 11 | gen_pass() { 12 | LC_ALL=C tr -dc [:graph:] < /dev/urandom | \ 13 | tr -d [=\"=][=\'=][=\|=][=\,=] | \ 14 | dd ibs=1 obs=1 count="${1:-16}" 2>/dev/null 15 | echo 16 | } 17 | 18 | gen_uuid() { 19 | # local uuid="$(cat /proc/sys/kernel/random/uuid)" 20 | # echo "${uuid}" 21 | # https://en.wikipedia.org/wiki/Universally_unique_identifier 22 | # https://github.com/niieani/bash-oo-framework/blob/master/lib/String/UUID.sh 23 | # https://gist.github.com/markusfisch/6110640 24 | # https://github.com/lowerpower/UUID-with-bash 25 | mkpart() { 26 | # LC_CTYPE=C tr -dc [0-9a-fA-F] < /dev/urandom | dd bs="${1}" count=1 2> /dev/null 27 | # LC_CTYPE=C tr -dc "0123456789ABCDEFabcdef" < /dev/urandom | dd bs="${1}" count=1 2> /dev/null 28 | LC_CTYPE=C tr -dc [:xdigit:] < /dev/urandom | dd bs="${1}" count=1 2> /dev/null 29 | } 30 | for i in {8,4,4,4,12}; do 31 | local uuid+="$(mkpart $i)-" 32 | done 33 | local uuid="${uuid%-}" 34 | printf "%s\n" "${uuid,,}" 35 | } 36 | 37 | hash_stdin() { 38 | [[ "${#}" -ne "1" ]] && \ 39 | echo -ne "\n\tUsage: echo/cat \"text/file to hash\" | ${FUNCNAME[0]} cipher\n\n" >&2 && \ 40 | return 1 41 | openssl dgst -"${1}" 42 | } 43 | 44 | transcode_stdin() { 45 | [[ "${#}" -ne "2" ]] && \ 46 | echo -ne "\n\tUsage: echo/cat \"text/file to encode/decode\" | ${FUNCNAME[0]} (e/d) cipher\n\teg: echo 'Hello World'|transcode_stdin e blowfish\n\n" >&2 && \ 47 | return 1 48 | openssl enc -base64 -"${2}" -"${1}" 49 | } 50 | 51 | transcode_gpg() { 52 | declare -x GPG_TTY="$(tty)" 53 | local myusage=" 54 | Usage: ${FUNCNAME[0]} file(s)|file(s).gpg... 55 | Description: Decrypt/Encrypt files from/to your default gpg keyring. 56 | Examples: ${FUNCNAME[0]} *.txt *.gpg 57 | # will encrypt .txt files and decrypt .gpg files in current dir.\n\n" 58 | 59 | [[ "${#}" -lt "1" ]] && echo -ne "${myusage}" >&2 && return 1 60 | 61 | while [[ -n "${1}" ]]; do 62 | case "${1}" in 63 | -h|--help) 64 | echo -ne "${myusage}" >&2 65 | shift 66 | continue;; 67 | *) 68 | if [[ -f "${1}" && -r "${1}" ]]; then 69 | if [[ "$(file -b "${1}")" =~ ^PGP ]]; then 70 | if [[ "${1}" != "${1//.gpg/}" ]]; then 71 | local func="-d" out="${1//.gpg/}" 72 | elif [[ "${1}" != "${1//.pgp/}" ]]; then 73 | local func="-d" out="${1//.pgp/}" 74 | else 75 | local func="-d" out="${1}.dec" 76 | fi 77 | else 78 | local func="-e" out="${1}.gpg" 79 | fi 80 | else 81 | echo -ne "\t${1} is not a readable file!\n${myusage}" >&2 82 | shift 83 | continue 84 | fi;; 85 | esac 86 | gpg --default-recipient-self "${func}" < "${1}" > "${out}" 87 | shift 88 | done 89 | } 90 | 91 | rot_13() { 92 | [[ "${1}" != "-e" && "${1}" != "-d" ]] || [[ -z "${2}" ]] && \ 93 | echo -ne "\n\tUsage: ${FUNCNAME[0]} [-(e|d)] [argument/(s)...]\n\n" >&2 && return 1 94 | 95 | local -a _ABC=( "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" \ 96 | "K" "L" "M" "N" "O" "P" "Q" "R" "S" "T" \ 97 | "U" "V" "W" "X" "Y" "Z" ) 98 | local -a _abc=( "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" \ 99 | "k" "l" "m" "n" "o" "p" "q" "r" "s" "t" \ 100 | "u" "v" "w" "x" "y" "z" ) 101 | local -a _NOP=( "N" "O" "P" "Q" "R" "S" "T" "U" "V" "W" \ 102 | "X" "Y" "Z" "A" "B" "C" "D" "E" "F" "G" \ 103 | "H" "I" "J" "K" "L" "M" ) 104 | local -a _nop=( "n" "o" "p" "q" "r" "s" "t" "u" "v" "w" \ 105 | "x" "y" "z" "a" "b" "c" "d" "e" "f" "g" \ 106 | "h" "i" "j" "k" "l" "m" ) 107 | 108 | local _func="${1}"; shift 109 | 110 | while [[ -n "${1}" ]]; do 111 | local _word="${1}" 112 | local _out 113 | for (( i = 0; i <= ${#_word}; i++ )); do 114 | for (( x = 0; x <= ${#_abc[*]}; x++ )); do 115 | case "${_func}" in 116 | "-e") 117 | [[ "${_word:i:1}" == "${_ABC[x]}" ]] && \ 118 | _out+="${_NOP[x]}" && break 119 | [[ "${_word:i:1}" == "${_abc[x]}" ]] && \ 120 | _out+="${_nop[x]}" && break;; 121 | "-d") 122 | [[ "${_word:i:1}" == "${_NOP[x]}" ]] && \ 123 | _out+="${_ABC[x]}" && break 124 | [[ "${_word:i:1}" == "${_nop[x]}" ]] && \ 125 | _out+="${_abc[x]}" && break;; 126 | esac 127 | #If char has not been found by now lets add it as is. 128 | (( x == ${#_abc[*]} )) && _out+="${_word:i:1}" 129 | done 130 | done 131 | shift 132 | _out+=" " 133 | done 134 | echo "${_out[*]}" 135 | } 136 | 137 | caesar_cipher() { 138 | # michaeltd 2019-11-30 139 | # https://en.wikipedia.org/wiki/Caesar_cipher 140 | # E n ( x ) = ( x + n ) mod 26. 141 | # D n ( x ) = ( x − n ) mod 26. 142 | 143 | local -a _ABC=( "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" \ 144 | "K" "L" "M" "N" "O" "P" "Q" "R" "S" "T" \ 145 | "U" "V" "W" "X" "Y" "Z" ) 146 | local -a _abc=( "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" \ 147 | "k" "l" "m" "n" "o" "p" "q" "r" "s" "t" \ 148 | "u" "v" "w" "x" "y" "z" ) 149 | 150 | local _out 151 | 152 | if [[ "${#}" -lt "3" ]] || \ 153 | [[ "$1" != "-e" && "$1" != "-d" ]] || \ 154 | [[ "${2}" -lt "1" || "${2}" -gt "25" ]] 155 | then 156 | echo -ne "\n\tUsage: ${FUNCNAME[0]} [-(e|d)] [rotation {1..25}] [argument/(s)...]\n\n" >&2 157 | return 1 158 | fi 159 | 160 | _func="${1}"; shift; _rotval="${1}"; shift 161 | 162 | while [[ -n "${1}" ]]; do 163 | for (( i = 0; i < ${#1}; i++ )); do 164 | for (( x = 0; x < ${#_abc[*]}; x++ )); do 165 | case "${_func}" in 166 | "-e") 167 | [[ "${1:i:1}" == "${_ABC[x]}" ]] && \ 168 | _out+="${_ABC[(( ( x + _rotval ) % 26 ))]}" && \ 169 | break 170 | [[ "${1:i:1}" == "${_abc[x]}" ]] && \ 171 | _out+="${_abc[(( ( x + _rotval ) % 26 ))]}" && \ 172 | break;; 173 | "-d") 174 | [[ "${1:i:1}" == "${_ABC[x]}" ]] && \ 175 | _out+="${_ABC[(( ( x - _rotval ) % 26 ))]}" && \ 176 | break 177 | [[ "${1:i:1}" == "${_abc[x]}" ]] && \ 178 | _out+="${_abc[(( ( x - _rotval ) % 26 ))]}" && \ 179 | break;; 180 | esac 181 | # If char has not been found by now lets add it as is. 182 | (( x == ${#_abc[*]} - 1 )) && _out+="${1:i:1}" 183 | done 184 | done 185 | _out+=" " 186 | shift 187 | done 188 | echo "${_out[*]}" 189 | } 190 | 191 | alpha2morse() { 192 | local -rA alpha_assoc=( \ 193 | [A]='.-' [B]='-...' [C]='-.-.' [D]='-..' [E]='.' [F]='..-.' \ 194 | [G]='--.' [H]='....' [I]='..' [J]='.---' [K]='-.-' \ 195 | [L]='.-..' [M]='--' [N]='-.' [O]='---' [P]='.--.' \ 196 | [Q]='--.-' [R]='.-.' [S]='...' [T]='-' [U]='..-' \ 197 | [V]='...-' [W]='.--' [X]='-..-' [Y]='-.--' [Z]='--..' \ 198 | [0]='-----' [1]='.----' [2]='..---' [3]='...--' [4]='....-' \ 199 | [5]='.....' [6]='-....' [7]='--...' [8]='----..' [9]='----.' ) 200 | 201 | if [[ "${#}" -lt "1" ]]; then 202 | echo -ne " 203 | Usage: ${FUNCNAME[0]} arguments... 204 | Example: ${FUNCNAME[0]} Hello World 205 | Description: ${FUNCNAME[0]} is an IMC transmitter. 206 | It'll transmit your messages to International Morse Code.\n\n" >&2 207 | return 1 208 | fi 209 | 210 | while [[ -n "${1}" ]]; do 211 | for (( i = 0; i < ${#1}; i++ )); do 212 | local letter="${1:i:1}" 213 | for (( y = 0; y < ${#alpha_assoc[${letter^^}]}; y++ )); do 214 | case "${alpha_assoc[${letter^^}]:y:1}" in 215 | ".") 216 | echo -n "dot " 217 | play -q -n -c2 synth .05 2> /dev/null || sleep .05 ;; 218 | "-") 219 | echo -n "dash " 220 | play -q -n -c2 synth .15 2> /dev/null || sleep .15 ;; 221 | esac 222 | sleep .05 223 | done 224 | echo 225 | sleep .15 226 | done 227 | echo 228 | sleep .35 229 | shift 230 | done 231 | } 232 | -------------------------------------------------------------------------------- /dot.files/.bashrc.d/stdlib/distance.bash: -------------------------------------------------------------------------------- 1 | # 2 | # Distance conversions 3 | #shellcheck shell=bash disable=SC2005 4 | 5 | ml2km() { 6 | printf "%.2f\n" "$(echo "scale=2;${1}/0.621371192237334"|bc -ql)" 7 | } 8 | 9 | km2ml() { 10 | printf "%.2f\n" "$(echo "scale=2;${1}*0.621371192237334"|bc -ql)" 11 | } 12 | 13 | mph2kph() { 14 | ml2km "${1}" 15 | } 16 | 17 | kph2mph() { 18 | km2ml "${1}" 19 | } 20 | 21 | in2cm() { 22 | printf "%.2f\n" "$(echo "scale=2;${1}*2.54"|bc -ql)" 23 | } 24 | 25 | cm2in() { 26 | printf "%.2f\n" "$(echo "scale=2;${1}/2.54"|bc -ql)" 27 | } 28 | -------------------------------------------------------------------------------- /dot.files/.bashrc.d/stdlib/mass.bash: -------------------------------------------------------------------------------- 1 | # 2 | # Mass conversions kg/lb 3 | #shellcheck shell=bash 4 | 5 | kg2lb() { 6 | printf "%.2f\n" "$(echo "scale=2;${1} * 2.20462262185"|bc -ql)" 7 | } 8 | 9 | lb2kg() { 10 | printf "%.2f\n" "$(echo "scale=2;${1} / 2.20462262185"|bc -ql)" 11 | } 12 | -------------------------------------------------------------------------------- /dot.files/.bashrc.d/stdlib/math.bash: -------------------------------------------------------------------------------- 1 | # 2 | # math related functions 3 | #shellcheck shell=bash disable=SC2015 4 | 5 | dec2hex() { 6 | # printf '%x\n' "${1}" 7 | echo "obase=16;${1}" | bc -l 8 | } 9 | 10 | dec2bin() { 11 | echo "obase=2;${1}" | bc -l 12 | } 13 | 14 | hex2dec() { 15 | # echo "$((0x$1))" 16 | echo "ibase=16;${1^^}" | bc -l 17 | } 18 | 19 | hex2bin() { 20 | echo "obase=2;ibase=16;${1^^}" | bc -l 21 | } 22 | 23 | bin2dec() { 24 | echo "ibase=2;${1}" | bc -l 25 | } 26 | 27 | bin2hex() { 28 | echo "obase=16;ibase=2;${1}" | bc -l 29 | } 30 | 31 | rom2dec() { 32 | # https://rosettacode.org/wiki/Roman_numerals/Decode#UNIX_Shell 33 | local -A romans=( [M]="1000" [D]="500" [C]="100" [L]="50" [X]="10" [V]="5" [I]="1" ) 34 | while [[ -n "${1}" ]]; do 35 | local rnum="${1^^}" n="0" prev="0" 36 | for (( i = ${#rnum}-1; i >= 0; i-- )); do 37 | local a="${romans[${rnum:$i:1}]}" 38 | if [[ "${a}" -lt "${prev}" ]]; then 39 | (( n -= a )) 40 | else 41 | (( n += a)) 42 | fi 43 | prev="${a}" 44 | done 45 | echo -n "${n} " 46 | shift 47 | done 48 | echo 49 | } 50 | 51 | dec2rom() { 52 | # https://rosettacode.org/wiki/Roman_numerals/Encode#UNIX_Shell 53 | local values=( 1000 900 500 400 100 90 50 40 10 9 5 4 1 ) 54 | local roman=( [1000]=M [900]=CM [500]=D [400]=CD [100]=C [90]=XC [50]=L [40]=XL [10]=X [9]=IX [5]=V [4]=IV [1]=I ) 55 | while [[ -n "${1}" ]]; do 56 | local num="${1}" 57 | local nvmber="" 58 | for value in "${values[@]}"; do 59 | while (( num >= value )); do 60 | nvmber+="${roman[value]}" 61 | (( num -= value )) 62 | done 63 | done 64 | echo -n "${nvmber} " 65 | shift 66 | done 67 | echo 68 | } 69 | 70 | is_numeric() { 71 | [[ "${1}" =~ ^[-|+]?[0-9]+([.][0-9]+)?$ ]] 72 | } 73 | 74 | is_integer() { 75 | [[ "${1}" =~ ^[-|+]?[0-9]+?$ ]] 76 | } 77 | 78 | is_float() { 79 | [[ "${1}" =~ ^[-|+]?[0-9]+[.][0-9]+?$ ]] 80 | } 81 | 82 | in_range() { 83 | [[ "${#}" -ne "3" ]] && \ 84 | echo -ne "\n\tUsage: ${FUNCNAME[0]} min max num\n\n" >&2 && \ 85 | return 1 86 | [[ "${3}" -ge "${1}" && "${3}" -le "${2}" ]] 87 | } 88 | 89 | between() { 90 | [[ "${#}" -ne "3" ]] && \ 91 | echo -ne "\n\tUsage: ${FUNCNAME[0]} lbound ubound check\n\n" >&2 && \ 92 | return 1 93 | (( $3 >= $1 && $3 <= $2 )) 94 | } 95 | 96 | calc() { 97 | echo "scale=2;${*}"| bc -l 98 | } 99 | 100 | max() { 101 | printf "%d\n" "${@}" | sort -rn | head -1 102 | } 103 | 104 | min() { 105 | printf "%d\n" "${@}" | sort -n | head -1 106 | } 107 | 108 | avg() { 109 | local i=0 sum=0 myusage="\n\tUsage: ${FUNCNAME[0]} #1 #2 #3...\n\n" 110 | die() { echo -ne "${myusage}" >&2; return 1; } 111 | [[ -z "${*}" ]] && { die; return $?; } 112 | while [[ -n "${*}" ]]; do 113 | is_numeric "${1}" || { die; return $?; } 114 | (( i++ )) 115 | sum="$(calc "${sum} + ${1}")" 116 | shift 117 | done 118 | printf "%.2f\n" "$(calc "${sum} / ${i}")" 119 | } 120 | 121 | sqrt() { 122 | echo "scale=2;sqrt(${1})"| bc -l 123 | } 124 | 125 | sqr() { 126 | echo "scale=2;${1}^2"| bc -l 127 | } 128 | 129 | cbd() { 130 | echo "scale=2;${1}^3"| bc -l 131 | } 132 | 133 | pwr() { 134 | echo "scale=2;${1}^${2}"| bc -l 135 | } 136 | 137 | prcnt() { 138 | [[ "${#}" -ne "2" ]] && \ 139 | echo -ne "\n\tUsage: ${FUNCNAME[0]} #percent #number\n\n" >&2 && \ 140 | return 1 141 | echo "scale=2;(${1}*${2})/100" | bc -l 142 | } 143 | 144 | # Trigonometric functions 145 | # https://advantage-bash.blogspot.com/2012/12/trignometry-calculator.html 146 | sin() { 147 | echo "scale=2;s(${1})" | bc -l 148 | } 149 | 150 | cos() { 151 | echo "scale=2;c(${1})" | bc -l 152 | } 153 | 154 | tan() { 155 | echo "scale=2;s(${1})/c(${1})" | bc -l 156 | } 157 | 158 | csc() { 159 | echo "scale=2;1/s(${1})" | bc -l 160 | } 161 | 162 | sec() { 163 | echo "scale=2;1/c(${1})" | bc -l 164 | } 165 | 166 | ctn() { 167 | echo "scale=2;c(${1})/s(${1})" | bc -l 168 | } 169 | 170 | asin() { 171 | if (( $(echo "${1} == 1" | bc -l) )); then 172 | echo "90" 173 | elif (( $(echo "${1} < 1" | bc -l) )); then 174 | echo "scale=2;a(sqrt((1/(1-(${1}^2)))-1))" | bc -l 175 | elif (( $(echo "${1} > 1" | bc -l) )); then 176 | echo "error" 177 | fi 178 | } 179 | 180 | acos() { 181 | if (( $(echo "${1} == 0" | bc -l) )); then 182 | echo "90" 183 | elif (( $(echo "${1} <= 1" | bc -l) )); then 184 | echo "scale=2;a(sqrt((1/(${1}^2))-1))" | bc -l 185 | elif (( $(echo "${1} > 1" | bc -l) )); then 186 | echo "error" 187 | fi 188 | } 189 | 190 | atan() { 191 | echo "scale=2;a(${1})" | bc -l 192 | } 193 | 194 | acot() { 195 | echo "scale=2;a(1/${1})" | bc -l 196 | } 197 | 198 | asec() { 199 | echo "scale=2;a(sqrt((${1}^2)-1))" | bc -l 200 | } 201 | 202 | acsc() { 203 | echo "scale=2;a(1/(sqrt(${1}^2)-1))" | bc -l 204 | } 205 | -------------------------------------------------------------------------------- /dot.files/.bashrc.d/stdlib/readme.org: -------------------------------------------------------------------------------- 1 | #+title: bash lib 2 | #+author: michaeltd 3 | #+date: <2020-10-24 Sat> 4 | 5 | stdl for bash? Yeah sure, I'll take one of those, WCPGW(tm)! 6 | 7 | On a more serious note this is what happened when I've realised 8 | I didn't have a distance converter under my fingertips. 9 | 10 | *** Files 11 | - crypto.bash 12 | #+begin_src shell 13 | source crypto.bash 14 | gen_uuid # 7B5CBAC8-F263-A887-C93B-81515DDB0FA9 15 | gen_rnum 16 # 6579993046607616 16 | gen_pass 16 # }u]=J2Q^O$f-XcUm 17 | #+end_src 18 | 19 | - distance.bash 20 | #+begin_src shell 21 | source distance.bash 22 | kph2mph 300 # 186.41 23 | in2cm 5 # 12.7 24 | #+end_src 25 | 26 | - mass.bash 27 | #+begin_src shell 28 | source mass.bash 29 | kg2lb 10 # 22.05 30 | lb2kg 10 # 4.53 31 | #+end_src 32 | 33 | - math.bash 34 | #+begin_src shell 35 | source math.bash 36 | avg 1 2 3 4 5 6 7 8 9 # 5 37 | max 1 2 3 4 5 # 5 38 | min 1 2 3 4 5 # 1 39 | #+end_src 40 | 41 | - string.bash 42 | #+begin_src shell 43 | source string.bash 44 | split a.weird.file.name.txt . # a weird file name txt 45 | trim ' Hello World ! ' # 'Hello World !' 46 | #+end_src 47 | 48 | - temp.bash 49 | #+begin_src shell 50 | source temp.bash 51 | c2f 0 # 32.0 52 | f2c 0 # -17.77 53 | #+end_src 54 | 55 | - time.bash 56 | #+begin_src shell 57 | source time.bash 58 | time_diff -d 20201025 20201024 # 1 59 | time_diff -h 20201025 20201024 # 24 60 | time_diff -m 20201025 20201024 # 1440 61 | time_diff -s 20201025 20201024 # 86400 62 | #+end_src 63 | 64 | *** Usage 65 | #+begin_src shell 66 | # In ~${HOME}/.bashrc~ : 67 | [[ -d "/path/to/stdlib" ]] && for file in "/path/to/stdlib"/*.bash; do source "${file}"; done 68 | #+end_src 69 | -------------------------------------------------------------------------------- /dot.files/.bashrc.d/stdlib/string.bash: -------------------------------------------------------------------------------- 1 | # 2 | # string related functions 3 | #shellcheck shell=bash disable=SC2048,SC2086,SC2046,SC2005,SC2059 4 | 5 | ascii2bin() { 6 | # https://unix.stackexchange.com/questions/98948/ascii-to-binary-and-binary-to-ascii-conversion-tools 7 | echo -n $* | while IFS= read -r -n1 char 8 | do 9 | echo "obase=2; $(printf '%d' "'$char")" | bc | tr -d '\n' 10 | echo -n " " 11 | done 12 | printf "\n" 13 | } 14 | 15 | bin2ascii() { 16 | chrbin() { 17 | echo $(printf \\$(echo "ibase=2; obase=8; $1" | bc)) 18 | } 19 | for bin in $* 20 | do 21 | chrbin $bin | tr -d '\n' 22 | done 23 | printf "\n" 24 | } 25 | 26 | is_ucase(){ 27 | [[ "${1}" == "${1^^}" ]] 28 | } 29 | 30 | is_lcase(){ 31 | [[ "${1}" == "${1,,}" ]] 32 | } 33 | 34 | split() { 35 | # from pure-bash-bible 36 | # Usage: split "string" "delimiter" 37 | IFS=$'\n' read -d "" -ra arr <<< "${1//${2}/$'\n'}" 38 | printf "%s\n" "${arr[*]}" 39 | } 40 | 41 | 2lower_case() { 42 | printf '%s\n' "${*,,}" 43 | } 44 | 45 | 2upper_case() { 46 | printf '%s\n' "${*^^}" 47 | } 48 | 49 | alphabetic_only() { 50 | printf "%s\n" "${*//[![:alpha:]]}" 51 | } 52 | 53 | alphanumeric_only() { 54 | printf "%s\n" "${*//[![:alnum:]]}" 55 | } 56 | 57 | digits_only() { 58 | printf "%s\n" "${*//[![:digit:]]}" 59 | } 60 | 61 | remove_spaces() { 62 | # https://stackoverflow.com/questions/13659318/how-to-remove-space-from-string 63 | # echo "${@}"|sed 's/ //g' 64 | # pure-bash-bible 65 | # shopt -s extglob # Allow extended globbing 66 | # var=" lakdjsf lkadsjf " 67 | # echo "${var//+([[:space:]])/}" 68 | # shopt -u extglob 69 | 70 | shopt -s extglob # Allow extended globbing 71 | printf "%s\n" "${*//+([[:space:]])/}" 72 | shopt -u extglob 73 | } 74 | 75 | trim() { 76 | # # https://stackoverflow.com/questions/369758/how-to-trim-whitespace-from-a-bash-variable 77 | # local var="$*" 78 | # # remove leading whitespace characters 79 | # var="${var#"${var%%[![:space:]]*}"}" 80 | # # remove trailing whitespace characters 81 | # var="${var%"${var##*[![:space:]]}"}" 82 | # echo -n "$var" 83 | 84 | local var="${*}" 85 | # remove leading whitespace characters 86 | var="${var#"${var%%[![:space:]]*}"}" 87 | # remove trailing whitespace characters 88 | var="${var%"${var##*[![:space:]]}"}" 89 | printf "%s\n" "${var}" 90 | } 91 | 92 | left_pad() { 93 | # https://stackoverflow.com/questions/369758/how-to-trim-whitespace-from-a-bash-variable 94 | # local var="$*" 95 | # remove leading whitespace characters 96 | # var="${@#"${@%%[![:space:]]*}"}" 97 | # remove trailing whitespace characters 98 | # var="${var%"${var##*[![:space:]]}"}" 99 | # echo -n "$var" 100 | printf "%s\n" "${@#"${@%%[![:space:]]*}"}" 101 | } 102 | 103 | right_pad() { 104 | # https://stackoverflow.com/questions/369758/how-to-trim-whitespace-from-a-bash-variable 105 | # local var="$*" 106 | # remove leading whitespace characters 107 | # var="${var#"${var%%[![:space:]]*}"}" 108 | # remove trailing whitespace characters 109 | # var="${var%"${var##*[![:space:]]}"}" 110 | # echo -n "$var" 111 | printf "%s\n" "${@%"${@##*[![:space:]]}"}" 112 | } 113 | -------------------------------------------------------------------------------- /dot.files/.bashrc.d/stdlib/temp.bash: -------------------------------------------------------------------------------- 1 | # 2 | # Temperature conversions celsius - fahrenheit - kelvin 3 | #shellcheck shell=bash 4 | 5 | c2f() { 6 | printf "%.2f\n" "$(echo "scale=2;(${1} * 1.8) + 32"|bc -ql)" 7 | } 8 | 9 | c2k() { 10 | printf "%.2f\n" "$(echo "scale=2;${1} + 273.15"|bc -ql)" 11 | } 12 | 13 | f2c() { 14 | printf "%.2f\n" "$(echo "scale=2;(${1} - 32) / 1.8"|bc -ql)" 15 | } 16 | 17 | f2k() { 18 | printf "%.2f\n" "$(echo "scale=2;$(f2c "${1}") + 273.15"|bc -ql)" 19 | } 20 | 21 | k2c() { 22 | printf "%.2f\n" "$(echo "scale=2;${1} - 273.15"|bc -ql)" 23 | } 24 | 25 | k2f() { 26 | printf "%.2f\n" "$(echo "scale=2;((9/5) * $(k2c "${1}")) + 32"|bc -ql)" 27 | } 28 | -------------------------------------------------------------------------------- /dot.files/.bashrc.d/stdlib/time.bash: -------------------------------------------------------------------------------- 1 | # 2 | # date, time related functions 3 | #shellcheck shell=bash disable=SC2120,SC2119 4 | 5 | is_date() { 6 | [[ -z "${1}" ]] && return 1 # apparently `date -d ""` echoes today's day and returns 0 7 | date -d "${1}" &> /dev/null 8 | } 9 | 10 | is_epoch() { 11 | date -d "@${1}" &> /dev/null 12 | } 13 | 14 | # https://www.unix.com/tips-and-tutorials/31944-simple-date-time-calulation-bash.html 15 | time_diff() { 16 | case "${1}" in 17 | -s) shift; local -r sec="1";; 18 | -m) shift; local -r sec="60";; 19 | -h) shift; local -r sec="$((60 * 60))";; 20 | -d) shift; local -r sec="$((60 * 60 * 24))";; 21 | *) local -r sec="$((60 * 60 * 24))";; 22 | esac 23 | if is_date "${1}" && is_date "${2}"; then 24 | local -r ep1="$(date -d "$1" "+%s")" ep2="$(date -d "$2" "+%s")" 25 | local -r sec_diff="$((ep2 - ep1))" 26 | if ((sec_diff < 0)); then local -r mult=-1; else local -r mult=1; fi 27 | echo "$((sec_diff * mult / sec))" 28 | else 29 | echo -ne "Usage: ${FUNCNAME[0]} [-s|-m|-h|-d(default)] date1 date2.\n" >&2 30 | return 1 31 | fi 32 | } 33 | 34 | epoch_diff() { 35 | if [[ "${#}" -eq "2" ]] && is_epoch "${1}" && is_epoch "${2}"; then 36 | local -r diff="$((($1-$2)/(60*60*24)))" 37 | if ((diff < 0)); then local -r mult=-1; else local -r mult=1; fi 38 | echo "$((mult * diff))" 39 | else 40 | echo -ne "Usage: ${FUNCNAME[0]} epoch1 epoch2.\n" >&2 41 | return 1 42 | fi 43 | } 44 | 45 | date_diff() { 46 | if [[ "${#}" -eq "2" ]] && is_date "${1}" && is_date "${2}"; then 47 | epoch_diff "$(date -d "${1}" +%s)" "$(date -d "${2}" +%s)" 48 | else 49 | echo -ne "Usage: ${FUNCNAME[0]} date1 date2.\n" >&2 50 | return 1 51 | fi 52 | } 53 | 54 | unix_epoch() { 55 | if [[ -n "${1}" ]]; then 56 | date -d "${1}" +%s 57 | else 58 | date -u +%s 59 | fi 60 | } 61 | 62 | epoch2date() { 63 | date -d "@${1-$(unix_epoch)}" "+%F" 64 | } 65 | 66 | epoch2time() { 67 | date -d "@${1-$(unix_epoch)}" "+%T" 68 | } 69 | 70 | epoch2datetime() { 71 | date -d "@${1-$(unix_epoch)}" "+%F %T" 72 | } 73 | 74 | week_day() { 75 | date -d "@${1:-$(unix_epoch)}" "+%u" 76 | } 77 | 78 | leap_year() { 79 | # https://en.wikipedia.org/wiki/Leap_year 80 | # if (year is not divisible by 4) then (it is a common year) 81 | # else if (year is not divisible by 100) then (it is a leap year) 82 | # else if (year is not divisible by 400) then (it is a common year) 83 | # else (it is a leap year) 84 | # https://stackoverflow.com/questions/3220163/how-to-find-leap-year-programatically-in-c/11595914#11595914 85 | # https://www.timeanddate.com/date/leapyear.html 86 | # https://medium.freecodecamp.org/test-driven-development-what-it-is-and-what-it-is-not-41fa6bca02a2 87 | 88 | if [[ -z "${1}" ]]; then 89 | echo -ne "Usage: ${FUNCNAME[0]} #year\n" >&2 90 | return 2 91 | else 92 | if (($1 % 4 != 0)); then return 1 93 | elif (($1 % 100 != 0)); then return 0 94 | elif (($1 % 400 != 0)); then return 1 95 | else return 0 96 | fi 97 | fi 98 | } 99 | 100 | last_dom() { 101 | local y m 102 | if [[ -n "${1}" ]] && is_date "${1}"; then 103 | y="$(date -d "${1}" +%Y)" 104 | m="$(date -d "${1}" +%m)" 105 | else 106 | echo -ne "Usage: ${FUNCNAME[0]} iso_date (ie: YYYY-MM-DD, eg: date +%F)\n" >&2 107 | return 2 108 | fi 109 | 110 | case "${m}" in 111 | "01"|"03"|"05"|"07"|"08"|"10"|"12") echo "31";; 112 | "02") leap_year "${y}" && echo "29" || echo "28";; 113 | "04"|"06"|"09"|"11") echo "30";; 114 | esac 115 | } 116 | -------------------------------------------------------------------------------- /dot.files/.bashrc.d/xx_misc.bash: -------------------------------------------------------------------------------- 1 | # 2 | # general bash options 3 | #shellcheck shell=bash disable=SC1090 4 | 5 | # Window size sanity check 6 | shopt -s checkwinsize 7 | 8 | # pandoc bash completion 9 | # eval "$(pandoc --bash-completion)" 10 | 11 | # No more Ctrl-s Ctrl-q nonsence 12 | eval "$(stty -ixon)" 13 | 14 | # https://twitter.com/gumnos/status/1117146713289121797 15 | # And a couple bash options to control how history is stored: 16 | export HISTCONTROL="ignoreboth" # "ignorespace:ignoredups" 17 | # export HISTIGNORE="gal:gst:gdf:gfc:gpl:mc:htop:bashtop:tmux*:mutt:jobs:fg:up:cd:ll:ls:exit:su\ -l:fixel:ytdl*:bash:startx" 18 | export HISTIGNORE="ytdl*" 19 | 20 | export HISTSIZE=999999 21 | export HISTFILESIZE=999999 22 | 23 | # append to the history file, don't overwrite it 24 | shopt -s histappend 25 | 26 | # and keep synced: 27 | # export PROMPT_COMMAND='history -a' 28 | 29 | # Load helper functions 30 | stdlib="$(dirname "$(realpath "${BASH_SOURCE[0]}")")/stdlib" 31 | # Load files from ~/.bashrc.d/.stdlib 32 | if [[ -d "${stdlib}" ]]; then 33 | for file in "${stdlib}"/*.bash; do 34 | source "${file}" 35 | done 36 | fi 37 | # Clean up stdlib temp var 38 | unset stdlib 39 | -------------------------------------------------------------------------------- /dot.files/.config/compiz/compiz.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # /usr/local/bin/compiz.sh Compiz startup script. 4 | 5 | # No double sourcing 6 | type rcm &>/dev/null || . ~/.bashrc.d/30_functions.bash 7 | 8 | source /etc/os-release # Distro details. 9 | case "${ID}" in # Start Compiz 10 | "gentoo") # Gentoo Solution 11 | # compiz-manager & 12 | fusion-icon -f &;; 13 | "devuan") # Devuan solution 14 | compiz --replace "${@}" &;; 15 | *) # Others 16 | # emerald --replace & 17 | # compiz-manager --replace & 18 | compiz --replace "${@}" &;; 19 | esac 20 | 21 | # ~/.config/polybar/launch.sh 22 | # polybar example 2> /dev/null & 23 | # polybar -qr topbar 2> /dev/null & 24 | # ~/.config/polybar/launch.sh 25 | 26 | # rcm 0 compiz-boxmenu-daemon 27 | 28 | rcm 9 tint2 -c ~/.config/tint2/panel 29 | 30 | #nice -n 9 tint2 -c ~/.config/tint2/taskbar & 31 | 32 | # rcm 9 wicd-gtk -t 33 | 34 | # rcm 9 pasystray -m 100 35 | 36 | PMG="${HOME}/.local/bin/pimp_my_gui.bash" 37 | if [ -x "${PMG}" ]; then # If spice ... 38 | "${PMG}" & # ... spice things up 39 | fi 40 | 41 | sleep 999d # Wait 42 | -------------------------------------------------------------------------------- /dot.files/.config/compiz/compizconfig/Default.ini: -------------------------------------------------------------------------------- 1 | [decoration] 2 | as_command = emerald --replace 3 | 4 | [core] 5 | as_active_plugins = core;ccp;move;resize;place;decoration;png;text;regex;mousepoll;resizeinfo;commands;imgjpeg;put;svg;ring;wobbly;cube;animation;rotate;animationaddon;3d;expo; 6 | as_texture_filter = 2 7 | s0_refresh_rate = 30 8 | as_close_window_key = q 9 | as_raise_window_button = Disabled 10 | as_lower_window_button = Disabled 11 | as_unmaximize_window_key = Disabled 12 | as_minimize_window_key = z 13 | as_maximize_window_key = Disabled 14 | as_window_menu_key = space 15 | as_show_desktop_key = d 16 | as_toggle_window_shaded_key = Disabled 17 | as_toggle_window_maximized_key = x 18 | s0_lighting = true 19 | 20 | [put] 21 | as_put_pointer_key = Disabled 22 | 23 | [rotate] 24 | as_initiate_button = Button3 25 | as_rotate_left_key = Left 26 | as_rotate_right_key = Right 27 | as_rotate_left_window_key = Left 28 | as_rotate_right_window_key = Right 29 | as_rotate_to_1_key = 1 30 | as_rotate_to_2_key = 2 31 | as_rotate_to_3_key = 3 32 | as_rotate_to_4_key = 4 33 | 34 | [cube] 35 | as_unfold_key = Down 36 | s0_images = 37 | s0_skydome = true 38 | s0_skydome_image = /home/paperjam/Pictures/dPic/r/nature/ddmus4im33m21.png 39 | s0_skydome_gradient_start_color = #ffffffff 40 | s0_skydome_gradient_end_color = #000000ff 41 | s0_color = #000000ff 42 | s0_inactive_opacity = 50.000000 43 | 44 | [ring] 45 | as_next_key = Disabled 46 | as_prev_key = Disabled 47 | as_next_all_key = Tab 48 | as_prev_all_key = Tab 49 | 50 | [commands] 51 | as_run_command0_key = r 52 | as_run_command1_key = F1 53 | as_run_command2_key = e 54 | as_run_command3_key = Print 55 | as_run_command4_key = F5 56 | as_command0 = rofi -show run 57 | as_command1 = terminology 58 | as_command2 = gentoo 59 | as_command3 = xfce4-screenshooter 60 | as_command4 = xterm -hold -e bashpass tdm.pgp 61 | as_command6 = kill -15 -1 62 | as_run_command6_key = l 63 | as_run_command5_key = l 64 | as_command5 = xscreensaver-command -lock 65 | as_command7 = ~/.local/bin/sndvol + 66 | as_command8 = ~/.local/bin/sndvol - 67 | as_run_command7_key = equal 68 | as_run_command8_key = minus 69 | as_run_command9_key = F2 70 | as_run_command10_key = F3 71 | as_command9 = firefox 72 | as_command10 = emacsclient -a emacs -c 73 | 74 | [place] 75 | s0_mode = 4 76 | s0_workarounds = false 77 | 78 | [fade] 79 | 80 | [opacify] 81 | 82 | [obs] 83 | 84 | [expo] 85 | as_deform = 2 86 | as_multioutput_mode = 1 87 | as_expo_edge = 88 | as_expo_key = e 89 | as_exit_button = Disabled 90 | 91 | [3d] 92 | s0_bevel_topleft = false 93 | s0_bevel_topright = false 94 | s0_manual_only = false 95 | s0_max_window_space = 5 96 | s0_min_cube_size = 80 97 | 98 | [cubeaddon] 99 | s0_draw_top = false 100 | s0_draw_bottom = false 101 | s0_unfold_deformation = false 102 | s0_deform_caps = false 103 | s0_auto_zoom = false 104 | s0_zoom_manual_only = false 105 | s0_top_scale = false 106 | s0_bottom_scale = false 107 | s0_top_aspect = false 108 | s0_bottom_aspect = false 109 | s0_top_clamp = false 110 | s0_bottom_clamp = false 111 | 112 | [shift] 113 | as_next_key = Disabled 114 | as_initiate_key = Disabled 115 | as_terminate_button = Disabled 116 | as_prev_key = Disabled 117 | as_next_all_key = Tab 118 | as_prev_all_key = Tab 119 | s0_hide_all = true 120 | 121 | [crashhandler] 122 | as_wm_cmd = fusion-icon &> /dev/null & 123 | 124 | [switcher] 125 | as_next_key = Disabled 126 | as_next_all_key = Tab 127 | as_prev_key = Disabled 128 | as_prev_all_key = Tab 129 | 130 | -------------------------------------------------------------------------------- /dot.files/.config/compiz/compizconfig/config: -------------------------------------------------------------------------------- 1 | [general] 2 | profile = 3 | integration = true 4 | 5 | -------------------------------------------------------------------------------- /dot.files/.config/compton.conf: -------------------------------------------------------------------------------- 1 | # Shadow 2 | shadow = false; 3 | no-dnd-shadow = true; 4 | no-dock-shadow = true; 5 | clear-shadow = true; 6 | shadow-radius = 7; 7 | shadow-offset-x = -7; 8 | shadow-offset-y = -7; 9 | # shadow-opacity = 0.7; 10 | # shadow-red = 0.0; 11 | # shadow-green = 0.0; 12 | # shadow-blue = 0.0; 13 | shadow-exclude = [ "name = 'Notification'", "class_g = 'Conky'", "class_g = 'conky'", "class_g = 'Notify-osd'", "class_g = 'Cairo-clock'" ]; 14 | # shadow-exclude = "n:e:Notification"; 15 | shadow-ignore-shaped = false; 16 | # shadow-exclude-reg = "x10+0+0"; 17 | # xinerama-shadow-crop = true; 18 | 19 | # Opacity 20 | menu-opacity = 1; 21 | inactive-opacity = 0.75; 22 | active-opacity = 1; 23 | frame-opacity = 0.80; 24 | inactive-opacity-override = false; 25 | alpha-step = 0.06; 26 | # inactive-dim = 0.2; 27 | # inactive-dim-fixed = true; 28 | # blur-background = true; 29 | # blur-background-frame = true; 30 | blur-kern = "3x3box" 31 | # blur-kern = "5,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1" 32 | # blur-background-fixed = true; 33 | blur-background-exclude = [ "window_type = 'dock'", "window_type = 'desktop'" , "window_type = 'override'" ]; 34 | # opacity-rule = [ "80:class_g = 'URxvt'" ]; 35 | opacity-rule = [ "90:class_g = 'Emacs'", "85:class_g = 'Sakura'", "85:class_g = 'XTerm'", "85:class_g = 'URxvt'", "85:class_g = 'UXTerm'", "85:class_g = 'st-256color'" ]; 36 | 37 | # Fading 38 | fading = true; 39 | # fade-delta = 30; 40 | fade-in-step = 0.1; 41 | fade-out-step = 0.1; 42 | # no-fading-openclose = true; 43 | fade-exclude = []; 44 | 45 | # Other 46 | backend = "xrender" 47 | mark-wmwin-focused = true; 48 | mark-ovredir-focused = true; 49 | # use-ewmh-active-win = true; 50 | detect-rounded-corners = true; 51 | detect-client-opacity = true; 52 | refresh-rate = 0; 53 | vsync = "none"; 54 | dbe = false; 55 | paint-on-overlay = true; 56 | # sw-opti = true; 57 | # unredir-if-possible = true; 58 | # unredir-if-possible-delay = 5000; 59 | # unredir-if-possible-exclude = [ ]; 60 | focus-exclude = [ "class_g = 'Cairo-clock'", "class_g = 'Conky'", "class_g = 'conky'" ]; 61 | detect-transient = true; 62 | detect-client-leader = true; 63 | invert-color-include = [ ]; 64 | # resize-damage = 1; 65 | 66 | # GLX backend 67 | # glx-no-stencil = true; 68 | glx-copy-from-front = false; 69 | # glx-use-copysubbuffermesa = true; 70 | # glx-no-rebind-pixmap = true; 71 | glx-swap-method = "undefined"; 72 | # glx-use-gpushader4 = true; 73 | 74 | # Window type settings 75 | wintypes: 76 | { 77 | tooltip = { fade = true; shadow = false; opacity = 0.75; focus = true; }; 78 | }; 79 | -------------------------------------------------------------------------------- /dot.files/.config/i3/config: -------------------------------------------------------------------------------- 1 | # This file has been auto-generated by i3-config-wizard(1). 2 | # It will not be overwritten, so edit it as you like. 3 | # 4 | # Should you change your keyboard layout some time, delete 5 | # this file and re-run i3-config-wizard(1). 6 | # 7 | 8 | # i3 config file (v4) 9 | # 10 | # Please see https://i3wm.org/docs/userguide.html for a complete reference! 11 | 12 | set $mod Mod4 13 | 14 | # Font for window titles. Will also be used by the bar unless a different font 15 | # is used in the bar {} block below. 16 | font pango:Source Code Pro 8 17 | 18 | # This font is widely installed, provides lots of unicode glyphs, right-to-left 19 | # text rendering and scalability on retina/hidpi displays (thanks to pango). 20 | #font pango:DejaVu Sans Mono 8 21 | 22 | # Before i3 v4.8, we used to recommend this one as the default: 23 | # font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1 24 | # The font above is very space-efficient, that is, it looks good, sharp and 25 | # clear in small sizes. However, its unicode glyph coverage is limited, the old 26 | # X core fonts rendering does not support right-to-left and this being a bitmap 27 | # font, it doesn’t scale on retina/hidpi displays. 28 | 29 | # Use Mouse+$mod to drag floating windows to their wanted position 30 | floating_modifier $mod 31 | 32 | # kill focused window 33 | bindsym $mod+Shift+q kill 34 | # bindsym Control+q kill 35 | 36 | # start dmenu (a program launcher) 37 | # bindsym $mod+d exec dmenu_run 38 | # bindsym $mod+r exec rofi -show drun 39 | bindsym $mod+r exec dsbexec 40 | # bindsym $mod+e exec xterm -e mc 41 | # There also is the (new) i3-dmenu-desktop which only displays applications 42 | # shipping a .desktop file. It is a wrapper around dmenu, so you need that 43 | # installed. 44 | # bindsym $mod+d exec --no-startup-id i3-dmenu-desktop 45 | 46 | bindsym $mod+Tab exec rofi -show window 47 | # bindsym $mod+l exec ~/.local/bin/xlock.sh 48 | # bindsym $mod+l exec metalock -t NomadBSD -f 'Droid Sans 12' 49 | # bindsym $mod+l exec metalock 50 | bindsym $mod+l exec xscreensaver-command -lock 51 | #bindsym $mod+shift+l exit 52 | bindsym $mod+Up exec ~/.local/bin/sndvol + 53 | bindsym $mod+Down exec ~/.local/bin/sndvol - 54 | bindsym Print exec xfce4-screenshooter 55 | 56 | # enable floating mode for all Xdialog windows (xprop) 57 | for_window [class="Xdialog"] floating enable 58 | for_window [class="Gtkdialog"] floating enable 59 | for_window [class="Xmessage"] floating enable 60 | for_window [class="XCalendar"] floating enable 61 | for_window [class="XCalc"] floating enable 62 | for_window [class="Xarchiver"] floating enable 63 | for_window [class="electrum"] floating enable 64 | for_window [class="Audacious"] floating enable 65 | for_window [class="Audacity"] floating enable 66 | for_window [class="Pavucontrol"] floating enable 67 | for_window [class="Xscreensaver-demo"] floating enable 68 | for_window [class="FlightGear*"] floating enable 69 | for_window [class="osgViewer"] floating enable 70 | for_window [class="Bitcoin-Qt"] floating enable 71 | for_window [class="Clamtk"] floating enable 72 | for_window [class="Gentoo"] floating enable 73 | for_window [class="monero-core"] floating enable 74 | for_window [class="libreoffice-startcenter"] floating enable 75 | for_window [class="GParted"] floating enable 76 | for_window [class="Gnome*"] floating enable 77 | for_window [class="Ccgo"] floating enable 78 | for_window [class="Basicwin"] floating enable 79 | for_window [class="Gnubg"] floating enable 80 | for_window [title="Xboard"] floating enable 81 | for_window [class="Ristretto"] floating enable 82 | for_window [class="Zenity"] floating enable 83 | for_window [class="Yad"] floating enable 84 | for_window [class="org-michael-*"] floating enable 85 | for_window [class="Wireshark"] floating enable 86 | for_window [class="net-sourceforge-squirrel_sql-client-Main"] floating enable 87 | for_window [class="DbVisualizer"] floating enable 88 | for_window [class="Codelite"] floating enable 89 | for_window [class="Gvim"] floating enable 90 | for_window [class="Denemo"] floating enable 91 | for_window [class="Thunar"] floating enable 92 | for_window [class="KeePassXC"] floating enable 93 | for_window [title="bashrun"] floating enable 94 | for_window [class="dsbexec"] floating enable 95 | for_window [class="Plank"] floating enable 96 | for_window [class="tint2"] floating enable 97 | 98 | bindsym $mod+Left workspace prev 99 | bindsym $mod+Right workspace next 100 | 101 | # change focus 102 | # bindsym $mod+j focus left 103 | # bindsym $mod+k focus down 104 | # bindsym $mod+l focus up 105 | # bindsym $mod+semicolon focus right 106 | 107 | # alternatively, you can use the cursor keys: 108 | bindsym $mod+Control+Left focus left 109 | bindsym $mod+Control+Down focus down 110 | bindsym $mod+Control+Up focus up 111 | bindsym $mod+Control+Right focus right 112 | 113 | # move focused window 114 | # bindsym $mod+Shift+j move left 115 | # bindsym $mod+Shift+k move down 116 | # bindsym $mod+Shift+l move up 117 | # bindsym $mod+Shift+colon move right 118 | 119 | # alternatively, you can use the cursor keys: 120 | bindsym $mod+Shift+Left move left 121 | bindsym $mod+Shift+Down move down 122 | bindsym $mod+Shift+Up move up 123 | bindsym $mod+Shift+Right move right 124 | 125 | # split in horizontal orientation 126 | bindsym $mod+h split h 127 | 128 | # split in vertical orientation 129 | bindsym $mod+v split v 130 | 131 | # enter fullscreen mode for the focused container 132 | bindsym $mod+f fullscreen toggle 133 | 134 | # change container layout (stacked, tabbed, toggle split) 135 | bindsym $mod+s layout stacking 136 | bindsym $mod+w layout tabbed 137 | bindsym $mod+e layout toggle split 138 | 139 | # toggle tiling / floating 140 | bindsym $mod+Shift+space floating toggle 141 | 142 | # change focus between tiling / floating windows 143 | bindsym $mod+space focus mode_toggle 144 | 145 | # focus the parent container 146 | bindsym $mod+a focus parent 147 | 148 | # focus the child container 149 | #bindsym $mod+d focus child 150 | 151 | # Default workspace layout 152 | workspace_layout tabbed 153 | 154 | # Define names for default workspaces for which we configure key bindings later on. 155 | # We use variables to avoid repeating the names in multiple places. 156 | # set $ws0 "0: " 157 | # set $ws1 "1: " 158 | # set $ws2 "2: " 159 | # set $ws3 "3: " 160 | # set $ws4 "4: " 161 | # set $ws5 "5: " 162 | # set $ws6 "6: " 163 | # set $ws7 "7: " 164 | # set $ws8 "8: " 165 | # set $ws9 "9: " 166 | 167 | set $ws0 "0: var" 168 | set $ws1 "1: term" 169 | set $ws2 "2: serf" 170 | set $ws3 "3: code" 171 | set $ws4 "4: file" 172 | set $ws5 "5: media" 173 | set $ws6 "6: office" 174 | set $ws7 "7: chat" 175 | set $ws8 "8: image" 176 | set $ws9 "9: config" 177 | 178 | # start a terminal 179 | # bindsym $mod+Return exec i3-sensible-terminal 180 | bindsym $mod+F10 workspace $ws0; exec gdutils 181 | bindsym $mod+F1 workspace $ws1; exec i3-sensible-terminal -e tmux 182 | bindsym $mod+F2 workspace $ws2; exec firefox 183 | bindsym $mod+F3 workspace $ws3; exec emacs 184 | bindsym $mod+F4 workspace $ws4; exec i3-sensible-terminal -e mc 185 | bindsym $mod+F5 workspace $ws5; exec vlc 186 | bindsym $mod+F6 workspace $ws6; exec ooffice || libreoffice 187 | bindsym $mod+F7 workspace $ws7; exec hexchat 188 | bindsym $mod+F8 workspace $ws8; exec ristretto 189 | bindsym $mod+F9 workspace $ws9; exec pavucontrol 190 | 191 | bindsym $mod+Shift+F10 workspace $ws0; exec gentoo-systemtools.bash 192 | bindsym $mod+Shift+F1 workspace $ws1; exec sakura -e tmux || terminology -e tmux || xfce4-terminal -e tmux 193 | bindsym $mod+Shift+F2 workspace $ws2; exec seamonkey 194 | bindsym $mod+Shift+F3 workspace $ws3; exec codelite 195 | bindsym $mod+Shift+F4 workspace $ws4; exec gentoo 196 | bindsym $mod+Shift+F5 workspace $ws5; exec audacious 197 | bindsym $mod+Shift+F7 workspace $ws7; exec i3-sensible-terminal 198 | bindsym $mod+Shift+F8 workspace $ws8; exec gimp 199 | bindsym $mod+Shift+F9 workspace $ws9; exec xscreensaver-demo 200 | 201 | # bindsym $mod+control+0 workspace $ws0 202 | # bindsym $mod+control+1 workspace $ws1 203 | # bindsym $mod+control+2 workspace $ws2 204 | # bindsym $mod+control+3 workspace $ws3 205 | # bindsym $mod+control+4 workspace $ws4 206 | # bindsym $mod+control+5 workspace $ws5 207 | # bindsym $mod+control+6 workspace $ws6 208 | # bindsym $mod+control+7 workspace $ws7 209 | # bindsym $mod+control+8 workspace $ws8 210 | # bindsym $mod+control+9 workspace $ws9 211 | 212 | # switch to workspace 213 | bindsym $mod+0 workspace $ws0 214 | bindsym $mod+1 workspace $ws1 215 | bindsym $mod+2 workspace $ws2 216 | bindsym $mod+3 workspace $ws3 217 | bindsym $mod+4 workspace $ws4 218 | bindsym $mod+5 workspace $ws5 219 | bindsym $mod+6 workspace $ws6 220 | bindsym $mod+7 workspace $ws7 221 | bindsym $mod+8 workspace $ws8 222 | bindsym $mod+9 workspace $ws9 223 | 224 | # move focused container to workspace 225 | bindsym $mod+Shift+0 move container to workspace $ws0 226 | bindsym $mod+Shift+1 move container to workspace $ws1 227 | bindsym $mod+Shift+2 move container to workspace $ws2 228 | bindsym $mod+Shift+3 move container to workspace $ws3 229 | bindsym $mod+Shift+4 move container to workspace $ws4 230 | bindsym $mod+Shift+5 move container to workspace $ws5 231 | bindsym $mod+Shift+6 move container to workspace $ws6 232 | bindsym $mod+Shift+7 move container to workspace $ws7 233 | bindsym $mod+Shift+8 move container to workspace $ws8 234 | bindsym $mod+Shift+9 move container to workspace $ws9 235 | 236 | # reload the configuration file 237 | bindsym $mod+Shift+c reload 238 | # restart i3 inplace (preserves your layout/session, can be used to upgrade i3) 239 | bindsym $mod+Shift+r restart 240 | # exit i3 (logs you out of your X session) 241 | bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'Do you really want to exit i3?' -b 'Exit i3 ' 'i3-msg exit'" 242 | bindsym $mod+Shift+l exec "i3-nagbar -t warning -m 'Do you really want to exit i3?' -b 'Exit i3 ' 'i3-msg exit'" 243 | 244 | # resize window (you can also use the mouse for that) 245 | mode "  " { 246 | # These bindings trigger as soon as you enter the resize mode 247 | 248 | # Pressing left will shrink the window’s width. 249 | # Pressing right will grow the window’s width. 250 | # Pressing up will shrink the window’s height. 251 | # Pressing down will grow the window’s height. 252 | # bindsym j resize shrink width 10 px or 10 ppt 253 | # bindsym k resize grow height 10 px or 10 ppt 254 | # bindsym l resize shrink height 10 px or 10 ppt 255 | # bindsym semicolon resize grow width 10 px or 10 ppt 256 | 257 | # same bindings, but for the arrow keys 258 | bindsym Left resize shrink width 10 px or 10 ppt 259 | bindsym Down resize grow height 10 px or 10 ppt 260 | bindsym Up resize shrink height 10 px or 10 ppt 261 | bindsym Right resize grow width 10 px or 10 ppt 262 | 263 | # back to normal: Enter or Escape or $mod+r 264 | bindsym Return mode "default" 265 | bindsym Escape mode "default" 266 | bindsym $mod+d mode "default" 267 | } 268 | 269 | bindsym $mod+d mode "  " 270 | 271 | # Start i3bar to display a workspace bar (plus the system information i3status 272 | # finds out, if available) 273 | bar { 274 | colors { 275 | background #000000 276 | statusline #FFFFFF 277 | separator #333333 278 | focused_workspace #333333 #222222 #FFFFFF 279 | active_workspace #333333 #222222 #FFFFFF 280 | inactive_workspace #000000 #000000 #888888 281 | urgent_workspace #2F343A #900000 #FFFFFF 282 | binding_mode #2F343A #900000 #FFFFFF 283 | } 284 | 285 | workspace_buttons yes 286 | position top 287 | status_command i3status 288 | } 289 | 290 | # https://thomashunter.name/i3-configurator/ 291 | # class border bground text indicator child_border 292 | client.focused #333333 #000000 #FFFFFF #000000 #333333 293 | client.focused_inactive #333333 #5F676A #FFFFFF #484E50 #5F676A 294 | client.unfocused #333333 #222222 #888888 #292D2E #222222 295 | client.urgent #2F343A #900000 #FFFFFF #900000 #900000 296 | client.placeholder #000000 #0C0C0C #FFFFFF #000000 #0C0C0C 297 | client.background #FFFFFF 298 | 299 | focus_follows_mouse no 300 | 301 | # StartUp 302 | # exec_always dsbautostart -a 303 | 304 | exec_always ~/.local/bin/pimp_my_gui.bash 305 | 306 | exec_always bash -c "sleep 10;killall plank tint2" 307 | -------------------------------------------------------------------------------- /dot.files/.config/i3status/config: -------------------------------------------------------------------------------- 1 | # i3status configuration file. 2 | # see "man i3status" for documentation. 3 | 4 | # It is important that this file is edited as UTF-8. 5 | # The following line should contain a sharp s: 6 | # ß 7 | # If the above line is not correctly displayed, fix your editor first! 8 | 9 | general { 10 | output_format = "i3bar" 11 | colors = true 12 | interval = 5 13 | color_good = "#00FF00" 14 | color_degraded = "#FFFF00" 15 | color_bad = "#FF0000" 16 | } 17 | 18 | # order += "ipv6" 19 | order += "wireless _first_" 20 | order += "ethernet _first_" 21 | order += "disk /" 22 | # order += "disk /mnt/data" 23 | # order += "disk /mnt/el" 24 | order += "load" 25 | # order += "memory" 26 | order += "battery all" 27 | order += "volume master" 28 | # order += "tztime NYC" 29 | order += "tztime local" 30 | 31 | wireless _first_ { 32 | format_up = "Wlan: (%quality at %essid) %ip" 33 | format_down = "Wlan: down" 34 | } 35 | 36 | ethernet _first_ { 37 | # if you use %speed, i3status requires root privileges 38 | format_up = "Eth: %ip (%speed)" 39 | format_down = "Eth: down" 40 | } 41 | 42 | disk "/" { 43 | format = "%avail" 44 | } 45 | 46 | disk "/mnt/data" { 47 | format = "%free" 48 | } 49 | 50 | disk "/mnt/el" { 51 | format = "%free" 52 | } 53 | 54 | load { 55 | format = "%1min" 56 | } 57 | 58 | battery all { 59 | format = "%status %percentage %remaining" 60 | } 61 | 62 | volume master { 63 | format = "♪: %volume" 64 | format_muted = "♪: muted (%volume)" 65 | device = "default" 66 | mixer = "Master" 67 | mixer_idx = 0 68 | } 69 | 70 | # tztime NYC { 71 | # # format = "time: %time" 72 | # format = "NYC: %time" 73 | # # format = "%H:%M %Z" 74 | # format_time = "%H:%M %Z" 75 | # timezone = "America/New_York" 76 | # } 77 | 78 | tztime local { 79 | format = "%y-%m-%d %A %H:%M" 80 | } 81 | -------------------------------------------------------------------------------- /dot.files/.config/openbox/autostart: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # These things are run when an Openbox X Session is started. 4 | # You may place a similar script in $HOME/.config/openbox/autostart 5 | # to run user-specific things. 6 | # 7 | 8 | # If you want to use GNOME config tools... 9 | # 10 | #if test -x /usr/libexec/gnome-settings-daemon >/dev/null; then 11 | # /usr/libexec/gnome-settings-daemon & 12 | #elif which gnome-settings-daemon >/dev/null; then 13 | # gnome-settings-daemon & 14 | #fi 15 | 16 | # If you want to use XFCE config tools... 17 | # 18 | #xfce-mcs-manager & 19 | 20 | # No double sourcing 21 | # type rcm &>/dev/null || source ~/.bashrc.d/functions.bash 22 | 23 | # rcm 9 compton 24 | 25 | # A nice status bar (before gui as we'll need that tray) 26 | # nice -n 9 tint2 & 27 | # rcm 9 tint2 -c ~/.config/tint2/taskbar 28 | # nice -n 9 tint2 -c ~/.config/tint2/panel 29 | 30 | # pmg="${HOME}/.local/bin/pimp_my_gui.bash" 31 | # if [ -x "${pmg}" ]; then # if spice, spice things up. 32 | # "${pmg}" 33 | # fi 34 | # unset pmg 35 | -------------------------------------------------------------------------------- /dot.files/.config/openbox/environment: -------------------------------------------------------------------------------- 1 | # 2 | # Set system-wide environment variables here for Openbox 3 | # User-specific variables should be placed in $HOME/.config/openbox/environment 4 | # 5 | 6 | # To set your language for displaying messages and time/date formats, use the following: 7 | #LANG=en_CA.UTF8 8 | 9 | # To set your keyboard layout, you need to modify your X config: 10 | # http://www.google.com/search?q=how+to+set+keyboard+layout+xorg 11 | -------------------------------------------------------------------------------- /dot.files/.config/openbox/scripts/date_menu.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # date-menu.sh 4 | # 5 | # This is in the public domain. Honestly, how can you claim anything to something 6 | # this simple? 7 | # 8 | # Outputs a simple openbox pipe menu to display the date, time, and calendar. 9 | # You need 'date' and 'cal'. You should have these. Additionally, the calendar 10 | # only appears properly formated if you use a mono spaced font. 11 | 12 | # Outputs the selected row from the calender output. 13 | # If you don't use a mono spaced font, you would have to play with spacing here. 14 | # It would probably involve a very complicated mess. Is there a way to force a 15 | # different font per menu? 16 | calRow() { 17 | cal|awk -v row=$1 '{ if (NR==row) { print $0 } }' 18 | } 19 | 20 | # Build the menu 21 | cat << EOFMENU 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | EOFMENU 35 | -------------------------------------------------------------------------------- /dot.files/.config/openbox/scripts/obam.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | # 3 | # OpenBox Applications (Pipe)Menu (C) Biffidus 2008 4 | # 5 | # (only kidding, it's not copyrighted. Do whatever you like with it) 6 | # 7 | # This pipe menu creates an application menu from the .desktop files 8 | # found in many linux distributions. The desktop file must be of type 9 | # Application and specify their Categories. 10 | # 11 | # One or more paths to search may be provided on the command line or 12 | # specified below. The menu structure is derived from the Categories 13 | # attribute and may be customised below with the following keywords: 14 | # 15 | # hide: menu will not be displayed 16 | # collapse: the submenus will be used instead 17 | # 18 | # Any item starting with X- is automatically hidden 19 | 20 | # my $APPSDIR = "/usr/share/applications/ ~/.local/share/applications/ /usr/kde/3.5/share/applications/kde/ ~/.gnome/apps/ ~/.kde/share/apps"; 21 | 22 | my $APPSDIR = "/usr/share/applications/ ~/.local/share/applications/ /usr/local/share/applications/"; 23 | 24 | my %CFG = ( 25 | "Application" => "collapse", 26 | "GTK" => "collapse", 27 | "KDE" => "collapse", 28 | "Qt" => "collapse" ); 29 | 30 | ############################################################################### 31 | 32 | # Hash of hashes 33 | # $Hash{x}->{y} = z 34 | # $Hash{x}{y} 35 | 36 | my %menu; # application details 37 | 38 | # Hash of arrays 39 | # $Hash{$key} = \@Array 40 | # @Array = @{$Hash{$key}} 41 | 42 | my %cat; # apps in each category (hashed lists) 43 | 44 | ################################################### Search for Applications ### 45 | 46 | if ($#ARGV != -1) { 47 | $APPSDIR = join(" ", @ARGV); 48 | } 49 | 50 | print STDERR "Searching $APPSDIR\n"; 51 | 52 | open (APPS, "find ".$APPSDIR." -name '*.desktop' |") || do { 53 | print qq|\n|; 54 | die "could not open $APPSDIR"; 55 | }; 56 | 57 | @FILES = ; 58 | 59 | close APPS; 60 | 61 | ######################################################## Parse Applications ### 62 | 63 | print STDERR "\n### Scanning applications ###\n"; 64 | 65 | foreach $entry (@FILES) { 66 | if (open(DE,$entry) && $entry =~ s|^.*/(.*?)\.desktop|$1|) { 67 | while () { 68 | chomp; 69 | 70 | if (/^(\w+)=([^%]+)/) { 71 | 72 | # populate application details 73 | $menu{$entry}->{$1} = $2; 74 | 75 | # determine category 76 | if ($1 eq "Categories") { 77 | 78 | print STDERR $2 . $entry; 79 | 80 | my @tmp = split(/;/,$2); 81 | 82 | 83 | while ($CFG{$tmp[0]} eq "collapse") { 84 | shift @tmp; 85 | } 86 | 87 | if ($CFG{$tmp[0]} ne "hide" && $tmp[0] !~ /^X-/) { 88 | push @{$cat{$tmp[0]}},$entry; 89 | } 90 | } 91 | } 92 | } 93 | } 94 | } 95 | 96 | ############################################################# Generate Menu ### 97 | 98 | print STDERR "\n### Generating menu ###\n"; 99 | 100 | print "\n"; 101 | 102 | foreach $key (sort keys %cat) { 103 | print qq|

\n|; 104 | 105 | foreach $app (sort @{$cat{$key}}) { 106 | if ($menu{$app}{Type} eq "Application") { 107 | my $Name = $menu{$app}{Name}; 108 | my $Exec = $menu{$app}{Exec}; 109 | print qq| $Exec\n|; 110 | } 111 | } 112 | print " "; 113 | } 114 | 115 | print "\n"; 116 | 117 | print STDERR "Done\n"; 118 | 119 | ############################################################################### 120 | -------------------------------------------------------------------------------- /dot.files/.config/tint2/panel: -------------------------------------------------------------------------------- 1 | #Panel 2 | panel_position = bottom center horizontal 3 | panel_size = 46% 46 4 | panel_items = L 5 | 6 | #Panel Autohide 7 | autohide = 0 8 | autohide_show_timeout = 0 9 | autohide_hide_timeout = 2 10 | autohide_height = 1 11 | strut_policy = minimum 12 | 13 | #Launchers 14 | launcher_item_app = /usr/share/applications/terminology.desktop 15 | launcher_item_app = /home/paperjam/.local/share/applications/mc.desktop 16 | launcher_item_app = /home/paperjam/.local/share/applications/Firefox.desktop 17 | launcher_item_app = /usr/share/applications/emacsclient.desktop 18 | launcher_item_app = /usr/share/applications/codium.desktop 19 | launcher_item_app = /usr/share/applications/codelite.desktop 20 | launcher_item_app = /usr/share/applications/edi.desktop 21 | launcher_item_app = /usr/share/applications/drracket.desktop 22 | launcher_item_app = /usr/share/applications/startlazarus-lazarus.desktop 23 | launcher_item_app = /usr/share/applications/openoffice-startcenter.desktop 24 | launcher_item_app = /usr/share/applications/zzz-gimp.desktop 25 | launcher_item_app = /usr/share/applications/audacious.desktop 26 | launcher_item_app = /usr/share/applications/vlc.desktop 27 | launcher_item_app = /usr/share/applications/pavucontrol.desktop 28 | -------------------------------------------------------------------------------- /dot.files/.config/tint2/taskbar: -------------------------------------------------------------------------------- 1 | # Tint2 config file 2 | # Generated by tintwizard (http://code.google.com/p/tintwizard/) 3 | # For information on manually configuring tint2 see http://code.google.com/p/tint2/wiki/Configure 4 | 5 | # Background definitions 6 | # ID 1 7 | rounded = 0 8 | border_width = 0 9 | background_color = #000000 60 10 | border_color = #FFFFFF 16 11 | 12 | # ID 2 13 | rounded = 2 14 | border_width = 1 15 | background_color = #FFFFFF 40 16 | border_color = #FFFFFF 48 17 | 18 | # ID 3 19 | rounded = 2 20 | border_width = 1 21 | background_color = #FFFFFF 16 22 | border_color = #FFFFFF 68 23 | 24 | # Panel 25 | #panel_items = LTSCB 26 | panel_items = T:S:B:C 27 | panel_monitor = all 28 | #panel_position = bottom center horizontal 29 | panel_position = top center horizontal 30 | panel_size = 100% 30 31 | panel_margin = 0 0 32 | panel_padding = 2 1 2 33 | panel_dock = 0 34 | wm_menu = 1 35 | panel_layer = top 36 | panel_background_id = 1 37 | 38 | # Panel Autohide 39 | autohide = 0 40 | autohide_show_timeout = 0.3 41 | autohide_hide_timeout = 2 42 | autohide_height = 2 43 | strut_policy = follow_size 44 | 45 | # Launcher 46 | launcher_padding = 8 4 4 47 | launcher_background_id = 1 48 | launcher_icon_size = 24 49 | # Specify icon theme names with launcher_icon_theme. 50 | # if you have an XSETTINGS manager running (like xfsettingsd), tint2 will follow your current theme. 51 | # launcher_icon_theme = Faenza-CrunchBang 52 | # Each launcher_item_app must be a full path to a .desktop file 53 | #launcher_item_app = /usr/share/applications/xfce4-run.desktop 54 | #launcher_item_app = /usr/share/applications/xfce4-screenshooter.desktop 55 | #launcher_item_app = /usr/share/applications/menu.desktop 56 | #launcher_item_app = /usr/share/applications/showdesktop.desktop 57 | #launcher_item_app = /usr/share/applications/terminator.desktop 58 | #launcher_item_app = /usr/share/applications/xfce4-file-manager.desktop 59 | #launcher_item_app = /usr/share/applications/gedit.desktop 60 | #launcher_item_app = /usr/share/applications/iceweasel.desktop 61 | 62 | # Taskbar 63 | # enable a text label widget that displays in the tint2 taskbar 64 | taskbar_name = 1 65 | # choose a color for the font that differs from the background 66 | taskbar_name_font_color = #F0F0F0 100 67 | taskbar_mode = single_desktop 68 | taskbar_padding = 2 1 2 69 | taskbar_background_id = 0 70 | taskbar_active_background_id = 0 71 | 72 | # Tasks 73 | urgent_nb_of_blink = 8 74 | task_icon = 1 75 | task_text = 1 76 | task_centered = 1 77 | task_maximum_size = 140 35 78 | task_padding = 6 2 79 | task_background_id = 3 80 | task_active_background_id = 2 81 | task_urgent_background_id = 2 82 | task_iconified_background_id = 3 83 | task_tooltip = 0 84 | 85 | # Task Icons 86 | task_icon_asb = 70 0 0 87 | task_active_icon_asb = 100 0 0 88 | task_urgent_icon_asb = 100 0 0 89 | task_iconified_icon_asb = 70 0 0 90 | 91 | # Fonts 92 | #task_font = sans 7 93 | task_font = SourceCodePro 8 94 | task_font_color = #FFFFFF 68 95 | task_active_font_color = #FFFFFF 83 96 | task_urgent_font_color = #FFFFFF 83 97 | task_iconified_font_color = #FFFFFF 68 98 | font_shadow = 0 99 | 100 | # System Tray 101 | systray = 1 102 | systray_padding = 0 4 5 103 | systray_sort = ascending 104 | systray_background_id = 0 105 | systray_icon_size = 16 106 | systray_icon_asb = 70 0 0 107 | 108 | # Clock 109 | time1_format = %H:%M 110 | #time1_font = sans 8 111 | time1_font = SourceCodePro 8 112 | time2_format = %A %d %B 113 | #time2_font = sans 6 114 | time2_font = SourceCodePro 7 115 | clock_font_color = #FFFFFF 74 116 | clock_padding = 1 0 117 | clock_background_id = 0 118 | clock_rclick_command = orage 119 | 120 | # Tooltips 121 | tooltip_padding = 2 2 122 | tooltip_show_timeout = 0.7 123 | tooltip_hide_timeout = 0.3 124 | tooltip_background_id = 1 125 | #tooltip_font = sans 10 126 | tooltip_font = SourceCodePro 8 127 | tooltip_font_color = #000000 80 128 | 129 | # Mouse 130 | mouse_middle = none 131 | mouse_right = close 132 | mouse_scroll_up = toggle 133 | mouse_scroll_down = iconify 134 | 135 | # Battery 136 | battery = 0 137 | battery_low_status = 10 138 | battery_low_cmd = notify-send "battery low" 139 | battery_hide = 0 140 | #bat1_font = sans 8 141 | #bat2_font = sans 6 142 | bat1_font = SourceCodePro 8 143 | bat2_font = SourceCodePro 7 144 | battery_font_color = #FFFFFF 74 145 | battery_padding = 1 0 146 | battery_background_id = 0 147 | 148 | # End of config 149 | -------------------------------------------------------------------------------- /dot.files/.e16/Init/e16.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | #shellcheck source=/dev/null 4 | 5 | # No double sourcing 6 | type rcm &>/dev/null || . ~/.bashrc.d/30_functions.bash 7 | 8 | # rcm 9 wicd-gtk -t 9 | 10 | # rcm 9 pasystray -a -m 100 11 | 12 | # rcm 9 orage 13 | 14 | PMG="${HOME}/.local/bin/pimp_my_gui.bash" 15 | if [ -x "${PMG}" ]; then # If spice ... 16 | "${PMG}" # Spice things up 17 | fi 18 | -------------------------------------------------------------------------------- /dot.files/.e16/bindings.cfg: -------------------------------------------------------------------------------- 1 | Aclass BUTTONBINDINGS normal 2 | MouseDown A 1 wop * mo ptr 3 | MouseDown SA 1 wop = mo ptr 4 | MouseDouble A 1 wop * shade 5 | MouseDown A 2 wop * sz ptr 6 | MouseDouble A 2 wop * th available 7 | MouseDown A 3 menus show winops.menu 8 | Aclass DESKBINDINGS normal 9 | # Tooltip Clicking your mouse on the desktop will perform 10 | # Tooltip the following actions 11 | #MouseDown - 1 menus show file.menu 12 | # Tooltip Display User Menus 13 | MouseDown C 1 menus show enlightenment.menu 14 | # Tooltip Display Enlightenment Menu 15 | MouseDown 4 1 menus show settings.menu 16 | # Tooltip Display Settings Menu 17 | #MouseDown - 2 menus show enlightenment.menu 18 | MouseDown - 3 menus show enlightenment.menu 19 | # Tooltip Display Enlightenment Menu 20 | MouseDown A 2 menus show windowlist 21 | # Tooltip Display Task List Menu 22 | MouseDown C 2 menus show deskmenu 23 | # Tooltip Display Desktop Menu 24 | MouseDown S 2 menus show groupmenu 25 | # Tooltip Display Group Menu 26 | #MouseDown - 3 menus show settings.menu 27 | # Tooltip Display Settings Menu 28 | MouseDown * 4 desk prev 29 | # Tooltip Go Back a Desktop 30 | MouseDown * 5 desk next 31 | # Tooltip Go Forward a Desktop 32 | Aclass KEYBINDINGS global 33 | KeyDown 4 Next area move 0 1 34 | KeyDown 4 Prior area move 0 -1 35 | # KeyDown 4 Up wop * raise 36 | # KeyDown 4 Down wop * lower 37 | KeyDown 4 Left area move -1 0 38 | KeyDown 4 Right area move 1 0 39 | # KeyDown 4 Tab focus next 40 | KeyDown 4 Tab exec rofi -show window 41 | # KeyDown 4 Tab exec rofi -show window 42 | KeyDown 4 q wop * close 43 | KeyDown 4 space menus show winops.menu 44 | KeyDown 4 x wop * ts available 45 | KeyDown 4 z wop * iconify 46 | KeyDown 4 r exec rofi -show run 47 | KeyDown 4 e exec xterm -e mc 48 | KeyDown 4 v exec pavucontrol -t 3 49 | KeyDown 4 l exec /home/paperjam/.local/bin/xlock.sh 50 | KeyDown 4S l exit logout 51 | KeyDown 4 v exec pavucontrol -t 3 52 | KeyDown 4 F10 exec gdutils 53 | KeyDown 4 F1 exec i3-sensible-terminal || xterm 54 | KeyDown 4 F2 exec firefox 55 | KeyDown 4 F3 exec emacsclient -a emacs -c 56 | KeyDown 4 F4 exec i3-sensible-terminal -e mc 57 | KeyDown 4 F5 exec vlc 58 | KeyDown 4 F6 exec ooffice 59 | KeyDown 4 F7 exec hexchat 60 | KeyDown 4 F8 exec gimp 61 | KeyDown 4 F9 exec pavucontrol 62 | KeyDown 4S F10 exec gentoo-systemtools.bash 63 | KeyDown 4S F1 exec terminology 64 | KeyDown 4S F2 exec seamonkey 65 | KeyDown 4S F3 exec codelite 66 | KeyDown 4S F4 exec gentoo 67 | KeyDown 4S F5 exec audacious 68 | KeyDown 4S F6 exec libreoffice 69 | KeyDown 4S F7 exec i3-sensible-terminal 70 | KeyDown 4S F8 exec ristretto 71 | KeyDown 4S F9 exec xscreensaver-demo 72 | # KeyDown 4 Home exec /home/paperjam/bin/sndvol + 73 | # KeyDown 4 End exec /home/paperjam/bin/sndvol - 74 | KeyDown 4 Up exec /home/paperjam/.local/bin/sndvol + 75 | KeyDown 4 Down exec /home/paperjam/.local/bin/sndvol - 76 | KeyDown CS F1 menus show file.menu 77 | KeyDown CS F2 menus show enlightenment.menu 78 | KeyDown CS F3 menus show settings.menu 79 | KeyDown CS F4 menus show windowlist 80 | KeyDown CA Delete exit logout 81 | KeyDown CA End exit restart 82 | KeyDown CA Home desk arrange size 83 | KeyDown CA Insert exec terminology 84 | KeyDown CA Left desk prev 85 | KeyDown CA Return desk this 86 | KeyDown CA Right desk next 87 | KeyDown CA a button_show all 88 | KeyDown CA b button_show 89 | KeyDown CA c button_show buttons CONFIG* 90 | KeyDown CA f wop * fullscreen 91 | KeyDown CA k wop * kill 92 | KeyDown CA r wop * shade 93 | KeyDown CA s wop * stick 94 | KeyDown A F1 desk goto 0 95 | KeyDown A F2 desk goto 1 96 | KeyDown A F3 desk goto 2 97 | KeyDown A F4 desk goto 3 98 | # KeyDown A F5 desk goto 4 99 | # KeyDown A F6 desk goto 5 100 | # KeyDown A F7 desk goto 6 101 | # KeyDown A F8 desk goto 7 102 | KeyDown A Return wop * zoom 103 | KeyDown - Print exec xfce4-screenshooter 104 | -------------------------------------------------------------------------------- /dot.files/.e16/menus/user_apps.menu: -------------------------------------------------------------------------------- 1 | "User Application List" 2 | "Net" 3 | "Firefox" "/opt/firefox/browser/chrome/icons/default/default16.png" exec "firefox" 4 | "Seamonkey" "/opt/seamonkey/chrome/icons/default/default48.png" exec "seamonkey" 5 | "HexChat" "/usr/share/icons/hicolor/48x48/apps/hexchat.png" exec "hexchat --existing" 6 | "Editors" 7 | "GNU Emacs" "/usr/share/pixmaps/emacs.png" exec "emacsclient -a emacs -c" 8 | "Vim" "/usr/share/icons/hicolor/48x48/apps/gvim.png" exec "xterm -e vim" 9 | "NetBeans IDE 8.2" "/opt/netbeans-8.2/nb/netbeans.png" exec "/bin/sh /opt/netbeans-8.2/bin/netbeans" 10 | "Eclipse" /home/paperjam/opt/photon/icon.xpm exec eclipse 11 | "Terminals" 12 | "Terminology" /usr/share/icons/terminology.png exec "terminology" 13 | "File Managers" 14 | "Thunar File Manager" "/usr/share/icons/hicolor/48x48/apps/Thunar.png" exec thunar 15 | "Double Commander" /opt/doublecmd/doublecmd.png exec doublecmd 16 | "Gentoo" /usr/share/pixmaps/gentoo.png exec gentoo 17 | "Tools" 18 | "gdutils" NULL exec gdutils 19 | "Mediums" 20 | "Volume Controls" "/usr/share/pixmaps/emixer.png" exec "pavucontrol --tab 3" 21 | "The GIMP" /home/paperjam/GNUstep/Library/WindowMaker/CachedPixmaps/gimp.Gimp.xpm exec "gimp" 22 | "Audacious" /usr/share/icons/hicolor/48x48/apps/audacious.png exec "audacious" 23 | "VLC" /home/paperjam/GNUstep/Library/WindowMaker/CachedPixmaps/vlc.Vlc.xpm exec "vlc" 24 | -------------------------------------------------------------------------------- /dot.files/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.Xdefaults 3 | !.Xresources 4 | !.bash_logout 5 | !.bash_profile 6 | !.bashrc 7 | !.gitignore 8 | !.gvimrc 9 | !.muttrc 10 | !.profile 11 | !.tmux.conf 12 | !.toprc 13 | !.vimrc 14 | !.xinitrc 15 | !.xsession 16 | !.Xresources.d/* 17 | !.bashrc.d/* 18 | !.config/* 19 | !.e16/* 20 | !.local/* 21 | -------------------------------------------------------------------------------- /dot.files/.gvimrc: -------------------------------------------------------------------------------- 1 | 2 | if has("gui_running") 3 | " GUI is running or is about to start. 4 | " set lines=25 columns=95 5 | else 6 | " This is console Vim. 7 | if exists("+lines") 8 | " set lines=50 9 | endif 10 | if exists("+columns") 11 | " set columns=100 12 | endif 13 | endif 14 | -------------------------------------------------------------------------------- /dot.files/.local/bin/michaeltd: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Terminal business card v1.0 4 | # 5 | # https://tinyurl.com/create.php?source=create&url=https%3A%2F%2Fraw.githubusercontent.com%2Fmichaeltd%2Fdots%2Fmaster%2Fdot.files%2Fbin%2Fmichaeltd.bash&alias=mtd-card 6 | # Write a nice business card on the terminal. 7 | # 8 | # Font attributes, colors, bg_colors 9 | 10 | readonly reset="$(tput sgr0)" bold="$(tput bold)" dim="$(tput dim)" \ 11 | blink="$(tput blink)" underline="$(tput smul)" end_underline="$(tput rmul)" \ 12 | reverse="$(tput rev)" hidden="$(tput invis)" \ 13 | black="$(tput setaf 0)" red="$(tput setaf 1)" green="$(tput setaf 2)" \ 14 | yellow="$(tput setaf 3)" blue="$(tput setaf 4)" magenta="$(tput setaf 5)" \ 15 | cyan="$(tput setaf 6)" white="$(tput setaf 7)" default="$(tput setaf 9)" \ 16 | bg_black="$(tput setab 0)" bg_red="$(tput setab 1)" bg_green="$(tput setab 2)" \ 17 | bg_yellow="$(tput setab 3)" bg_blue="$(tput setab 4)" bg_magenta="$(tput setab 5)" \ 18 | bg_cyan="$(tput setab 6)" bg_white="$(tput setab 7)" bg_default="$(tput setab 9)" 19 | 20 | # ╭───────────────────────────────────────────────────╮ 21 | # │ │ 22 | # │ Michael Tsouchlarakis / michaeltd │ 23 | # │ │ 24 | # │ Work: tsouchlarakis@gmail.com │ 25 | # │ FOSS: Gentoo Linux avocado. │ 26 | # │ │ 27 | # │ Web: https://michaeltd.netlify.com/ │ 28 | # │ GitLab: https://gitlab.com/michaeltd │ 29 | # │ npm: https://npmjs.com/~michaeltd │ 30 | # │ Toots: https://mastodon.technology/@michaeltd │ 31 | # │ │ 32 | # │ Card: curl -sL tinyurl.com/mick-bcard|sh │ 33 | # │ │ 34 | # ╰───────────────────────────────────────────────────╯ 35 | # 36 | cat < /dev/null && local -ra shrc=( "$(type -P shred 2> /dev/null)" "--zero" "--remove" ) || local -ra shrc=( "$(type -P rm 2> /dev/null)" "-P" "-f" ) 13 | local -r notes_file="${HOME}/.${USER}.${sbn%.*}" 14 | local -r notes_gpg="${notes_file}.gpg" notes_bkp="${notes_file}.bkp" 15 | local -r notes_header=' 16 | :::: ::: ::::::::::::::::::::::::::::::::::::: 17 | :+:+: :+::+: :+: :+: :+: :+: :+: 18 | :+:+:+ +:++:+ +:+ +:+ +:+ +:+ 19 | +#+ +:+ +#++#+ +:+ +#+ +#++:++# +#++:++#++ 20 | +#+ +#+#+#+#+ +#+ +#+ +#+ +#+ 21 | #+# #+#+##+# #+# #+# #+# #+# #+# 22 | ### #### ######## ### ################## 23 | ' 24 | show_header() { clear; type -P lolcat &>/dev/null && echo "${notes_header}"| lolcat || echo "${notes_header}"; } 25 | 26 | usage() { echo -ne "\n Usage: ${sbn} add 'some notes'|rem keyword...|list [keyword]\n\n" >&2; } 27 | 28 | encrypt() { "${pgpc[@]}" "${notes_gpg}" "--encrypt" "${notes_file}" && "${shrc[@]}" {"${notes_file}","${notes_bkp}"} 2> /dev/null; } 29 | 30 | decrypt() { if [[ -e "${notes_gpg}" ]]; then "${pgpc[@]}" "${notes_file}" "--decrypt" "${notes_gpg}"; else echo 'Date|Time|Note' > "${notes_file}"; fi; } 31 | 32 | list() { grep -h "${1}" "${notes_file}" |column -t -s '|' |nl -s ':' -b p[0-9] |"${PAGER}"; } 33 | 34 | rem() { list "${1}"; if [[ "$(read -rp "Delete above entr(y/ies) from notes? [y/N] " r;echo "${r:-N}")" == [Yy]* ]]; then cp -f "${notes_file}" "${notes_bkp}"; grep -hv "${1}" "${notes_bkp}" > "${notes_file}"; fi; } 35 | 36 | add() { echo "$(date +%F\|%T)|${*}" >> "${notes_file}"; } 37 | 38 | case "${1}" in 39 | add |rem |list) show_header; decrypt && "${@}" && encrypt;; 40 | *) show_header; usage; return 1;; 41 | esac 42 | } 43 | 44 | [[ "${BASH_SOURCE[0]}" == "${0}" ]] && main "${@}" 45 | -------------------------------------------------------------------------------- /dot.files/.local/bin/pimp_my_gui.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env -S bash --norc --noprofile 2 | #shellcheck shell=bash source=/dev/null disable=SC1008,SC2096,SC2155 3 | # 4 | # Spice for the desktop 5 | 6 | #link free (S)cript: (D)ir(N)ame, (B)ase(N)ame. 7 | readonly sdn="$(dirname "$(realpath "${BASH_SOURCE[0]}")")" 8 | 9 | # No double sourcing 10 | type -t rcm &>/dev/null || source "${sdn}"/../../.bashrc.d/functions.bash || exit 1 11 | 12 | # Read trough '~/.config/autostart' entries 13 | for i in ~/.config/autostart/*.desktop; do 14 | cat "${i}" | while read -r line; do 15 | if [[ "${line}" =~ ^Exec ]]; then 16 | declare -a myprog=( ${line##Exec=} ) 17 | rcm 9 "${myprog[@]}" 18 | continue 19 | fi 20 | done 21 | done 22 | 23 | unames="$(uname -s)" 24 | 25 | if [[ "${unames}" == "Gentoo" ]]; then 26 | rcm 9 conky -qd 27 | # rcm 9 electrum daemon start 28 | # rcm 9 bitcoind -datadir=/mnt/el/.bitcoin -daemon -server 29 | elif [[ "${unames}" == "Devuan" ]]; then 30 | rcm 9 conky -qd 31 | elif [[ "${unames}" == "Debian" ]]; then 32 | rcm 9 conky -qd 33 | elif [[ "${unames}" == "FreeBSD" ]]; then 34 | rcm 9 conky -qd 35 | else 36 | rcm 9 conky -qd 37 | fi 38 | 39 | unset unames 40 | 41 | # Xfce4 themes 42 | # rcm 9 xfsettingsd --no-daemon --disable-server --no-desktop --sm-client-disable 43 | 44 | # XScreenSaver 45 | # rcm 9 xscreensaver -no-splash 46 | 47 | # Systray network manager applet || wicd-gtk -t 48 | # if type -P nm-applet &> /dev/null; then 49 | # rcm 9 nm-applet 50 | # elif type -P wicd-gtk &> /dev/null; then 51 | # rcm 9 wicd-gtk -t 52 | # fi 53 | -------------------------------------------------------------------------------- /dot.files/.local/bin/showkb.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | #For use with conky 3 | 4 | case "$(xset -q|grep 'LED mask:'| awk '{ print $10 }')" in 5 | "00000002") KBD="EN" ;; 6 | "00001002") KBD="EL" ;; 7 | *) KBD="unknown" ;; 8 | esac 9 | 10 | echo $KBD 11 | -------------------------------------------------------------------------------- /dot.files/.local/bin/sndvol: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env -S bash --norc --noprofile 2 | # 3 | # sndvol - lil script to play around with volume settings 4 | 5 | # Unofficial Bash Strict Mode 6 | set -eo pipefail 7 | IFS=$'\t\n' 8 | 9 | readonly sbn="$(basename "$(realpath "${BASH_SOURCE[0]}")")" 10 | 11 | # Timeout settings for Xdialog, Xmessage 12 | readonly xmto="1" # xmessage timeout is in seconds... 13 | readonly xdto="$((xmto * 1000))" # Xdialog/dialog is in milliseconds. 14 | 15 | # Xdialog/dialog 16 | declare -rx XDIALOG_HIGH_DIALOG_COMPAT=1 XDIALOG_FORCE_AUTOSIZE=1 \ 17 | XDIALOG_INFOBOX_TIMEOUT="${xdto}" XDIALOG_NO_GMSGS=1 \ 18 | DIALOG_OK=0 DIALOG_CANCEL=1 DIALOG_HELP=2 \ 19 | DIALOG_EXTRA=3 DIALOG_ITEM_HELP=4 DIALOG_ESC=255 \ 20 | SIG_NONE=0 SIG_HUP=1 SIG_INT=2 SIG_QUIT=3 SIG_KILL=9 SIG_TERM=15 21 | 22 | main() { 23 | 24 | # Mutexify to avoid process spam 25 | # local -ar pids=( $(pgrep -U "${USER}" -f "${sbn}") ) 26 | # [[ "${#pids[*]}" -gt "1" ]] && return 1 27 | 28 | # Pick a default available dialog impl... 29 | if [[ -x "$(type -P Xdialog)" && -n "${DISPLAY}" ]]; then # Check for X, Xdialog 30 | local -r DIALOG="$(type -P Xdialog)" G=( "0" "0" "${xdto}" ) 31 | elif [[ -x "$(type -P dialog)" && -z "${DISPLAY}" ]]; then 32 | local -r DIALOG="$(type -P dialog)" G=( "0" "0" ) 33 | else 34 | local -r DIALOG='' 35 | fi 36 | 37 | log2err() { 38 | if [[ -x "$(type -P notify-send)" ]]; then 39 | "$(type -P notify-send)" -i audio-card -c notification -t "${xdto}" "${sbn}:" "${*}" 40 | elif [[ -x "${DIALOG}" ]]; then 41 | "${DIALOG}" --title "${sbn}:" --infobox "${*}" "${G[@]}" 42 | elif [[ -x "$(type -P xmessage)" ]]; then 43 | "$(type -P xmessage)" -nearmouse -timeout "${xmto}" "${*}" 44 | else 45 | echo "${sbn}: ${*}" >&2 46 | fi 47 | } 48 | 49 | myusage() { 50 | log2err "Usage: ${sbn} +|-|[0-100]|report" 51 | return 1 52 | } 53 | 54 | case "${1}" in 55 | +|-) vol="$(amixer -c 0 -- sset Master "10dB${1}")";; 56 | *[0-9]) [[ "${1}" =~ ^[0-9]{1,3}$ ]] && (($1 >= 0 && $1 <= 100)) && vol="$(amixer -c 0 -- sset Master "${1}%")";; 57 | report) vol="$(amixer -c 0 -- sget Master)";; 58 | *) myusage;; 59 | esac 60 | 61 | vol="${vol/\]*}"; vol="${vol/*\[}" 62 | 63 | log2err "Master: ${vol}" 64 | } 65 | 66 | [[ "${BASH_SOURCE[0]}" == "${0}" ]] && main "${@}" 67 | -------------------------------------------------------------------------------- /dot.files/.local/bin/template.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #shellcheck disable=SC2034 3 | 4 | readonly script_dir_name="$(dirname "$(realpath "${BASH_SOURCE[0]}")")" 5 | readonly script_base_name="$(basename "$(realpath "${BASH_SOURCE[0]}")")" 6 | readonly script_pid="${$}" 7 | readonly version=1.0 8 | readonly version_text="Boilerplate for new scripts v$version" 9 | readonly options="h o: q v V" 10 | readonly help_text="Usage: $script_base_name [-o ] [-hqvV] []... 11 | 12 | Boilerplate for new scripts 13 | 14 | -o Set an option with a parameter 15 | -h Display this help text and exit 16 | -q Quiet 17 | -v Verbose mode 18 | -V Display version information and exit" 19 | 20 | clean_exit() { 21 | _exit_status=$? 22 | trap - EXIT 23 | info "exiting" 24 | 25 | [ $# -ne 0 ] && { 26 | trap - "$1" 27 | kill -s "$1" -$$ 28 | } 29 | exit "$_exit_status" 30 | } 31 | 32 | error() { 33 | _error=${1:-1} 34 | shift 35 | printf '%s: Error: %s\n' "$script_base_name" "$*" >&2 36 | exit "$_error" 37 | } 38 | 39 | usage() { 40 | [ $# -ne 0 ] && { 41 | exec >&2 42 | printf '%s: %s\n\n' "$script_base_name" "$*" 43 | } 44 | printf '%s\n' "$help_text" 45 | exit ${1:+1} 46 | } 47 | 48 | info() { printf '%s\n' "$*" >&2; } 49 | 50 | version() { printf '%s\n' "$version_text"; exit; } 51 | 52 | # For a given optstring, this function sets the variables 53 | # "option_" to true/false and param_ to its parameter. 54 | parse_options() { 55 | for _opt in $options; do 56 | # The POSIX spec does not say anything about spaces in the 57 | # optstring, so lets get rid of them. 58 | _optstring=$_optstring$_opt 59 | eval "option_${_opt%:}=false" 60 | done 61 | 62 | while getopts ":$_optstring" _opt; do 63 | case $_opt in 64 | :) usage "option '$OPTARG' requires a parameter" ;; 65 | \?) usage "unrecognized option '$OPTARG'" ;; 66 | *) 67 | eval "option_$_opt=true" 68 | [ -n "$OPTARG" ] && eval "param_$_opt=\$OPTARG" 69 | ;; 70 | esac 71 | done 72 | unset _opt _optstring OPTARG 73 | } 74 | 75 | # shellcheck disable=2034,2046 76 | set_defaults() { 77 | # Unofficial Bash Strict Mode 78 | set -euo pipefail 79 | IFS=$'\t\n' 80 | 81 | trap 'clean_exit' EXIT TERM 82 | trap 'clean_exit HUP' HUP 83 | trap 'clean_exit INT' INT 84 | # IFS=' ' 85 | # set -- $(printf '\n \r \t \033') 86 | declare -x nl=$'\n' cr=$'\r' tab=$'\t' esc=$'\033' 87 | # IFS=\ $tab 88 | } 89 | 90 | main() { 91 | set_defaults 92 | parse_options "$@" 93 | shift $((OPTIND-1)) 94 | # If we want to use `getopts` again, this has to be set to 1. 95 | OPTIND=1 96 | 97 | # shellcheck disable=2154 98 | { 99 | $option_h && usage 100 | $option_V && version 101 | $option_q && info() { :; } 102 | $option_o && info "option 'o' has parameter '$param_o'" 103 | $option_v && info "verbose mode is on" 104 | } 105 | 106 | _i=1 107 | 108 | for _file 109 | do 110 | info "operand $_i is '$_file'" 111 | _i=$((_i+1)) 112 | done 113 | 114 | unset _i _file 115 | 116 | [ -t 0 ] || info "stdin is not a terminal" 117 | } 118 | 119 | [[ "${BASH_SOURCE[0]}" == "${0}" ]] && main "$@" 120 | -------------------------------------------------------------------------------- /dot.files/.local/bin/template.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | prog_name=${0##*/} 4 | version=1.0 5 | version_text="Boilerplate for new scripts v$version" 6 | options="h o: q v V" 7 | help_text="Usage: $prog_name [-o ] [-hqvV] []... 8 | 9 | Boilerplate for new scripts 10 | 11 | -o Set an option with a parameter 12 | -h Display this help text and exit 13 | -q Quiet 14 | -v Verbose mode 15 | -V Display version information and exit" 16 | 17 | main() { 18 | set_defaults 19 | parse_options "$@" 20 | shift $((OPTIND-1)) 21 | # If we want to use `getopts` again, this has to be set to 1. 22 | OPTIND=1 23 | 24 | # shellcheck disable=2154 25 | { 26 | $option_h && usage 27 | $option_V && version 28 | $option_q && info() { :; } 29 | $option_o && info "option 'o' has parameter '$param_o'" 30 | $option_v && info "verbose mode is on" 31 | } 32 | 33 | _i=1 34 | for _file do 35 | info "operand $_i is '$_file'" 36 | _i=$((_i+1)) 37 | done 38 | unset _i _file 39 | 40 | [ -t 0 ] || 41 | info "stdin is not a terminal" 42 | } 43 | 44 | ########################################################################## 45 | 46 | # shellcheck disable=2034,2046 47 | set_defaults() { 48 | set -e 49 | trap 'clean_exit' EXIT TERM 50 | trap 'clean_exit HUP' HUP 51 | trap 'clean_exit INT' INT 52 | IFS=' ' 53 | set -- $(printf '\n \r \t \033') 54 | nl=$1 cr=$2 tab=$3 esc=$4 55 | IFS=\ $tab 56 | } 57 | 58 | # For a given optstring, this function sets the variables 59 | # "option_" to true/false and param_ to its parameter. 60 | parse_options() { 61 | for _opt in $options; do 62 | # The POSIX spec does not say anything about spaces in the 63 | # optstring, so lets get rid of them. 64 | _optstring=$_optstring$_opt 65 | eval "option_${_opt%:}=false" 66 | done 67 | 68 | while getopts ":$_optstring" _opt; do 69 | case $_opt in 70 | :) usage "option '$OPTARG' requires a parameter" ;; 71 | \?) usage "unrecognized option '$OPTARG'" ;; 72 | *) 73 | eval "option_$_opt=true" 74 | [ -n "$OPTARG" ] && 75 | eval "param_$_opt=\$OPTARG" 76 | ;; 77 | esac 78 | done 79 | unset _opt _optstring OPTARG 80 | } 81 | 82 | info() { printf %s\\n "$*" >&2; } 83 | version() { printf %s\\n "$version_text"; exit; } 84 | 85 | error() { 86 | _error=${1:-1} 87 | shift 88 | printf '%s: Error: %s\n' "$prog_name" "$*" >&2 89 | exit "$_error" 90 | } 91 | 92 | usage() { 93 | [ $# -ne 0 ] && { 94 | exec >&2 95 | printf '%s: %s\n\n' "$prog_name" "$*" 96 | } 97 | printf %s\\n "$help_text" 98 | exit ${1:+1} 99 | } 100 | 101 | clean_exit() { 102 | _exit_status=$? 103 | trap - EXIT 104 | info "exiting" 105 | 106 | [ $# -ne 0 ] && { 107 | trap - "$1" 108 | kill -s "$1" -$$ 109 | } 110 | exit "$_exit_status" 111 | } 112 | 113 | main "$@" 114 | -------------------------------------------------------------------------------- /dot.files/.local/bin/term_music.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env -S bash --norc --noprofile 2 | #shellcheck disable=SC2034,SC2155,SC2207/ 3 | # 4 | 5 | # Unofficial Bash Strict Mode 6 | set -euo pipefail 7 | IFS=$'\t\n' 8 | 9 | #link free (S)cript: (D)ir(N)ame, (B)ase(N)ame. 10 | readonly sdn="$(dirname "$(realpath "${BASH_SOURCE[0]}")")" \ 11 | sbn="$(basename "$(realpath "${BASH_SOURCE[0]}")")" 12 | 13 | log2err() { echo -ne "${sbn}: ${*}\n" >&2; } 14 | 15 | main() { 16 | local -r myusage="\n\tUsage: ${sbn} [genre]\n\n" \ 17 | uri="file:///mnt/data/Documents/Music" 18 | 19 | local -r pop=( 20 | "${uri}/mark_king/Level-Best" "${uri}/all_saints" "${uri}/avicii" 21 | "${uri}/black_eyed_pees" "${uri}/bruno_mars" "${uri}/daft_punk" 22 | "${uri}/gorillaz" 23 | ) 24 | 25 | local -r rock=( 26 | "${uri}/bad_co" "${uri}/deep_purple" "${uri}/doobie_brothers" 27 | "${uri}/frank_zappa" "${uri}/janis_joplin" "${uri}/jethro_tull" 28 | "${uri}/joe_cocker" "${uri}/led_zeppelin" "${uri}/lenny_kravitz" 29 | "${uri}/the_who" "${uri}/ten_years_after" "${uri}/sting" "${uri}/santana" 30 | ) 31 | 32 | local -r reggae=( 33 | "${uri}/ub40" "${uri}/matisyahu" "${uri}/bob_marley" 34 | ) 35 | 36 | local -r rnb=( 37 | "${uri}/amy_winehouse" "${uri}/blues_brothers" 38 | ) 39 | 40 | local -r jazz=( 41 | "${uri}/bill_evans" "${uri}/cannonball_adderley" "${uri}/charlie_parker" 42 | "${uri}/chick_corea" "${uri}/eddie_gomez" "${uri}/getz_meets_mulligan" 43 | "${uri}/herbie_hancock" "${uri}/john_coltrane" "${uri}/miles_davis" 44 | "${uri}/ron_carter" "${uri}/sarah_vaughan" "${uri}/stanley_clarke/" 45 | "${uri}/marcus_miller/" "${uri}/jaco_pastorius/" "${uri}/esperanza_spalding/" 46 | "${uri}/john_patitucci" "${uri}/victor_wooten" "${uri}/mode_plagal" 47 | ) 48 | 49 | local -r latin=( 50 | "${uri}/irakere" "${uri}/mambo_kings" "${uri}/paco_de_lucia" "${uri}/tito_puente" 51 | ) 52 | 53 | local -r funk=( 54 | "${uri}/average_white_band" "${uri}/blood_sweat_and_tears" 55 | "${uri}/jamiroquai" "${uri}/tower_of_power" "${uri}/chaka_khan" 56 | ) 57 | 58 | local -r classical=( 59 | "${uri}/carl_orff" "${uri}/nikos_skalkotas" "${uri}/vaggelis" 60 | ) 61 | 62 | local -r ost=( 63 | "${uri}/ost/bf" "${uri}/ost/cod" "${uri}/ost/ed" "${uri}/ost/halo" "${uri}/ost/titanfall" 64 | ) 65 | 66 | local -r genres=( pop[@] rock[@] reggae[@] rnb[@] jazz[@] latin[@] funk[@] classical[@] ost[@] ) 67 | 68 | local genre_selection='' selection_type='random' randomnum='' all_artists=() 69 | 70 | if [[ $# -eq 1 ]]; then 71 | if [[ "${genres[*]}" =~ ${1} ]]; then 72 | local selection_type="selected" 73 | local genre_selection="${1^^}" 74 | eval "param_genre=(\"\${$1[@]}\")" 75 | local -ar dir_list=( "${param_genre[@]}" ) 76 | else 77 | for i in "${genres[@]}"; do 78 | local gen_alpha+="${i//[![:alpha:]]} " 79 | done 80 | log2err "${myusage}\t${1} not found.\n\tTry one of: ${gen_alpha}!\n" 81 | return 1 82 | fi 83 | else 84 | # local randomnum="$(shuf -n 1 -i 0-"$((${#genres[*]}-1))")" # shuf not avail on *BSD 85 | local randomnum="$(( RANDOM % ( ${#genres[*]} - 1 ) ))" 86 | local genre_selection="${genres[randomnum]^^}" 87 | local genre_selection="${genre_selection//[![:alpha:]]}" 88 | local -ar dir_list=( "${!genres[randomnum]}" ) 89 | fi 90 | 91 | # is VLC running? 92 | local -ar pids=( $(pgrep -U "${USER}" -f vlc) ) 93 | if [[ "${#pids[*]}" -gt "0" ]]; then 94 | log2err "VLC already playing!\n" 95 | play -q -n synth .8 sine 4100 fade q 0.1 .3 0.1 repeat 3 96 | return 1 97 | else 98 | for dir in "${dir_list[@]}"; do 99 | local all_artists+=( "${dir##*/}" ) 100 | done 101 | log2err "Playing one of:\n$(echo "${all_artists[*]}"|column -t -s $'\t'),\nfrom ${genre_selection} ${selection_type} collection\n" 102 | cvlc --random "${dir_list[@]}" 103 | fi 104 | } 105 | 106 | [[ "${BASH_SOURCE[0]}" == "${0}" ]] && main "${@}" 107 | -------------------------------------------------------------------------------- /dot.files/.local/bin/wallpaper_rotate.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env -S bash --norc --noprofile 2 | # 3 | # Script to go through a directory of background images as wallpapers in a timely fashion 4 | #shellcheck shell=bash source=/dev/null disable=SC1008,SC2096,SC2155,SC2034,SC2154 5 | 6 | # Unofficial Bash Strict Mode 7 | set -eo pipefail 8 | IFS=$'\t\n' 9 | 10 | #link free (S)cript: (D)ir(N)ame, (B)ase(N)ame. 11 | readonly sbn="$(basename "$(realpath "${BASH_SOURCE[0]}")")" 12 | 13 | main() { 14 | # Font attributes, Colors, bg colors 15 | local -r reset="$(tput sgr0)" bold="$(tput bold)" dim="$(tput dim)" blink="$(tput blink)" underline="$(tput smul)" end_underline="$(tput rmul)" reverse="$(tput rev)" hidden="$(tput invis)" \ 16 | black="$(tput setaf 0)" red="$(tput setaf 1)" green="$(tput setaf 2)" yellow="$(tput setaf 3)" blue="$(tput setaf 4)" magenta="$(tput setaf 5)" cyan="$(tput setaf 6)" white="$(tput setaf 7)" default="$(tput setaf 9)" \ 17 | bg_black="$(tput setab 0)" bg_red="$(tput setab 1)" bg_green="$(tput setab 2)" bg_yellow="$(tput setab 3)" bg_blue="$(tput setab 4)" bg_magenta="$(tput setab 5)" bg_cyan="$(tput setab 6)" bg_white="$(tput setab 7)" bg_default="$(tput setab 9)" 18 | 19 | local -ra wpusage=("\n \ 20 | ${bold}Script to rotate backgrounds in wm's with out such options \n \ 21 | like: openbox, wmaker, mwm, ...etc ${reset}\n\n \ 22 | ${underline}Usage${end_underline}: ${green}${sbn}${reset} & from a terminal or your startup scripts.\n\n \ 23 | Options may be: \n \ 24 | ${green}${sbn}${reset} ${magenta}add${reset} ${yellow}path1${reset} [${yellow}path2${reset} ...] - add director(y/ies) \n \ 25 | ${green}${sbn}${reset} ${magenta}rem${reset} ${yellow}path1${reset} [${yellow}path2${reset} ...] - remove director(y/ies) \n \ 26 | ${green}${sbn}${reset} ${magenta}delay${reset} ${yellow}#(min)${reset} - set interval in minutes (int)\n \ 27 | ${green}${sbn}${reset} ${magenta}showimg${reset} [${yellow}#${reset}] - display previous image number (int) \n \ 28 | ${green}${sbn}${reset} ${magenta}help${reset} - this message\n\n") 29 | 30 | local -ra feh=( "feh" "--bg-scale" ) wmsetbg=( "wmsetbg" ) fvwm_root=( "fvwm-root" ) \ 31 | fbsetbg=( "fbsetbg" ) bsetbg=( "bsetbg" ) hsetroot=( "hsetroot" "-fill" ) xsetbg=( "xsetbg" ) 32 | local -a bgsrs=( feh[@] wmsetbg[@] fvwm_root[@] fbsetbg[@] bsetbg[@] hsetroot[@] xsetbg[@] ) \ 33 | dirs=( "${HOME}/Pictures" ) wps=() 34 | local -r wprc="${HOME}/.$(basename "${BASH_SOURCE[0]//.bash/.rc}")" \ 35 | wplg="${HOME}/.$(basename "${BASH_SOURCE[0]//.bash/.log}")" 36 | local bgsr="" \ 37 | wait="5" 38 | 39 | # bash version info check 40 | if (( "${BASH_VERSINFO[0]}" < 4 )); then 41 | echo -ne "${red}Error:${reset} For this to work you'll need bash major version no less than 4.\n" >&2 42 | return 1 43 | fi 44 | 45 | # Find a setter 46 | for (( x = 0; x < "${#bgsrs[@]}"; x++ )); do 47 | if type -P "${!bgsrs[x]:0:1}" &> /dev/null; then 48 | bgsr="${x}" 49 | break # Break on first match. 50 | fi 51 | done 52 | 53 | # Quit on no setter 54 | if [[ -z "${bgsr}" ]]; then 55 | echo -ne "${wpusage[*]}\n" 56 | echo -ne "\n\n ${red}Error:${reset} No valid wallpaper setter found. Install \"${bold}feh${reset}\" and try again.\n" >&2 57 | return 1 58 | fi 59 | 60 | # If there's no readable settings file, write it... 61 | if [[ ! -r "${wprc}" ]]; then 62 | echo -ne "wait=${wait}\ndirs=( ${dirs[*]} )\n" > "${wprc}" 63 | fi 64 | 65 | # and read it. 66 | source "${wprc}" 67 | 68 | add() { 69 | while [[ "$#" -gt "0" ]]; do 70 | if [[ -d "${1}" ]]; then 71 | DIRS+=( "${1}" ) 72 | else 73 | echo -ne "${yellow}Warning:${reset} \"${bold}${1}${reset}\" is not a directory.\n" >&2 && return 1 74 | fi 75 | shift 76 | done 77 | echo -ne "wait=${wait}\ndirs=( ${dirs[*]} )\n" > "${wprc}" 78 | } 79 | 80 | rem(){ 81 | while [[ "$#" -gt "0" ]]; do 82 | for (( i = 0; i < "${#dirs[@]}"; i++ )); do 83 | if [[ "${dirs[i]}" == "${1}" ]]; then 84 | unset 'dirs[i]' 85 | fi 86 | done 87 | shift 88 | done 89 | echo -ne "wait=${wait}\ndirs=( ${dirs[*]} )\n" > "${wprc}" 90 | } 91 | 92 | delay() { 93 | if [[ "$#" -eq "1" ]]; then 94 | wait=${1} 95 | if [[ "${wait}" =~ ^[0-9]+$ && "${wait}" -gt "0" ]]; then 96 | echo -ne "wait=${wait}\ndirs=( ${dirs[*]} )\n" > "${wprc}" 97 | else 98 | echo -ne "${yellow}Warning:${reset} \"${bold}${wait}${reset}\" is not a valid time construct.\nProvide an integer as interval in minutes\n" >&2 99 | return 1 100 | fi 101 | else 102 | echo -ne "${yellow}Warning:${reset} delay takes a numeric argument.\n" >&2 103 | return 1 104 | fi 105 | } 106 | 107 | showimg() { 108 | tail -n "${1:-1}" "${wplg}"|head -n 1|awk '{print $NF}' 109 | } 110 | 111 | showlog() { 112 | if [[ -n "${PAGER}" ]]; then 113 | "${PAGER}" "${wplg}" 114 | else 115 | echo -ne "${yellow}Warning:${reset} Set a valid \${PAGER} first.\n" >&2 116 | return 1 117 | fi 118 | } 119 | 120 | showvars() { 121 | echo -ne "\tRotate delay is: ${wait}m.\n\tImage directories are:\n" 122 | for d in "${dirs[@]}"; do 123 | echo -ne "\t\t${d}\n" 124 | done 125 | } 126 | 127 | trimlog() { 128 | local -r tempdate="$(date +%F)" 129 | sed -i '' "/^${tempdate}/!d" "${wplg}" 130 | } 131 | 132 | # If options, proccess, else rotate things 133 | if [[ "${#}" -ne "0" ]]; then 134 | case "${1}" in 135 | add|rem|delay|showimg|showlog|showvars|trimlog) "${@}";; 136 | *) echo -ne "${wpusage[*]}" >&2; return 1;; 137 | esac 138 | else 139 | while :; do 140 | # re-read rc (to pick up config updates). 141 | source "${wprc}" 142 | 143 | # fill a WallPaperS list 144 | for d in "${dirs[@]}"; do 145 | for p in "${d}"/*; do 146 | local fe="${p:(-4)}" 147 | if [[ "${fe,,}" == ".jpg" || "${fe,,}" == ".png" ]]; then 148 | local -a wps+=( "${p}" ) 149 | fi 150 | done 151 | done 152 | 153 | # Get path and name of image as a selected WallPaper 154 | # local wp="${wps[$(shuf -n 1 -i 0-"$(( ${#wps[*]} - 1 ))")]}" # shuf not available in *BSD 155 | local wp="${wps[$(( RANDOM % ${#wps[*]} ))]}" 156 | 157 | # Set wallpaper, write log, wait 158 | "${!bgsrs[bgsr]}" "${wp}" >> "${wplg}" 2>&1 159 | 160 | echo "$(date +%F\ %T) ${!bgsrs[bgsr]} ${wp}" >> "${wplg}" 161 | 162 | sleep "$(( ${wait} * 60))" 163 | done 164 | fi 165 | } 166 | 167 | [[ "${BASH_SOURCE[0]}" == "${0}" ]] && main "${@}" 168 | -------------------------------------------------------------------------------- /dot.files/.local/bin/xlock.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env -S bash --norc --noprofile 2 | # 3 | # r/unixporn 4 | 5 | main() { 6 | 7 | local -r xsspid="$(pgrep -U "${USER}" -f "xscreensaver")" 8 | 9 | if type -P i3lock &>/dev/null && [[ -z "${xsspid}" ]]; then 10 | local -r image="/tmp/${$}.i3lock.png" blurtype="0x05" 11 | scrot -z "${image}" 12 | convert "${image}" -blur "${blurtype}" "${image}" 13 | i3lock -i "${image}" 14 | rm "${image}" 15 | elif type -P xscreensaver-command &>/dev/null && [[ -n "${xsspid}" ]]; then 16 | xscreensaver-command -lock 17 | else 18 | printf "No suitable screen locker found!\n" >&2 19 | return 1 20 | fi 21 | } 22 | 23 | [[ "${BASH_SOURCE[0]}" == "${0}" ]] && main 24 | -------------------------------------------------------------------------------- /dot.files/.local/sbin/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !cronjobs/* 3 | !dist_check.bash 4 | !dist_cleanup.bash 5 | !dist_hosts.bash 6 | !dist_upgrade.bash 7 | !dist_wrldchck.bash 8 | !update_backups.bash 9 | !update_cleanup.bash 10 | !update_mirror.bash 11 | -------------------------------------------------------------------------------- /dot.files/.local/sbin/.old/old.cleanup-bkps.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # de-clutter backups 4 | 5 | # Load explicitly for non interactive shells 6 | source /home/paperjam/.bashrc.d/.stdl/time.sh 7 | source /home/paperjam/.bashrc.d/.stdl/string.sh 8 | 9 | printf "= $(basename ${BASH_SOURCE[0]}) =\n" 10 | 11 | BKPD="/mnt/el/Documents/BKP/LINUX" 12 | 13 | FLISTS=( "sys.tar.gz.asc" "usr.tar.gz.asc" "enc.tar.gz.asc" ) 14 | 15 | if [[ -d "${BKPD}" ]]; then 16 | cd "${BKPD}" 17 | for (( x = 0; x < ${#FLISTS[@]}; x++ )); do 18 | declare -a FILES=( $(ls -t *.${FLISTS[$x]} 2> /dev/null) ) 19 | for (( y = 0; y < ${#FILES[@]}; y++ )); do 20 | if (( y > 6 )); then 21 | FN="${FILES[$y]}" 22 | for PART in $(split "${FN}" .);do 23 | if epochtodatetime ${PART} &> /dev/null; then 24 | DP="${PART}" 25 | break 26 | fi 27 | done 28 | ETDT="$(epochtodatetime ${DP})" 29 | printf "${bold}${blue}will remove:${reset} %s, created: %s.\n" "${red}${FN}${reset}" "${underline}${green}${ETDT}${reset}${end_underline}" 30 | printf "${bold}rm -v %s${reset}: " "${red}${FN}${reset}" 31 | rm -v "${FN}" 32 | fi 33 | done 34 | done 35 | else 36 | printf "${BKPD} not found\n" >&2 37 | fi 38 | -------------------------------------------------------------------------------- /dot.files/.local/sbin/.old/update-enc-bkp.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # ~/sbin/update-enc-bkp.sh 4 | # Backup users 5 | 6 | # Full path executables 7 | NICEC=$(which nice) 8 | TARCM=$(which tar) 9 | GPG2C=$(which gpg2) 10 | 11 | ELDIR="/mnt/el/Documents/BKP/LINUX" 12 | 13 | ARCHV="${ELDIR}/$(date +%s).$(date +%y%m%d).enc.tar.gz" 14 | 15 | printf "= $(basename ${BASH_SOURCE[0]}) =\n" 16 | 17 | if [[ -d "${ELDIR}" ]]; then 18 | "${NICEC}" -n 19 \ 19 | "${TARCM}" -czf "${ARCHV}" /home/paperjam/.gnupg/* /home/paperjam/.ssh/* /home/paperjam/.ngrok2/* /home/paperjam/.config/filezilla/* /home/paperjam/.config/hexchat/* 20 | 21 | else 22 | printf "${ELDIR} not found" >&2 23 | fi 24 | -------------------------------------------------------------------------------- /dot.files/.local/sbin/.old/update-sys-bkp.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # ~/sbin/update-sys-bkp.sh 4 | # Backup system 5 | 6 | # Full path executables 7 | NICEC=$(which nice) 8 | TARCM=$(which tar) 9 | GPG2C=$(which gpg2) 10 | 11 | ELDIR="/mnt/el/Documents/BKP/LINUX" 12 | 13 | ARCHV="${ELDIR}/$(date +%s).$(date +%y%m%d).sys.tar.gz" 14 | 15 | printf "= $(basename ${BASH_SOURCE[0]}) =\n" 16 | 17 | if [[ -d "${ELDIR}" ]]; then 18 | "${NICEC}" -n 19 \ 19 | "${TARCM}" -cz /boot/grub/themes/ /boot/grub/grub.cfg /etc/ /usr/share/xsessions/ /usr/share/WindowMaker/ /var/www/ | \ 20 | "${GPG2C}" --batch --yes --quiet --recipient "tsouchlarakis@gmail.com" --trust-model always --output "${ARCHV}.asc" --encrypt 21 | else 22 | printf "${ELDIR} not found" >&2 23 | fi 24 | -------------------------------------------------------------------------------- /dot.files/.local/sbin/.old/update-usr-bkp.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # ~/sbin/update-usr-bkp.sh 4 | # Backup users 5 | 6 | # Full path executables 7 | NICEC=$(which nice) 8 | TARCM=$(which tar) 9 | GPG2C=$(which gpg2) 10 | 11 | ELDIR="/mnt/el/Documents/BKP/LINUX" BKPXC="/home/paperjam/.bkp.excludes.txt" 12 | 13 | ARCHV="${ELDIR}/$(date +%s).$(date +%y%m%d).usr.tar.gz" 14 | 15 | printf "= $(basename ${BASH_SOURCE[0]}) =\n" 16 | 17 | if [[ -d "${ELDIR}" && -r "${BKPXC}" ]]; then 18 | "${NICEC}" -n 19 \ 19 | "${TARCM}" --exclude-from="${BKPXC}" -cz /home/paperjam/git/ /home/paperjam/Documents/ | \ 20 | "${GPG2C}" --batch --yes --quiet --recipient "tsouchlarakis@gmail.com" --trust-model always --output "${ARCHV}.asc" --encrypt 21 | else 22 | printf "${ELDIR} not found or ${BKPXC} not readable." >&2 23 | fi 24 | -------------------------------------------------------------------------------- /dot.files/.local/sbin/.old/update_bkps.bash.old: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # ~/sbin/update_bkps.bash 4 | # Backup sensitive files, user files, system files. 5 | 6 | echo -ne " -- $(basename "${BASH_SOURCE[0]}") --\n" 7 | 8 | declare -r ELDIR="/mnt/el/Documents/BKP/LINUX" UTB="paperjam" 9 | 10 | declare -r EXC="/home/${UTB}/.bkp.exclude" 11 | 12 | declare -r RCPNT="tsouchlarakis@gmail.com" 13 | 14 | # Full path executables, no aliases 15 | declare -ra \ 16 | NICEC=( "$(type -P nice)" "-n" "19" ) \ 17 | TARCM=( "$(type -P tar)" "--create" "--gzip" "--exclude-from=${EXC}" \ 18 | "--exclude-backups" "--one-file-system" ) \ 19 | GPG2C=( "$(type -P gpg2)" "--batch" "--yes" "--quiet" "--recipient" \ 20 | "${RCPNT}" "--trust-model" "always" "--output" ) 21 | 22 | #shellcheck disable=SC2034 23 | declare -ra \ 24 | ENC=( "/home/${UTB}/.gnupg/." \ 25 | "/home/${UTB}/.ssh/." \ 26 | "/home/${UTB}/.ngrok2/." \ 27 | "/home/${UTB}/.config/filezilla/." \ 28 | "/home/${UTB}/.config/hexchat/." \ 29 | "/home/${UTB}/.putty/." ) \ 30 | USR=( "/home/${UTB}/git/." \ 31 | "/home/${UTB}/Documents/." ) \ 32 | SYS=( "/boot/grub/." \ 33 | "/etc/." \ 34 | "/usr/share/xsessions/." \ 35 | "/usr/share/WindowMaker/." \ 36 | "/var/www/." ) 37 | 38 | declare -ra BKP=( ENC[@] USR[@] SYS[@] ) \ 39 | ARCHV=( "enc.tar.gz" "usr.tar.gz" "sys.tar.gz" ) 40 | 41 | declare -r EP="$(date +%s)" DT="$(date +%Y%m%d)" TM="$(date +%H%M%S)" 42 | 43 | if [[ -d "${ELDIR}" && "${EUID}" -eq "0" ]]; then 44 | for ((i = 0; i < ${#ARCHV[*]}; i++ )); do 45 | if [[ ${ARCHV[i]} =~ ^enc.* ]]; then 46 | ARCFL="${ELDIR}/${HOSTNAME}.${DT}.${TM}.${EP}.${ARCHV[i]}" 47 | #shellcheck disable=SC2086 48 | time "${NICEC[@]}" "${TARCM[@]}" "--file" "${ARCFL}" ${!BKP[i]} 49 | else 50 | ENCFL="${ELDIR}/${HOSTNAME}.${DT}.${TM}.${EP}.${ARCHV[i]}.pgp" 51 | #shellcheck disable=SC2086 52 | time "${NICEC[@]}" "${TARCM[@]}" ${!BKP[i]}|"${GPG2C[@]}" "${ENCFL}" "--encrypt" 53 | fi 54 | done 55 | else 56 | echo -ne "${ELDIR} not found or root access requirements not met.\n" >&2 57 | exit 1 58 | fi 59 | -------------------------------------------------------------------------------- /dot.files/.local/sbin/add_user.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | if [[ -z "${1}" || "${EUID}" -ne "0" ]]; then 4 | echo -ne "Usage: sudo ${0##*/} 'new username'\n" >&2 5 | exit 1 6 | fi 7 | 8 | useradd -m -U -s /bin/bash -G wheel,floppy,uucp,audio,cdrom,video,cdrw,usb,users,wireshark,games "${1}" 9 | -------------------------------------------------------------------------------- /dot.files/.local/sbin/cronjobs/daily/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michaeltd/dots/502ddc087b7201bcd61602db2ad393884fa52f19/dot.files/.local/sbin/cronjobs/daily/.keep -------------------------------------------------------------------------------- /dot.files/.local/sbin/cronjobs/daily/00-update_backups.bash: -------------------------------------------------------------------------------- 1 | ../../update_backups.bash -------------------------------------------------------------------------------- /dot.files/.local/sbin/cronjobs/daily/10-update_cleanup.bash: -------------------------------------------------------------------------------- 1 | ../../update_cleanup.bash -------------------------------------------------------------------------------- /dot.files/.local/sbin/cronjobs/daily_maint: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | 4 | sdn="$(dirname "$(realpath "$0")")" 5 | ds="${sdn}/daily" 6 | if [ -d "${ds}" ]; then 7 | time { 8 | for scpt in "${ds}/"*.bash; do 9 | time "${scpt}" 10 | done 11 | } 12 | fi 13 | -------------------------------------------------------------------------------- /dot.files/.local/sbin/cronjobs/monthly/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michaeltd/dots/502ddc087b7201bcd61602db2ad393884fa52f19/dot.files/.local/sbin/cronjobs/monthly/.keep -------------------------------------------------------------------------------- /dot.files/.local/sbin/cronjobs/monthly/00-dist_upgrade.bash: -------------------------------------------------------------------------------- 1 | ../../dist_upgrade.bash -------------------------------------------------------------------------------- /dot.files/.local/sbin/cronjobs/monthly/10-check_integrity.bash: -------------------------------------------------------------------------------- 1 | ../../dist_check.bash -------------------------------------------------------------------------------- /dot.files/.local/sbin/cronjobs/monthly/20-dist_cleanup.bash: -------------------------------------------------------------------------------- 1 | ../../dist_cleanup.bash -------------------------------------------------------------------------------- /dot.files/.local/sbin/cronjobs/monthly/30-dist_wrldchck.bash: -------------------------------------------------------------------------------- 1 | ../../dist_wrldchck.bash -------------------------------------------------------------------------------- /dot.files/.local/sbin/cronjobs/monthly_maint: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | 4 | sdn="$(dirname "$(realpath "$0")")" 5 | ms="${sdn}/monthly" 6 | if [ -d "${ms}" ]; then 7 | time { 8 | for scpt in "${ms}/"*.bash; do 9 | time "${scpt}" 10 | done 11 | } 12 | fi 13 | -------------------------------------------------------------------------------- /dot.files/.local/sbin/cronjobs/weekly/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michaeltd/dots/502ddc087b7201bcd61602db2ad393884fa52f19/dot.files/.local/sbin/cronjobs/weekly/.keep -------------------------------------------------------------------------------- /dot.files/.local/sbin/cronjobs/weekly/00-dist_hosts.bash: -------------------------------------------------------------------------------- 1 | ../../dist_hosts.bash -------------------------------------------------------------------------------- /dot.files/.local/sbin/cronjobs/weekly/10-dist_upgrade.bash: -------------------------------------------------------------------------------- 1 | ../../dist_upgrade.bash -------------------------------------------------------------------------------- /dot.files/.local/sbin/cronjobs/weekly_maint: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | 4 | sdn="$(dirname "$(realpath "$0")")" 5 | ws="${sdn}/weekly" 6 | if [ -d "${ws}" ]; then 7 | time { 8 | for scpt in "${ws}/"*.bash; do 9 | time "${scpt}" 10 | done 11 | } 12 | fi 13 | -------------------------------------------------------------------------------- /dot.files/.local/sbin/dist_check.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # man qcheck : qcheck - verify integrity of installed packages 4 | 5 | type -P emerge &>/dev/null || { echo -ne "Not an portage based distro!\n" >&2; exit 1; } 6 | type -P qcheck &>/dev/null || { echo -ne "qcheck not found!\n" >&2; exit 1; } 7 | [[ "${EUID}" -eq "0" ]] || { echo -ne "Privilaged access requirements not met!\n" >&2; exit 1; } 8 | 9 | qcheck --quiet --nocolor --badonly 10 | 11 | -------------------------------------------------------------------------------- /dot.files/.local/sbin/dist_cleanup.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | 4 | command -v emerge &>/dev/null || { echo -ne "Need a portage based distro!\n" >&2; exit 1; } 5 | (( EUID == 0 )) || { echo -ne "Privilaged access requirements not met!\n" >&2; exit 1; } 6 | 7 | eclean -Cpd packages -i 8 | eclean -Cpd distfiles 9 | -------------------------------------------------------------------------------- /dot.files/.local/sbin/dist_hosts.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env -S bash --norc --noprofile 2 | #shellcheck shell=bash disable=SC1008,SC2096,SC2207 3 | # 4 | # 1) Set a strict /etc/hosts file 5 | # 2) Make sure you have one 6 | 7 | [[ "${EUID}" -ne "0" ]] && echo -ne "\$EUID != 0.\nTry: sudo ${BASH_SOURCE[0]##*/}.\n" >&2 && exit 1 8 | 9 | url="https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts" 10 | 11 | hosts_file="/etc/hosts" 12 | 13 | random_file="/tmp/${RANDOM}.$$" 14 | 15 | curl -sS "${url}" > "${random_file}" 16 | 17 | bytes=($(wc -c "${random_file}")) 18 | 19 | if [[ "${bytes[0]}" -eq "0" ]]; then 20 | echo -ne "${random_file} is empty (zero bytes in size).\nCheck your network status and/or status of this page:\n${url}\n" >&2 21 | exit 1 22 | else 23 | echo -ne "cat ${random_file} > ${hosts_file}\n" 24 | cat "${random_file}" > "${hosts_file}" 25 | fi 26 | -------------------------------------------------------------------------------- /dot.files/.local/sbin/dist_upgrade.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env -S bash --norc --noprofile 2 | #shellcheck shell=bash disable=SC1008,SC2096 3 | #shellcheck disable=SC2155,SC2034,SC2154 4 | # 5 | # Distro neutral upgrade script michaeltd 171124 6 | # From https://en.wikipedia.org/wiki/Package_manager 7 | 8 | # Unofficial Bash Strict Mode 9 | set -euo pipefail 10 | IFS=$'\t\n' 11 | 12 | #link free (S)cript: (D)ir(N)ame, (B)ase(N)ame. 13 | readonly sdn="$(dirname "$(realpath "${BASH_SOURCE[0]}")")" \ 14 | sbn="$(basename "$(realpath "${BASH_SOURCE[0]}")")" 15 | 16 | main() { 17 | # For this to work package manager arrays must be in following format... 18 | # | #1 package manager executable | #2 repo update switch | #3 distro upgrade switch(es)| #4 ... 19 | # PS: By ignoring dpkg and rpm we are avoiding issues with systems where alien has been installed. 20 | local -ra apt_get=( "apt-get" "update" "--assume-yes" "--simulate" "dist-upgrade" ) \ 21 | yum=( "yum" "check-update" "update" ) \ 22 | zypper=( "zypper" "refresh" "update" "--no-confirm" "--auto-agree-with-licenses" ) \ 23 | pacman=( "pacman" "-Sy" "-Syu" ) \ 24 | emerge=( "emerge" "--sync" "--pretend" "--nospinner" "--update" "--deep" "--newuse" "@world" ) \ 25 | pkg=( "pkg" "update" "upgrade" "--quiet" "--no-repo-update" "--yes" ) 26 | 27 | local -ra pms=( apt_get[@] yum[@] zypper[@] pacman[@] emerge[@] pkg[@] ) 28 | 29 | local -r notfound="404" 30 | 31 | local pmidx="${notfound}" 32 | 33 | # Which is the first available pm in this system? 34 | for x in "${!pms[@]}"; do 35 | if type -P "${!pms[x]:0:1}" &> /dev/null; then 36 | local -r pmidx="${x}" 37 | break # break on first match. 38 | fi 39 | done 40 | 41 | if [[ "${pmidx}" == "${notfound}" || "${EUID}" != "0" ]]; then 42 | printf " Error: required access privilages not met,\n or package manager not found. \n For this to work you need root account privilages \n and a %s, %s, %s, %s, %s or %s based distro.\n Quithing.\n" "${!pms[0]:0:1}" "${!pms[1]:0:1}" "${!pms[2]:0:1}" "${!pms[3]:0:1}" "${!pms[4]:0:1}" "${!pms[5]:0:1}" >&2 43 | return 1 44 | else 45 | "${!pms[pmidx]:0:1}" "${!pms[pmidx]:1:1}" && "${!pms[pmidx]:0:1}" "${!pms[pmidx]:2}" 46 | fi 47 | } 48 | 49 | [[ "${BASH_SOURCE[0]}" == "${0}" ]] && main "${@}" 50 | -------------------------------------------------------------------------------- /dot.files/.local/sbin/dist_wrldchck.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | command -v emerge &>/dev/null || { echo -ne "Need a portage based distro!\n" >&2; exit 1; } 4 | 5 | while read -r i ; do 6 | if [[ -n "$(qdepends -Qq "${i}")" ]]; then 7 | echo -ne "\nchecking ${i}\n" 8 | if [[ -n "$(emerge --pretend --quiet --depclean "${i}")" ]]; then 9 | echo "${i} needs to stay in @world" 10 | else 11 | echo "${i} can be deselected" 12 | echo "${i}" >> /tmp/deselect 13 | fi 14 | fi 15 | done < /var/lib/portage/world 16 | 17 | echo "Packages in /tmp/deselect:" 18 | cat /tmp/deselect 19 | -------------------------------------------------------------------------------- /dot.files/.local/sbin/fbgrab: -------------------------------------------------------------------------------- 1 | #!/sbin/openrc-run 2 | # Copyright 1999-2016 Gentoo Foundation 3 | # Distributed under the terms of the GNU General Public License v2 4 | 5 | # extra_commands="configtest modules virtualhosts" 6 | # extra_started_commands="configdump fullstatus graceful gracefulstop reload" 7 | 8 | # description_configdump="Dumps the configuration of the runing apache server. Requires server-info to be enabled and www-client/lynx." 9 | # description_configtest="Run syntax tests for configuration files." 10 | # description_fullstatus="Gives the full status of the server. Requires lynx and server-status to be enabled." 11 | # description_graceful="A graceful restart advises the children to exit after the current request and reloads the configuration." 12 | # description_gracefulstop="A graceful stop advises the children to exit after the current request and stops the server." 13 | # description_modules="Dump a list of loaded Static and Shared Modules." 14 | # description_reload="Kills all children and reloads the configuration." 15 | # description_virtualhosts="Show the settings as parsed from the config file (currently only shows the virtualhost settings)." 16 | # description_stop="Kills all children and stops the server." 17 | 18 | # Apply default values for some conf.d variables. 19 | # PIDFILE="${PIDFILE:-/var/run/apache2.pid}" 20 | # TIMEOUT=${TIMEOUT:-15} 21 | # SERVERROOT="${SERVERROOT:-/usr/lib64/apache2}" 22 | # CONFIGFILE="${CONFIGFILE:-/etc/apache2/httpd.conf}" 23 | # LYNX="${LYNX:-lynx -dump}" 24 | # STATUSURL="${STATUSURL:-http://localhost/server-status}" 25 | # RELOAD_TYPE="${RELOAD_TYPE:-graceful}" 26 | 27 | # Append the server root and configuration file parameters to the 28 | # user's APACHE2_OPTS. 29 | # APACHE2_OPTS="${APACHE2_OPTS} -d ${SERVERROOT}" 30 | # APACHE2_OPTS="${APACHE2_OPTS} -f ${CONFIGFILE}" 31 | 32 | # The path to the apache2 binary. 33 | FBGRAB="/home/paperjam/.local/bin/fbgrab" 34 | FBCAT="/home/paperjam/.local/bin/fbcat" 35 | 36 | start() { 37 | 38 | ebegin "Starting ${SVCNAME}" 39 | 40 | sudo -u paperjam -g paperjam "${FBCAT}" > "/home/paperjam/Pictures/${SVCNAME}.$(date +%s).${FUNCNAME[0]}.${$}.ppm" 41 | 42 | eend ${?} 43 | } 44 | 45 | stop() { 46 | 47 | ebegin "Stopping ${SVCNAME}" 48 | 49 | sudo -u paperjam -g paperjam "${FBCAT}" > "/home/paperjam/Pictures/${SVCNAME}.$(date +%s).${FUNCNAME[0]}.${$}.ppm" 50 | 51 | eend ${?} 52 | } 53 | 54 | reload() { 55 | 56 | ebegin "Restarting ${SVCNAME}" 57 | 58 | stop 59 | start 60 | 61 | eend ${?} 62 | } 63 | 64 | # vim: ts=4 filetype=gentoo-init-d 65 | -------------------------------------------------------------------------------- /dot.files/.local/sbin/kernel_upgrade.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | cp "/usr/src/linux/.config" ~"/kernel-config-$(uname -r)" 4 | 5 | # eselect kernel list 6 | # eselect kernel set 2 7 | # mount /boot 8 | 9 | cd /usr/src/linux || exit 1 10 | 11 | zcat /proc/config.gz > /usr/src/linux/.config 12 | 13 | make syncconfig 14 | 15 | make -j4 && make modules_install # (adjust the -j according to CPU cores) 16 | 17 | make install 18 | 19 | grub-mkconfig -o /boot/grub/grub.cfg 20 | 21 | emerge @module-rebuild 22 | 23 | #umount /boot 24 | #reboot 25 | 26 | # Upon reboot, assuming all went well, clean out /lib/modules of the previous kernel directories, clean out /usr/src of the previous kernels (never linux nor your current kernel), and mount /boot, cd boot, and clear out the old garbage. 27 | 28 | # cd /usr/src/new_kernel && cp ../linux-old_kernel/.config ./ 29 | # eselect kernel list 30 | # eselect kernel set new_kernel_nr 31 | # make olddefconfig (mainly because I can't be bothered to google all the new options therefore set them as default) 32 | # genkernel --oldconfig all 33 | # emerge @module-rebuild 34 | # grub-mkconfig -o /boot/grub/grub.cfg 35 | -------------------------------------------------------------------------------- /dot.files/.local/sbin/update_backups.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env -S bash --norc --noprofile 2 | #shellcheck shell=bash disable=SC1008,SC2096,SC2155,SC2034,SC2046 3 | # 4 | # Configure backups with ${sbn%%.*}.include.(encrypt|compress).job_name definition files 5 | 6 | # Unofficial Bash Strict Mode 7 | set -uo pipefail 8 | IFS=$'\t\n' 9 | 10 | #link free (S)cript: (D)ir(N)ame, (B)ase(N)ame. 11 | readonly sdn="$(dirname "$(realpath "${BASH_SOURCE[0]}")")" \ 12 | sbn="$(basename "$(realpath "${BASH_SOURCE[0]}")")" 13 | 14 | main() { 15 | local definitions="${HOME}/.${sbn%%.*}" backup2=~/ recipient="tsouchlarakis@gmail.com" niceness="19" 16 | local myusage=" 17 | Usage: ${sbn} [-(-f)rom /path/to/defs] [-(-t)o /path/to/backups] [-(-k)ey some@key.org] [-(-n)iceness {0..19}] [-(-d)ebug] [-(-h)elp] 18 | 19 | -(-f)rom /path/to/defs where to read definitions from. Default: $definitions 20 | -(-t)o /path/to/backups where to save backups to. Default: $backup2 21 | -(-k)ey some@key.org key to encrypt to. Default: $recipient 22 | -(-n)iceness {0..19} niceness to run with. Default: $niceness 23 | -(-d)ebug display lots of words. Default: OFF 24 | -(-h)elp This screen. 25 | 26 | Prereq's you'll need for this to work: 27 | 1) Some include/exclude files to describe your backup jobs, -f switch. (see bellow) 28 | 2) A path to place your backup files, -t switch. 29 | 3) A \$recipient public key to encrypt to, -k switch. 30 | NOTE: add your \$recipient public key to root's keyring, If you link this to /etc/cron.anything 31 | 32 | Include/Exclude file details. 33 | 34 | include.*.* file name explanation: 35 | /path/to/defs/include.compress|encrypt.job_name 36 | ' ' ' ' ' 37 | 1 2 3 4 38 | 1) This part will be given by your [-(-f)rom] switch (default \"${definitions}\") 39 | The script will use it as a starting point to search for all definition related files. 40 | 2) include.* will be the search term for the definitions files. 41 | 3) This part should be aither *.encrypt.* or *.compress.*. 42 | encrypt file definitions will result in encrypted tarballs, 43 | compress file definitions will result in unencrypted tarballs. 44 | 4) The last part serves as the jobs name. 45 | It will end up in the resulting *.tar.gz.pgp or *.tar.gz file name. 46 | 47 | Sample include.*.* file contents: 48 | /home/username/git/. 49 | /home/username/Documents/. 50 | 51 | Sample exclude file contents: 52 | */.git/* 53 | */.github/* 54 | */node_modules/* 55 | 56 | " 57 | 58 | log2err() { echo -ne "${sbn}: ${*}\n" >&2; } 59 | 60 | while [[ -n "${*}" ]]; do 61 | case "${1}" in 62 | -f|--from) shift; definitions="${1}";; 63 | -t|--to) shift; backup2="${1}";; 64 | -k|--key) shift; recipient="${1}";; 65 | -n|--niceness) shift; [[ "${1}" =~ ^[-|+]?[0-9]+?$ ]] && (( $1 >= 0 && $1 <= 19 )) && niceness="${1}";; 66 | -d|--debug) set -x;; 67 | -h|--help) log2err "${myusage}"; return 1;; 68 | *) log2err "Unknown option ${1}\n${myusage}"; return 1;; 69 | esac 70 | shift 71 | done 72 | 73 | local -ra includes=( "${definitions}/include".* ) 74 | local -r exclude="${definitions}/exclude" job_fn="${backup2}/${HOSTNAME}.$(date -u +%y%m%d.%H%M.%s)" 75 | 76 | [[ -r "${includes[0]}" ]] || { log2err "No readable job file definitions found.\nNothing left to do!"; return 1; } 77 | [[ -d "${backup2}" ]] || { log2err "${backup2} is not a directory."; return 1; } 78 | 79 | # local -ra nice_cmd=( "nice" "-n" "${niceness}" ) \ 80 | # tar_cmd=( "tar" "--create" "--gzip" "$([[ -r "${exclude}" ]] && echo -n "--exclude-from=${exclude}")" "--exclude-backups" "--exclude-vcs" "--one-file-system" ) \ 81 | # pgp_cmd=( "gpg" "--batch" "--yes" "--recipient" "${recipient}" "--trust-model" "always" "--output" ) 82 | local -ra nice_cmd=( "nice" "-n" "${niceness}" ) \ 83 | tar_cmd=( "tar" "--create" "--gzip" "--exclude-vcs" "--one-file-system" ) \ 84 | pgp_cmd=( "gpg" "--batch" "--yes" "--recipient" "${recipient}" "--trust-model" "always" "--output" ) 85 | 86 | compress() { 87 | local job_out="${job_fn}.${1##*.}.tar.gz" exc_fn="${1//include/exclude}" 88 | "${nice_cmd[@]}" "${tar_cmd[@]}" "$([[ -r "${exc_fn}" ]] && echo -n "--exclude-from=${exc_fn}")" "--file" "${job_out}" $(cat "${1}") 89 | local err=$? 90 | if (( err == 0 )); then 91 | log2err "Wrote: ${job_out##*/}" 92 | else 93 | rm -f "${job_out}" # Wipe half baked archives (from reboots, shutdowns, etc) 94 | log2err "Discarded: ${job_out##*/}, error level is $err. Job \"${1##*.}\" Failed!" 95 | fi 96 | } 97 | 98 | encrypt() { 99 | local job_out="${job_fn}.${1##*.}.tar.gz.gpg" exc_fn="${1//include/exclude}" 100 | "${nice_cmd[@]}" "${tar_cmd[@]}" "$([[ -r "${exc_fn}" ]] && echo -n "--exclude-from=${exc_fn}")" $(cat "${1}") | "${pgp_cmd[@]}" "${job_out}" "--encrypt" 101 | local err=$? 102 | if (( err == 0 )); then 103 | log2err "Wrote: ${job_out##*/}" 104 | else 105 | rm -f "${job_out}" # Wipe half baked archives (from reboots, shutdowns, etc) 106 | log2err "Discarded: ${job_out##*/}, error level is $err. Job \"${1##*.}\" Failed!" 107 | fi 108 | } 109 | 110 | for include in "${includes[@]}"; do 111 | [[ ${include} =~ (compress|encrypt) ]] && "${BASH_REMATCH[1]}" "${include}" 112 | done 113 | } 114 | 115 | [[ "${BASH_SOURCE[0]}" == "${0}" ]] && main "${@}" 116 | -------------------------------------------------------------------------------- /dot.files/.local/sbin/update_cleanup.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env -S bash --norc --noprofile 2 | #shellcheck shell=bash source=/dev/null disable=SC1008,SC2096,SC2155,SC2207,SC2206,SC2154 3 | # 4 | # This will work for any directory containing ${HOSTNAME}.*.tar.gz* backups (eg: tuxbox.name.tar.gz, tuxbox.name.tar.gz.pgp) 5 | # that have an epoch date field in their filename (eg: tuxbox.190326.1553569476.enc.tar.gz.pgp). 6 | # 7 | 8 | # Unofficial Bash Strict Mode 9 | set -euo pipefail 10 | IFS=$'\t\n' 11 | 12 | #link free (S)cript: (D)ir(N)ame, (B)ase(N)ame. 13 | readonly sdn="$(dirname "$(realpath "${BASH_SOURCE[0]}")")" \ 14 | sbn="$(basename "$(realpath "${BASH_SOURCE[0]}")")" 15 | 16 | main() { 17 | local backup_dir="/mnt/data/Documents/bkp/linux" days2keep="3" nothing2bdone="1" 18 | local myusage=" 19 | Usage: ${sbn} [-(-b)ackups /backups/directory/] [-(-k)eep #] [-(-d)ebug] 20 | 21 | -(-b)ackups backups location, eg: /backups/directory/ 22 | -(-k)eep # backups to keep in days, eg:7 23 | -(-d)ebug display lots of letters. 24 | " 25 | 26 | log2err() { echo -ne "${sbn}: ${*}\n" >&2; } 27 | 28 | while [[ -n "${*}" ]]; do 29 | case "${1}" in 30 | -b|--backups) shift; local backup_dir="${1}";; 31 | -k|--keep) shift; local days2keep="${1}";; 32 | -d|--debug) set -vx;; 33 | *) log2err "${myusage}"; return 1;; 34 | esac 35 | shift 36 | done 37 | # Source explicitly for non interactive shells. 38 | srcspath="${sdn}/../../.bashrc.d/stdlib" 39 | 40 | local -ra sources=( "${srcspath}"/*.bash ) backups=( "${backup_dir}/${HOSTNAME}."*.tar.gz* ) 41 | 42 | for src in "${sources[@]}"; do 43 | source "${src}" || { log2err "${src} not readable."; return 1; } 44 | done 45 | 46 | [[ -e "${backups[0]}" ]] || { log2err "No backups found!"; return 1; } 47 | 48 | for x in "${!backups[@]}"; do 49 | local bfn="${backups[x]##*/}" 50 | if [[ "${bfn}" =~ ([0-9]{10}) ]]; then 51 | local fns[x]="${bfn}" 52 | local dts[x]="${BASH_REMATCH[1]}" 53 | fi 54 | done 55 | 56 | for (( y = 0; y < ${#fns[@]}; y++ )); do 57 | local -a name_parts=( $(split "${fns[y]}" '.') ) 58 | local -a same_job_backups=( ${backup_dir}/${HOSTNAME}.??????.????.??????????.${name_parts[4]}.tar.gz* ) 59 | if [[ "$(epoch_diff "$(max "${dts[@]}")" "${dts[y]}")" -ge "${days2keep}" && "${#same_job_backups[@]}" -gt "${days2keep}" ]]; then 60 | nothing2bdone="0" 61 | if [[ "$(last_dom "@${dts[y]}")" == "$(date --date="@${dts[y]}" +%d)" ]]; then 62 | mkdir -vp "${backup_dir}/bkp" && cp -v "${backup_dir}/${fns[y]}" "${backup_dir}/bkp/${fns[y]}" 63 | fi 64 | rm -v "${backup_dir}/${fns[y]}" 65 | fi 66 | done 67 | [[ "${nothing2bdone}" -eq "1" ]] && log2err "It seems there's nothing to be done!" 68 | } 69 | 70 | [[ "${BASH_SOURCE[0]}" == "${0}" ]] && main "${@}" 71 | -------------------------------------------------------------------------------- /dot.files/.local/sbin/update_mirror.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env -S bash --norc --noprofile 2 | #shellcheck shell=bash disable=SC1008,SC2096,SC2155 3 | # 4 | 5 | # Unofficial Bash Strict Mode 6 | set -euo pipefail 7 | IFS=$'\t\n' 8 | 9 | #link free (S)cript: (D)ir(N)ame, (B)ase(N)ame. 10 | readonly sbn="$(basename "$(realpath "${BASH_SOURCE[0]}")")" 11 | 12 | main() { 13 | 14 | local -ar nicec=( "nice" "-n" "19" ) \ 15 | rsncm=( "rsync" "--verbose" "--recursive" "--times" "--delete" "--exclude=*/msoft/*" ) 16 | 17 | local dtmnt="/mnt/data/Documents" elmnt="/mnt/el/Documents" 18 | 19 | if [[ -d "${dtmnt}" && -d "${elmnt}" ]]; then 20 | "${nicec[@]}" "${rsncm[@]}" "${dtmnt}"/* "${elmnt}" 21 | else 22 | echo -ne "${sbn}: ${dtmnt} or ${elmnt} not found\n" >&2 23 | return 1 24 | fi 25 | } 26 | 27 | [[ "${BASH_SOURCE[0]}" == "${0}" ]] && main "${@}" 28 | -------------------------------------------------------------------------------- /dot.files/.muttrc: -------------------------------------------------------------------------------- 1 | # character set on sent messages 2 | set send_charset="utf-8" 3 | # if there is no character set given on incoming messages, it is probably windows 4 | set assumed_charset="iso-8859-7" 5 | 6 | # make sure Vim knows Mutt is a mail client and that a UTF-8 encoded message will be composed 7 | #set editor="vim -c 'set syntax=mail ft=mail enc=utf-8'" 8 | set editor="emacs -q -nw" 9 | 10 | # just scroll one line instead of full page 11 | set menu_scroll=yes 12 | 13 | # we want to see some MIME types inline, see below this code listing for explanation 14 | auto_view application/msword 15 | auto_view application/pdf 16 | 17 | # make default search pattern to search in To, Cc and Subject 18 | set simple_search="~f %s | ~C %s | ~s %s" 19 | 20 | # threading preferences, sort by threads 21 | set sort=threads 22 | set strict_threads=yes 23 | 24 | # show spam score (from SpamAssassin only) when reading a message 25 | spam "X-Spam-Score: ([0-9\\.]+).*" "SA: %1" 26 | set pager_format = " %C - %[%H:%M] %.20v, %s%* %?H? [%H] ?" 27 | 28 | # do not show all headers, just a few 29 | ignore * 30 | unignore From To Cc Bcc Date Subject 31 | # and in this order 32 | unhdr_order * 33 | hdr_order From: To: Cc: Bcc: Date: Subject: 34 | 35 | # brighten up stuff with colors, for more coloring examples see: 36 | # http://aperiodic.net/phil/configs/mutt/colors 37 | color normal white default 38 | color hdrdefault green default 39 | color quoted green default 40 | color quoted1 yellow default 41 | color quoted2 red default 42 | color signature cyan default 43 | color indicator brightyellow red 44 | color error brightred default 45 | color status brightwhite blue 46 | color tree brightmagenta black 47 | color tilde blue default 48 | color attachment brightyellow default 49 | color markers brightred default 50 | color message white black 51 | color search brightwhite magenta 52 | color bold brightyellow default 53 | # if you don't like the black progress bar at the bottom of the screen, 54 | # comment out the following line 55 | #color progress white black 56 | 57 | # personality settings 58 | set realname = "michaeltd" 59 | set from = "tsouchlarakis@gmail.com" 60 | alternates "tsouchlarakis@tutanota.com|michael.tsouchlarakis@protonmail.com" 61 | # this file must exist, and contains your signature, comment it out if 62 | # you don't want a signature to be used 63 | set signature = ~/.pubkey.asc 64 | 65 | # aliases (sort of address book) 66 | # source ~/.aliases 67 | 68 | # IMAP connection settings 69 | set mail_check=60 70 | set imap_keepalive=300 71 | 72 | # IMAP account settings 73 | # set folder=imaps://larry@imap.mail.server/ 74 | # set spoolfile=imaps://larry@imap.mail.server/ 75 | # set record=imaps://larry@imap.mail.server/Sent 76 | # set postponed=imaps://larry@imap.mail.server/Drafts 77 | 78 | # use headercache for IMAP (make sure this is a directory for better performance!) 79 | set header_cache=/var/tmp/.mutt 80 | 81 | # uncomment this to enable the sidebar feature 82 | set sidebar_visible = no 83 | set sidebar_width = 15 84 | set sidebar_folder_indent = yes 85 | set sidebar_short_path = yes 86 | 87 | # make the progress updates not that expensive, this will update the bar every 300ms 88 | set read_inc = 1 89 | set time_inc = 300 90 | 91 | # only if you compiled Mutt with USE=gpgme, enable the gpgme backend 92 | set crypt_use_gpgme = no 93 | # you can set this to hide gpg's verification output and only rely on Mutt's status flag 94 | #set crypt_display_signature = no 95 | # enable signing of emails by default 96 | set pgp_autosign = no 97 | set pgp_sign_as = 0x01063480 # your gpg keyid here 98 | set pgp_replyencrypt = yes 99 | 100 | # mailboxes we want to monitor for new mail 101 | mailboxes "=" 102 | mailboxes "=Lists" 103 | 104 | # mailing lists for a Gentoo user (these are regexps!) 105 | subscribe "gentoo-.*@gentoo\\.org" 106 | 107 | # SMTP mailing configuration (for sending mail) 108 | #set smtp_url=smtp://paperjam@localhost/ 109 | -------------------------------------------------------------------------------- /dot.files/.profile: -------------------------------------------------------------------------------- 1 | # ~/.profile: executed by the command interpreter for login shells. 2 | # This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login 3 | # exists. 4 | # see /usr/share/doc/bash/examples/startup-files for examples. 5 | # the files are located in the bash-doc package. 6 | 7 | # the default umask is set in /etc/profile; for setting the umask 8 | # for ssh logins, install and configure the libpam-umask package. 9 | # umask 022 10 | 11 | # if running bash 12 | # if [[ -n "$BASH_VERSION" ]]; then 13 | # include .bashrc if it exists 14 | # if [[ -f "$HOME/.bashrc" ]]; then 15 | # source "$HOME/.bashrc" 16 | # fi 17 | # fi 18 | 19 | # [[ -n "$BASH_VERSION" && -f "$HOME/.bashrc" ]] && source "$HOME/.bashrc" 20 | 21 | # set ENV to a file invoked each time sh is started for interactive use. 22 | ENV=$HOME/.shrc; export ENV 23 | 24 | if [ -x /usr/bin/fortune ] ; then /usr/bin/fortune freebsd-tips ; fi 25 | -------------------------------------------------------------------------------- /dot.files/.tmux.conf: -------------------------------------------------------------------------------- 1 | # -- general ------------------------------------------------------------------- 2 | 3 | set -g default-terminal "screen-256color" # colors! 4 | setw -g xterm-keys on 5 | 6 | # set -g prefix2 C-\ # GNU-Screen compatible prefix 7 | # bind C-\ send-prefix -2 8 | 9 | set-option -g status-position top # position the status bar at top of screen 10 | set -q -g status-utf8 on # expect UTF-8 (tmux < 2.2) 11 | setw -q -g utf8 on 12 | 13 | set -g history-limit 99999 # boost history 14 | 15 | # -- display ------------------------------------------------------------------- 16 | 17 | set -g base-index 1 # start windows numbering at 1 18 | setw -g pane-base-index 1 # make pane numbering consistent with windows 19 | 20 | setw -g automatic-rename on # rename window to reflect current program 21 | set -g renumber-windows on # renumber windows when a window is closed 22 | 23 | set -g set-titles on # set terminal title 24 | #set -g set-titles-string '#h ❐ #S ● #I #W' 25 | set -g set-titles-string '#h #S #I #W' 26 | 27 | # Enable mouse support 28 | set -g mouse on 29 | 30 | # -- navigation ---------------------------------------------------------------- 31 | 32 | # create session 33 | bind C-c new-session 34 | 35 | # pane navigation 36 | bind -r h select-pane -L # move left 37 | bind -r j select-pane -D # move down 38 | bind -r k select-pane -U # move up 39 | bind -r l select-pane -R # move right 40 | bind > swap-pane -D # swap current pane with the next one 41 | bind < swap-pane -U # swap current pane with the previous one 42 | 43 | ######################################## 44 | # => Colors 45 | ######################################## 46 | # Solarized 47 | 48 | # default statusbar colors 49 | set-option -g status-bg colour235 #base02 50 | set-option -g status-fg colour130 #yellow 51 | # set-option -g status-attr default 52 | 53 | # default window title colors 54 | # set-window-option -g window-status-fg colour33 #base0 55 | # set-window-option -g window-status-bg default 56 | # set-window-option -g window-status-attr dim 57 | 58 | # active window title colors 59 | # set-window-option -g window-status-current-fg colour196 #orange 60 | # set-window-option -g window-status-current-bg default 61 | # set-window-option -g window-status-current-attr bright 62 | 63 | # pane border 64 | # set-option -g pane-border-fg colour235 #base02 65 | # set-option -g pane-active-border-fg colour46 #base01 66 | 67 | # message text 68 | # set-option -g message-bg colour235 #base02 69 | # set-option -g message-fg colour196 #orange 70 | 71 | # pane number display 72 | set-option -g display-panes-active-colour colour20 #blue 73 | set-option -g display-panes-colour colour196 #orange 74 | 75 | # clock 76 | set-window-option -g clock-mode-colour colour40 #green 77 | 78 | # window titles 79 | set-window-option -g window-status-current-format ' #[fg=white]** #[fg=white,bold][#{window_index}] #[fg=green]#{=32:pane_current_command} #[fg=cyan]#(pwd="#{pane_current_path}"; echo ${pwd####*/}) #[fg=white]**' 80 | set-window-option -g window-status-format '#[fg=colour244,bold][#{window_index}] #[fg=colour244]#{pane_current_command} #[fg=colour244]#(pwd="#{pane_current_path}"; echo ${pwd####*/})' 81 | -------------------------------------------------------------------------------- /dot.files/.toprc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michaeltd/dots/502ddc087b7201bcd61602db2ad393884fa52f19/dot.files/.toprc -------------------------------------------------------------------------------- /dot.files/.vimrc: -------------------------------------------------------------------------------- 1 | " Old config 2 | set noerrorbells visualbell t_vb= 3 | if has('autocmd') 4 | autocmd GUIEnter * set visualbell t_vb= 5 | endif 6 | 7 | set number 8 | 9 | " Highly recommended to set tab keys to 4 spaces 10 | set tabstop=2 11 | set shiftwidth=2 12 | set nohlsearch 13 | set wrap 14 | 15 | " Set Dimentions 16 | " set columns=100 17 | " set lines=30 columns=95 18 | 19 | " hi Normal guibg=NONE ctermbg=NONE 20 | 21 | "set spelllang=en_us,el 22 | "set spell 23 | 24 | " Global encoding setup 25 | set encoding=utf-8 26 | set fileencoding=utf-8 27 | 28 | filetype plugin on " Enable language dependant settings. 29 | filetype indent on " Enable language dependant auto indentation. 30 | syntax on " Enable syntaxical coloration. 31 | set wrap 32 | " set background=dark " Who use light background anyway ? 33 | " colorscheme desert " Makes use of the desert default solor scheme. 34 | 35 | let mapleader = "," " Change Leader from '\' to ','. 36 | let maplocalleader = ";" " Sets LocalLeader to ';'. 37 | 38 | nnoremap < :tabnew $MYVIMRC 39 | nnoremap > :source $MYVIMRC 40 | 41 | " Helper function : creates a directory if not already present. 42 | function! SafeMkdir(path) 43 | if !isdirectory(a:path) 44 | call mkdir(a:path, "p", 0700) 45 | endif 46 | endfunction 47 | 48 | call SafeMkdir($HOME . "/.vim/swap") 49 | set swapfile " Use recovery files. 50 | set directory=$HOME/.vim/swap// 51 | 52 | call SafeMkdir($HOME . "/.vim/undo") 53 | set undofile " Keep an undo file (persistent). 54 | set undodir=$HOME/.vim/undo// 55 | 56 | set cursorline " Highlight current line 57 | set number 58 | " set relativenumber " Show lines numbre relative to the cursor position. 59 | set scrolloff=5 " Always keep cursor away from top/bottom 60 | 61 | set lazyredraw " Redraw window only when usefull 62 | set showcmd " Show command while typing. 63 | set showmode " Show current mode. Void is 'Normal' mode. 64 | 65 | set expandtab " Replace by $shiftwidth spaces. 66 | set shiftround " Round spaces to the nearest $shiftwidth multiple. 67 | set softtabstop=4 " One softtab is two space long. 68 | set shiftwidth=4 " One is 4 spaces long. 69 | set tabstop=2 " One TAB appears to be 4 spaces. 70 | set autoindent " Automatic code file indentation. 71 | 72 | set ignorecase " Ignore case while searching for an expression. 73 | set smartcase " Disable 'ignorecase' if a capital letter is typed. 74 | set fileignorecase " Ignode case whil searching for a file. 75 | 76 | set incsearch " Show search's result(s) while typing. 77 | set hlsearch " Highlight search's result(s). 78 | set nohlsearch " Disable highlight at a buffer opening. 79 | nnoremap :nohlsearch 80 | 81 | " Enable status line visibility 82 | set laststatus=2 83 | set statusline =\ D:%{getcwd()} " Working directory 84 | set statusline+=\ F:%f " Current file 85 | set statusline+=\ S:%m " File's modification state 86 | set statusline+=\ R:%r " File's permissions 87 | set statusline+=\ T:%y " File's language type 88 | set statusline+=\ L:%l/%L " Current line vs lines number 89 | set statusline+=\ C:%v " Current column 90 | set statusline+=\ P:%p " Current percentage 91 | 92 | nnoremap j gj 93 | nnoremap k gk 94 | 95 | nnoremap = mfggVG=`fzz 96 | 97 | nnoremap t :tabnew 98 | nnoremap h :tabfirst 99 | nnoremap j :tabprevious 100 | nnoremap k :tabnext 101 | nnoremap l :tablast 102 | 103 | nnoremap h :tabmove0 104 | nnoremap j :tabmove- 105 | nnoremap k :tabmove+ 106 | nnoremap l :tabmove$ 107 | 108 | noremap 109 | 110 | noremap gf :vertical wincmd f 111 | noremap gF :wincmd f 112 | 113 | " Delete trailing spaces on save 114 | autocmd BufWritePre * %s/\s\+$//e 115 | 116 | "Goes back to the last cursor position before leaving the buffer. 117 | autocmd BufReadPost * 118 | \ if line("'\"") > 1 && line("'\"") <= line("$") | 119 | \ execute "normal! g`\"" | 120 | \ endif 121 | 122 | " Send current buffer to 'ix' pastebin 123 | function! Ix() 124 | :w ![ -z "$1" ] && curl -F 'f:1=<-' ix.io || ix < "$1"; 125 | endfunction 126 | nnoremap X :call Ix() 127 | 128 | -------------------------------------------------------------------------------- /dot.files/.xinitrc: -------------------------------------------------------------------------------- 1 | # ~/.xinitrc 2 | # 3 | # The dedicated WM hoppers ~/.xinitrc 4 | #shellcheck shell=bash 5 | 6 | # ~/.Xresources 7 | [[ -f ~/.Xresources ]] && xrdb -I"${HOME}" -merge ~/.Xresources 8 | 9 | # Silence terminal bell 10 | xset b off 11 | 12 | # Mouse acceleration 13 | xset m 20/10 4 14 | 15 | # Set NumLock ON 16 | # setleds +num 17 | 18 | # Qt5 theme engine 19 | export QT_QPA_PLATFORMTHEME=qt5ct 20 | 21 | declare -rA WMA=( [xfce4]="xfce4-session" \ 22 | [compiz]="compiz.sh" \ 23 | [openbox]="openbox-session" \ 24 | [enlightenment]="enlightenment_start" \ 25 | [e16]="starte16" \ 26 | [i3wm]="i3" \ 27 | [emacs]="emacs" ) 28 | 29 | # Selected WM (prefered WMA key available in daily driver) 30 | declare -r SWM="i3wm" 31 | 32 | # Per distro selection. If you've got preferences for specific distros, set them up here. 33 | source /etc/os-release 34 | if [[ "${ID}" == "gentoo" ]]; then 35 | WM="${WMA[$SWM]}" 36 | elif [[ "${ID}" == "devuan" ]];then 37 | WM="${WMA[xfce4]}" 38 | elif [[ "${ID}" =~ bsd$ ]];then 39 | WM="${WMA[openbox]}" 40 | else 41 | # Availability check, One line version: WM=$( type -P xfce4-session||type -P compiz.sh||type -P enlightenment_start||type -P starte16||type -P openbox-session||type -P wmaker||type -P mwm||type -P awesome||type -P emacs ||type -P kodi-standalone ) 42 | for x in "${!WMA[@]}"; do 43 | if [[ -x "$(type -P "${WMA[$x]}")" ]]; then 44 | WM="${WMA[$x]}" 45 | break 46 | fi 47 | done 48 | fi 49 | 50 | # Arguments check. If startx has an argument (eg: xfce4), set it up. 51 | for y in "${@}"; do 52 | for z in "${!WMA[@]}"; do 53 | if [[ "${y}" =~ ${z} ]]; then 54 | WM="${WMA[$z]}" 55 | break 56 | fi 57 | done 58 | done 59 | 60 | # Per wm customizations. If there is a wm specific permutation to be done, here is the place. 61 | if [[ "${WM[0]}" =~ emacs ]]; then 62 | # Just "emacs" would suffice if you don't mind a M-x:exwm-init on X boot. 63 | emacs --daemon # -f exwm-enable 64 | WM=( "emacsclient" "-c" ) 65 | elif [[ "${WM[0]}" =~ starte16 || "${WM[0]}" =~ enlightenment_start ]]; then 66 | # e17 svg support 67 | export E_COMP_ENGINE=sw 68 | fi 69 | 70 | if [[ -x $(type -P ck-launch-session) ]] && [[ "${ID}" =~ bsd$ ]];then 71 | . ~/.xprofile 72 | ck-launch-session "${WM[@]}" 73 | elif [[ -x $(type -P dbus-launch) ]]; then 74 | dbus-launch --exit-with-session "${WM[@]}" 75 | else 76 | exec "${WM[@]}" 77 | fi 78 | 79 | # Clean up temp sources (source /etc/os-release) 80 | unset NAME VERSION VERSION_ID ID ANSI_COLOR PRETTY_NAME CPE_NAME HOME_URL BUG_REPORT_URL 81 | -------------------------------------------------------------------------------- /dot.files/.xsession: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # .xsession to source ~/.profile and execute ~/.xinitrc to sessions initiated by xdm 4 | 5 | pf="${HOME}/.profile" 6 | if [ -r "${pf}" ]; then # User Profile 7 | source "${pf}" 8 | fi 9 | unset pf 10 | 11 | xirc="${HOME}/.xinitrc" 12 | if [ -x "${xirc}" ]; then # X init rc 13 | "${xirc}" 14 | fi 15 | unset xirc 16 | -------------------------------------------------------------------------------- /license: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 michaeltd 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /readme.org: -------------------------------------------------------------------------------- 1 | #+name: michaeltd dots 2 | #+author: michaeltd 3 | #+date: <2020-03-14 Sat> 4 | #+html:

bash-logo

5 | #+html:

No Maintenance Intended License: MIT

6 | 7 | Possible use: "git clone https://github.com/michaeltd/dots", go through this repository and select what fits your needs so you can incorporate it in your working environment. 8 | 9 | My dots tend to be opinionated so take them with a grain of rice ...err SALT, I meant salt. Take them with a grain of salt. 10 | 11 | ** [[dot.files][dot.files]] 12 | *** [[dot.files/.bash_profile][Shell]], [[dot.files/.xinitrc][X setup]], [[dot.files/.local/bin][bin]], [[dot.files/.local/sbin][sbin]] (maintenance scripts) 13 | **** [[dot.files/.bashrc.d][.bashrc.d]] 14 | Is an interactive shell initialization routine and it is customization of [[http://dotshare.it/~Durag/][Durag]]'s [[http://dotshare.it/dots/1027/][Improved Terminal]] at [[http://dotshare.it/][http://dotshare.it/]]. 15 | 16 | **** [[dot.files/.local/sbin/dist_upgrade.bash][dist_upgrade.bash]] 17 | Distro neutral upgrade script 18 | 19 | **** [[dot.files/.local/sbin/update_backups.bash][update_backups.bash]] 20 | Back up things ... 21 | 22 | **** [[dot.files/.local/sbin/update_cleanup.bash][update_cleanup.bash]] 23 | ... and clean up the mess. 24 | 25 | **** [[dot.files/.local/bin/wallpaper_rotate.bash][wallpaper_rotate.bash]] 26 | Script for rolling random images as wallpapers. 27 | I get my wallpapers from: [[https://www.reddit.com/r/spaceporn][r/spaceporn]], [[https://www.reddit.com/r/earthporn/][r/earthporn]], [[https://www.reddit.com/r/unixporn][r/unixporn]], [[https://www.reddit.com/r/wallpapers][r/wallpapers]] 28 | 29 | #+html:

Help screen

30 | 31 | *** Some WM's in no particular order. 32 | 33 | For a better preview: Right Click -> View Image 34 | 35 | + [[dot.files/.e16/][e16]], [[https://www.enlightenment.org/e16]] 36 | 37 | #+html:

e16

38 | 39 | + [[dot.files/.config/i3/][i3wm]], [[https://i3wm.org/]] 40 | 41 | #+html:

i3wm

42 | 43 | + [[dot.files/.config/compiz/][compiz]], [[https://launchpad.net/compiz]] 44 | 45 | #+html:

compiz

46 | 47 | + [[dot.files/.xinitrc#L69][exwm]], [[https://github.com/ch11ng/exwm/wiki]] 48 | 49 | #+html:

emacs(exwm)

50 | 51 | *** Editors, [[dot.files/.tmux.conf][Utilities]]. 52 | 53 | - If you are a follower of the church of [[https://en.wikipedia.org/wiki/Emacs][emacs]], check out [[https://github.com/michaeltd/.emacs.d][my setup]]. 54 | 55 | #+html:

emacs

56 | 57 | - If vim is your cup of tea, check out [[https://github.com/SpaceVim/SpaceVim][SpaceVim]], a community maintained vim distribution. 58 | 59 | *** [[bootstrap.bash]] 60 | #+html: 61 | How I migrate my .dots in new systems. Available only as reference, not for use. 62 | 63 | ** Business Cards 64 | 65 | Two catchy little terminal business cards to flash your coworkers/colleagues with. 66 | 67 | Shamelessly stolen from [[https://github.com/bnb/bitandbang][bitandbang]] 68 | 69 | + [[dot.files/.local/bin/michaeltd][Terminal business card v1.0]] 70 | 71 | ~curl -sL tinyurl.com/mick-bcard|sh~ 72 | 73 | Full bling business card. 74 | 75 | It may or may not trigger your most security aware colleagues depending on sec. awareness and proximity. 76 | 77 | #+html:

tbcv1

78 | 79 | + [[card.txt][Terminal business card v2.0]] 80 | 81 | ~curl -sL tinyurl.com/mick-card~ 82 | 83 | Non security triggering version for the low cost of minut less bling factor. 84 | 85 | #+html:

tbcv2

86 | 87 | ** Reference 88 | *** [[https://dotfiles.github.io/][GitHub ❤ ~/]] 89 | Your unofficial guide to dotfiles on GitHub. 90 | 91 | *** [[https://github.com/awesome-lists/awesome-bash][Awesome Bash]] [[https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg]] 92 | A curated list of delightful Bash scripts and resources. 93 | 94 | *** [[https://github.com/EbookFoundation/free-programming-books/blob/master/free-programming-books.md#bash][EbookFoundation free-programming-books - bash]] 95 | Free books relevant to bash (and much more). 96 | 97 | *** [[http://wiki.bash-hackers.org/][bash-hackers wiki]] 98 | See what other fellow bash'ers are up to. 99 | 100 | *** [[http://www.tldp.org/LDP/abs/html/abs-guide.html][Advanced Bash Scripting Guide]] ([[http://www.tldp.org/LDP/abs/abs-guide.pdf][PDF]]) 101 | The Bash all in one goto place. 102 | ** Updates 103 | *** <2021-05-30 Sun> 104 | "Kinda Works" (TM) under nomadBSD (dare I say freeBSD?). 105 | You need your unicode configured though. 106 | Changes from previous versions include but not limited to: 107 | - Long options removed (eg: ls aliases). 108 | - ~shuf~ removed in favour of ~$RANDOM % $val~. 109 | - if ~shred~ is not available, ~rm~ will be used. 110 | - ~#!/bin/bash~ shebangs updated to ~#!/usr/bin/env -S bash --norc --noprofile~. 111 | ** Contributing [[http://unmaintained.tech/][http://unmaintained.tech/badge.svg]] 112 | 113 | Typos, and grammar welcome. All PR's and issues will be considered. 114 | 115 | If you really *must* contribute, buy me some coffee in [[https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3THXBFPG9H3YY&source=michaeltd/.emacs.d][\euro]] or [[bitcoin:19TznUEx2QZF6hQxL64bf3x15VWNy8Xitm][₿]] (bitcoin:19TznUEx2QZF6hQxL64bf3x15VWNy8Xitm). 116 | 117 | ** [[file:license][MIT License]] [[https://opensource.org/licenses/MIT][https://img.shields.io/badge/License-MIT-yellow.svg]] 118 | -------------------------------------------------------------------------------- /setup_termux_on_android.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env -S bash --norc --noprofile 2 | #shellcheck shell=bash disable=SC1008,SC2096 3 | # 4 | # dots/setup_termux_on_android.bash 5 | # Migrates my .dots in android. 6 | 7 | # Unofficial Bash Strict Mode 8 | set -euo pipefail 9 | IFS=$'\t\n' 10 | 11 | #shellcheck disable=SC2155 12 | declare -r sdn="$(dirname "$(realpath "${BASH_SOURCE[0]}")")" \ 13 | sbn="$(basename "$(realpath "${BASH_SOURCE[0]}")")" 14 | 15 | cd "${sdn}" || exit 1 16 | 17 | pkg update && pkg upgrade 18 | 19 | pkg install git build-essential ncurses-utills vim emacs tmux htop mc cowsay fortune cmatrix neofetch 20 | 21 | git clone https://GitHub.com/michaeltd/dots/ ~/.dots 22 | 23 | git clone https://GitHub.com/michaeltd/.emacs.d ~/.emacs.d 24 | 25 | git clone https://GitHub.com/michaeltd/lolcat ~/lolcat 26 | 27 | -------------------------------------------------------------------------------- /tests.bats: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env -S bats --tap 2 | 3 | source "${BATS_TEST_DIRNAME}/dot.files/.bashrc" 4 | 5 | @test "Available Bash major version is greater or equal to 4" { 6 | run bash -c "echo ${BASH_VERSINFO[0]}" 7 | [ "$output" -ge "4" ] 8 | } 9 | 10 | @test "GNU Privacy Guard v2 executable is available in path" { 11 | run gpg --version 12 | [ "$status" -eq 0 ] 13 | } 14 | 15 | @test "OpenSSL executable is available in path" { 16 | run openssl version 17 | [ "$status" -eq 0 ] 18 | } 19 | 20 | @test "ShellCheck executable is available in path" { 21 | run shellcheck --version 22 | [ "$status" -eq 0 ] 23 | } 24 | 25 | @test "ShellCheck check's out .bashrc.d/*.bash targets" { 26 | run shellcheck "${BATS_TEST_DIRNAME}/dot.files/.bashrc.d"/*.bash 27 | [ "$status" -eq 0 ] 28 | } 29 | 30 | @test "ShellCheck check's out .bashrc.d/stdlib/*.bash targets" { 31 | # skip 32 | run shellcheck "${BATS_TEST_DIRNAME}/dot.files/.bashrc.d/stdlib"/*.bash 33 | [ "$status" -eq 0 ] 34 | } 35 | 36 | @test "ShellCheck check's out .local/bin/*.bash targets" { 37 | # skip 38 | run shellcheck "${BATS_TEST_DIRNAME}/dot.files/.local/bin"/*.bash 39 | [ "$status" -eq 0 ] 40 | } 41 | 42 | @test "ShellCheck check's out .local/sbin/*.bash targets" { 43 | # skip 44 | run shellcheck "${BATS_TEST_DIRNAME}/dot.files/.local/sbin"/*.bash 45 | [ "$status" -eq 0 ] 46 | } 47 | --------------------------------------------------------------------------------