├── .gitignore ├── ARCHIVE ├── backup-meta-apt ├── backup-meta-bin ├── backup-meta-init ├── bash-debug-set-x.bash ├── bash-mselect-freq ├── bash-toggle-options.bash ├── blscd.sh ├── bmucks.sh ├── build-readme-dotfiles.sh ├── bup-daily.sh ├── bup-weekly.sh ├── camera-snapshot ├── clipbored-pick.sh ├── clipbored-restart.sh ├── cpb.sh ├── cvlc.sh ├── debian-deploy-desktop ├── detox-iso8859-1.sh ├── disownw ├── dpkg-purge-conf.sh ├── fball ├── feedfaetcher ├── feh-browser.sh ├── find-file ├── find-string ├── firefox-backup-history.sh ├── firefox-backup-urls.sh ├── firefox-profiles-refresh.sh ├── firefox-steal-flash.sh ├── fzf-curr-pos ├── fzf-ls ├── gdate2din ├── get-goog ├── gistup-bin-post.sh ├── gistup-bin.sh ├── grep-man ├── imapfilter-localhost-action ├── imapfilter-localhost-delete ├── kuno ├── kuno2 ├── kuno3 ├── make-src.sh ├── man2pdf ├── man2text ├── mcalc ├── mediathekvieww ├── mlr-add.sh ├── mlr.sh ├── mr-update-own.sh ├── mr-update.sh ├── mutt--d630 ├── mutt--d630-archive ├── mutt--gmail ├── mutt--gmail-archive ├── mutt--hotmail ├── mutt--hotmail-archive ├── mutt--posteo ├── mutt--posteo-archive ├── mutt--posteo1 ├── mutt--posteo1-archive ├── mutt--spool ├── mutt-filter-uri ├── newsbeuter2um.sh ├── nottoomuchw ├── ob-rc.sh ├── ob-reload.sh ├── ob-update-xdg-menu.sh ├── obnam-weekly ├── ocean ├── otsort.sh ├── packen.sh ├── passivedns-archive.sh ├── passivedns.sh ├── pdf-purge-metadata-recur-with-BecCyPDFMetaEdit.sh ├── pdf-purge-metadata-with-BecCyPDFMetaEdit.sh ├── pdfxviewer.sh ├── pkg.sh ├── print-horiz.sh ├── proxychains-get-random-server.sh ├── pycalendar ├── pyrandgen ├── pyrandgen-xsel ├── ronn2man.sh ├── run-xstow-home ├── screenshot-multi ├── show-ports-opened ├── show-ports-opened2 ├── show-who ├── spotify-stream-gist ├── squid-backup-urls.sh ├── stjerm-autostart.sh ├── stow-data-new ├── stow-local.sh ├── stow-new ├── sxiv-browser ├── task-dir ├── tcsh--filetest ├── tcsh--printenv ├── todo-read ├── urldiff-add ├── urlview2 ├── vfh ├── wetter ├── wew.sh ├── xib ├── xombrero-open-url-run.sh ├── xombrero-open-url-tab-run.sh ├── xombrero-open-url-tab.sh ├── xombrero-open-url.sh ├── xorg-autolock-old ├── xorg-dpms-standby ├── xorg-export-xinfo ├── xorg-lock-old ├── xorg-rename-current-desktop ├── xorg-run-or-raise ├── xorg-set-desktop-name ├── xorg-switch-keyboard-layout ├── xorg-touchpad ├── xorg-uniconify-all-xwins.sh ├── xtermj1.sh ├── xwinreg-close-active-region.sh ├── xwinreg-cycle-anticlock.sh ├── xwinreg-cycle-clock.sh ├── xwinreg-cycle-reg-clock.sh ├── xwinreg-cycle-reverse.sh ├── xwinreg-focus-active-region.sh ├── xwinreg-focus-toggle-next.sh ├── xwinreg-focus-toggle-prev.sh ├── xwinreg-grid-horizontal.sh ├── xwinreg-grid-square-horizontal.sh ├── xwinreg-grid-square-vertical.sh ├── xwinreg-grid-vertical.sh ├── xwinreg-hide-active-region.sh ├── xwinreg-loop.sh ├── xwinreg-loop2.sh ├── xwinreg-master-east.sh ├── xwinreg-master-north.sh ├── xwinreg-master-south.sh ├── xwinreg-master-west.sh ├── xwinreg-maximize-all.sh ├── xwinreg-unhide-active-region.sh └── zettelkasten ├── README.md ├── audio-player ├── backup-meta ├── bash-count-occurence ├── bash-dedup-history ├── binary2nibble ├── bitbucket-rest-api ├── bitbucket-rest-api-libexec ├── bspot ├── bspot-create-featured-lists ├── bspot-create-gpb-lists ├── bspot-create-label ├── bspot-create-not-playable ├── bspot-create-release-date ├── bspot-get-tracks ├── bspot-shuffle-list ├── bspwm-rules ├── cclean ├── checkout-all-wir-bare-repos ├── choose ├── chromium-history ├── clipbuffer ├── compose-my-confluence-how-to-article ├── confluence-rest-api ├── confluence-rest-api-libexec ├── countdown ├── create-my-confluence-how-to-article ├── daemonize ├── daylight ├── debian-build-sources-list ├── debian-dist-upgrade ├── debian-update-alternatives ├── debian-upgrade ├── detach ├── dnsmasq-backup-urls ├── download-rocketchat-entities ├── dudel ├── emacsd ├── event ├── event-editor ├── fb-image-viewer ├── fc-edit ├── feed2newsboat ├── feedfaetcher ├── fetch-all-wir-repo-refs ├── file-browser ├── furlview ├── fzf-bind.bash ├── gaisma ├── generate-bookmarks-file ├── generate-my-confluence-how-to-article ├── generate-workingdays-sheet ├── get-basic-edid-identification ├── get-battery-capacity ├── get-edid-as-sha256sums ├── get-input-device-names-as-md5sums ├── get-lifeday ├── get-nox ├── get-product-name-as-sha256sum ├── get-product-uuid-as-sha256sum ├── get-sundata ├── get-wan-ip ├── github-build-bin-readme ├── grabc2clipboard ├── grep-url ├── habit ├── habit-editor ├── hblock ├── hexdump-raw-edid ├── idea-file-info ├── image-viewer ├── iplog ├── issue ├── issue-editor ├── jira-rest-api ├── jira-rest-api-libexec ├── lan-down ├── lan-up ├── lesspipew ├── list-all-branches ├── list-all-can-merge-prs ├── list-all-confluence-blogposts ├── list-all-inactive-reviewers ├── list-all-my-confluence-how-to-articles ├── list-all-my-open-prs ├── list-all-my-open-reviews ├── list-all-other-rocketchat-channels ├── list-all-overdue-prs ├── list-all-tags ├── list-all-users-contact-data ├── list-all-users-ip-addresses ├── list-commits-totals ├── list-rocketchat-user-presences ├── lock ├── log ├── log-editor ├── lsdisk ├── lsort ├── mail-archive ├── mail-deliver ├── mail-get ├── mail-hook-post ├── mail-hook-pre ├── mail-inbox ├── mail-queue ├── mail-retrieve ├── mail-send ├── mail-update ├── mail-viewer ├── menu ├── mime-build-types ├── mirror-all-wir-repos ├── msmtpqw ├── mutt--d630 ├── mutt--d630-archive ├── mutt--gmail ├── mutt--gmail-archive ├── mutt--hotmail ├── mutt--hotmail-archive ├── mutt--posteo ├── mutt--posteo-archive ├── mutt--posteo1 ├── mutt--posteo1-archive ├── mutt--spool ├── mutt-save-attachments ├── news ├── open ├── pass2clipboard ├── pdf-purge-metadata ├── power ├── print-apt-conf ├── pwgen2clipboard ├── pycolor ├── pyfonts ├── readline-editor ├── reconfigure-audio ├── reconfigure-camera ├── reconfigure-keyboard ├── reconfigure-linux-console-color ├── reconfigure-monitor ├── reconfigure-network-device ├── reconfigure-pointer ├── reload-sxhkd ├── repeat ├── rest ├── rest-api ├── restart-dunst ├── restart-sxhkd ├── rocketchat-rest-api ├── rocketchat-rest-api-libexec ├── rocketchat-status ├── run ├── run-black ├── run-borg-weekly ├── run-chromium ├── run-chromium-incognito ├── run-feedfaetcher ├── run-firefox ├── run-flake8 ├── run-generate-bookmarks-file ├── run-grabc ├── run-idea ├── run-imapfilter ├── run-isort ├── run-logger ├── run-mutt ├── run-mypy ├── run-notify-send ├── run-pidgin ├── run-pwgen ├── run-rtcwake ├── run-scrot ├── run-source-highlight ├── run-spotify ├── run-transmission-cli ├── run-vncserver ├── run-weechat ├── run-z ├── schlafe ├── sdmenu ├── skel-home ├── sort-ipv4 ├── sound ├── spotify-mpris ├── ssudo ├── startx.sh ├── stat2assoc ├── stj1 ├── swaptop ├── task-calc ├── task-colors ├── task-cv ├── task-local ├── taskum-add ├── template ├── test-ctty ├── test-daylight ├── test-inet ├── test-xorg ├── text-editor ├── text-visual ├── theme ├── todo ├── todo-editor ├── tput-colors.sh ├── update-all-wir-repo-mirrors ├── update-packages ├── volume ├── watch-all-confluence-spaces ├── watch-all-wir-repos ├── web-browser ├── webheader ├── wlan-down ├── wlan-up ├── wless ├── workingdays ├── wots ├── wradio ├── wvim ├── x-audio-player ├── x-file-browser ├── x-image-viewer ├── x-mail-viewer ├── x-pdf-viewer ├── x-terminal ├── x-terminal-tabbed ├── x-text-editor ├── x-video-player ├── x-web-browser ├── xorg-autolock ├── xorg-get-xclass ├── xorg-get-xids ├── xorg-lock ├── xorg-locker ├── xorg-raise-xwin ├── xorg-selection-clear ├── xorg-selection-clipboard-in ├── xorg-selection-clipboard-out ├── xorg-selection-primary-in ├── xorg-selection-primary-out ├── xorg-switch-to-desktop ├── youtube-dl-get-audio ├── zeit └── zombies /.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | -------------------------------------------------------------------------------- /ARCHIVE/backup-meta-apt: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Backup infos about installed packages on Debian. 4 | # TODO 5 | 6 | backup_dir=${XDG_BACKUP_HOME:?} 7 | 8 | sudo rm -rv -- "$backup_dir/"pkgs 9 | mkdir -pv -- "$backup_dir/"pkgs 10 | 11 | cd -- "$backup_dir/"pkgs || exit 1 12 | 13 | COLUMNS=200 dpkg-query -l >./query.txt 14 | sudo sh -c ' 15 | apt-cache policy > ./cache.txt; 16 | apt-mark showauto > ./auto.txt; 17 | apt-mark showmanual > ./manual.txt; 18 | # cp -v /etc/apt/trusted.gpg ./trusted.gpg; 19 | apt-clone clone .; 20 | ' 21 | 22 | # dpkg --get-selections | 23 | # mawk '!/deinstall|purge|hold/ { print $1 }' > ./packages.txt; 24 | 25 | # sudo find /etc/apt/sources.list* \ 26 | # -type f \ 27 | # -name '*.list' \ 28 | # -exec sh -c ' 29 | # printf "%s\n## " "$1"; 30 | # grep "^[[:space:]]*[^#[:space:]]" "$1";' \ 31 | # _ {} \; > ./sources.list; 32 | 33 | # vim: set ft=sh : 34 | -------------------------------------------------------------------------------- /ARCHIVE/backup-meta-bin: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Backup installed executables. 4 | # TODO 5 | 6 | backup_dir=${XDG_BACKUP_HOME:?}/ 7 | 8 | find /var/lib/dpkg/info/ \ 9 | -daystart \( -name \*.list -a -mtime -7 \) \ 10 | -printf '%f\n' | 11 | sed s:.list\$:: | 12 | sort >"$backup_dir/"7_days.txt 13 | 14 | IFS=: 15 | 16 | whatis -w '*' $PATH /usr/bin/X11 2>&1 | sort -u >"$backup_dir/"whatis.txt 17 | 18 | # vim: set ft=sh : 19 | -------------------------------------------------------------------------------- /ARCHIVE/backup-meta-init: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Backup inits. 4 | # TODO 5 | 6 | { 7 | find /etc/init.d/ -perm /111 -type f -printf %f\\n 8 | find /etc/init -type f -printf %f\\n 9 | } | sort -u >"${XDG_BACKUP_HOME:?}/"init.txt 10 | 11 | # vim: set ft=sh : 12 | -------------------------------------------------------------------------------- /ARCHIVE/bash-debug-set-x.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # A debugging function for bash. 4 | # Based on http://mywiki.wooledge.org/BashGuide/Practices#Activate_Bash.27s_Debug_Mode 5 | 6 | debug_set_x () 7 | case $1 in 8 | ('') 9 | ! :;; 10 | (-) 11 | set -x;; 12 | (+) 13 | set +x; 14 | exec 4>&-;; 15 | (*) 16 | if 17 | [[ -d ${1%/*} ]]; 18 | then 19 | exec 4>>"$1"; 20 | BASH_XTRACEFD=4; 21 | set -x; 22 | fi;; 23 | esac; 24 | 25 | # vim: set ft=sh : 26 | -------------------------------------------------------------------------------- /ARCHIVE/bash-mselect-freq: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Print most used commands of the bash history and run it from dmenu. 4 | 5 | bash-count-occurence | 6 | menu dmenu2 RUN | 7 | mawk '{ print $2 }' 8 | 9 | # vim: set ft=sh : 10 | -------------------------------------------------------------------------------- /ARCHIVE/bash-toggle-options.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Toggle bash options via fzf. 4 | 5 | __set () 6 | while 7 | read -r b o n _; 8 | do 9 | case $b$o in 10 | (set+o) set -o $n;; 11 | (set-o) set +o $n;; 12 | (shopt-s) shopt -u $n;; 13 | (shopt-u) shopt -s $n;; 14 | esac; 15 | done; 16 | 17 | __these () 18 | { 19 | BOLD=$(tput bold || tput md); 20 | RESET=$(tput sgr0 || tput me); 21 | GREEN=$(tput setaf 2 || tput AF 2); 22 | RED=$(tput setaf 1 || tput AF 1); 23 | 24 | sed " 25 | / -[so] / { 26 | s/$/ ${BOLD}${GREEN}enabled${RESET}/; 27 | b; 28 | }; 29 | { 30 | s/$/ ${BOLD}${RED}disabled${RESET}/; 31 | }; 32 | " | 33 | sort -k 3 | 34 | column -t | 35 | fzf --ansi --multi --with-nth=3.. --tiebreak=begin; 36 | }; 37 | 38 | __options () 39 | { 40 | shopt -p; 41 | shopt -op; 42 | }; 43 | 44 | IFS=$' \t\n'; 45 | 46 | __set < <(__these < <(__options)); 47 | 48 | # vim: set ft=sh : 49 | -------------------------------------------------------------------------------- /ARCHIVE/blscd.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Wrapper for blscd. 4 | 5 | source blscd 6 | 7 | BLSCD_SHOW_HIDDEN=0 Blscd Blscd::Main "$@" 8 | 9 | # vim: set ft=sh : 10 | -------------------------------------------------------------------------------- /ARCHIVE/build-readme-dotfiles.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Build README.md in github.com/D630/dotfiles . 4 | 5 | cd -- "${HOME}/stow" || exit 1; 6 | 7 | IFS='.:' read -r _ _ p _ _ < <( 8 | git config --local --get remote.origin.url 9 | ) 10 | P=https://github.com/${p} 11 | 12 | __find () 13 | { 14 | # find . -mindepth 3 -regextype posix-egrep \ 15 | # -path "./bin/local/bin/*" \ 16 | # -prune \ 17 | # -o \( -type f -a -regex "\./.*/local/bin/.*\.(awk|py|sh)" \) \ 18 | # -exec grep -H -m 1 '^# ' {} +; 19 | git ls-files -z '*.awk' '*.py' '*.sh' \ 20 | | grep -Zz -v -e '^bash/.bashrc.d/*' -e '^profile/.profile.d/*' \ 21 | | xargs -0 grep -H -m 1 '^# '; 22 | } 23 | 24 | { printf '%s' "$(< /dev/fd/0)" > ./README.md ; } <<'HEADER' 25 | Public repo with some of my dotfiles (configs and [helper scripts](https://github.com/D630/dotfiles/blob/master/SCRIPT.md)) used on Debian GNU/Linux. All my dotfiles are managed with [xstow](http://xstow.sourceforge.net/). You can find a description of my home directory and a list of my preferred tools in the [doc-repo](https://github.com/D630/doc). See also [bin](https://github.com/D630/bin) for other scripts. 26 | 27 | Unless otherwise stated, these files are in the public domain. 28 | HEADER 29 | 30 | __find \ 31 | | sort \ 32 | | { 33 | printf '%s\n\n' "Scripts in */local/bin:"; 34 | while 35 | IFS=: read -r p c 36 | do 37 | p=${p#./} 38 | printf '* [%s/%s](%s/blob/master/%s): %s\n' "${p%%/*}" "${p##*/}" "${P}" "${p}" "${c#\# }" 39 | done 40 | } \ 41 | > ./SCRIPT.md; 42 | 43 | # vim: set ft=sh : 44 | -------------------------------------------------------------------------------- /ARCHIVE/bup-daily.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Daily home backup with bup. 4 | 5 | typeset -x BUP_DIR=/media/truecrypt1/linux/bup 6 | 7 | while 8 | IFS= read -r -d '' 9 | do 10 | BUP_DIR=/media/truecrypt1/linux/bup/${REPLY} 11 | done < <( 12 | find "$BUP_DIR" -maxdepth 1 -type d -printf '%f\0' \ 13 | | sort -zn \ 14 | | sed -zn '$p'; 15 | ) 16 | 17 | bup index -ux /home 18 | bup save -n home /home 19 | 20 | # vim: set ft=sh : 21 | -------------------------------------------------------------------------------- /ARCHIVE/bup-weekly.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Weekly home backup with bup. 4 | 5 | typeset -x \ 6 | BUP_DIR=/media/truecrypt1/linux/bup \ 7 | today; 8 | 9 | printf -v today '%(%Y-%m-%d)T' -1 10 | 11 | while 12 | IFS= read -r -d '' 13 | do 14 | if 15 | (( ${today//-/} - ${REPLY//-/} > 14 )) 16 | then 17 | tmp_dir=$(mktemp -d --tmpdir) && { 18 | rsync -var --delete "${tmp_dir}/" "${BUP_DIR}/${REPLY}/" && { 19 | trap 'rm -Rf "$tmp_dir" "${BUP_DIR}/${REPLY}"' EXIT 20 | printf '%s/%s has been deleted\n' "$BUP_DIR" "$REPLY" \ 21 | 1>&2; 22 | } 23 | } 24 | fi 25 | done < <( 26 | find "$BUP_DIR" -maxdepth 1 -type d -printf '%f\0' \ 27 | | sort -zn \ 28 | | sed -zn '$!p'; 29 | ) 30 | 31 | BUP_DIR=/media/truecrypt1/linux/bup/${today} 32 | 33 | bup init 34 | bup index -ux /home 35 | bup save -n home /home 36 | 37 | # vim: set ft=sh : 38 | -------------------------------------------------------------------------------- /ARCHIVE/camera-snapshot: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Take a quick camera snapshot. 4 | 5 | mkdir -p /tmp/camera-snapshots 6 | 7 | exec ffmpeg \ 8 | -f video4linux2 \ 9 | -s 640x480 \ 10 | -i /dev/video0 \ 11 | -ss 0:0:2 \ 12 | -frames 1 \ 13 | "/tmp/camshots/$(date +%s).jpg" 14 | 15 | # vim: set ft=sh : 16 | -------------------------------------------------------------------------------- /ARCHIVE/clipbored-pick.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Simple clipboard manager for clipbored using dmenu or fzf. 4 | 5 | xsels=${HOME}/local/var/lib/clipbored/clips 6 | 7 | if 8 | test-tty.sh \ 9 | 2>/dev/null; 10 | then 11 | menu=fzf 12 | else 13 | menu=dmenu2 14 | fi 15 | 16 | printf -v xsels '%s' "$( 17 | tac "$xsels" \ 18 | | sed '/^$/d' \ 19 | | menu.sh "$menu" ">"; 20 | )" 21 | 22 | printf "$xsels" \ 23 | | xclip -i -l 1 -selection clipboard; 24 | 25 | # vim: set ft=sh : 26 | -------------------------------------------------------------------------------- /ARCHIVE/clipbored-restart.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env dash 2 | # 3 | # Restart clipbored. 4 | 5 | if 6 | test -n "$DISPLAY" 7 | then 8 | export XDG_DATA_HOME="${HOME}/local/var/lib" 9 | clipbored -k 10 | pkill clipbored 11 | daemonize.sh clipbored 12 | fi 13 | 14 | # vim: set ft=sh : 15 | -------------------------------------------------------------------------------- /ARCHIVE/cpb.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env dash 2 | # 3 | # Create backup copy of a file. 4 | 5 | for file 6 | do 7 | if 8 | test -e "$1" 9 | then 10 | cp -v -- "$1" "${1}_$(date +%Y-%m-%d_%H-%M-%S)" 11 | else 12 | printf '%s not found\n' "$1" \ 13 | 1>&2; 14 | fi 15 | done 16 | 17 | # vim: set ft=sh : 18 | -------------------------------------------------------------------------------- /ARCHIVE/cvlc.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env dash 2 | # 3 | # Run cvlc in terminal. 4 | 5 | daemonize.sh terminal.sh -c cvlc -t cvlc -T cvlc -e sh -c "cvlc ${1};exec ${SHELL}" 6 | 7 | # vim: set ft=sh : 8 | -------------------------------------------------------------------------------- /ARCHIVE/detox-iso8859-1.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env dash 2 | # 3 | # Run detox on all files in the current directory. 4 | 5 | detox -s iso8859_1 -r -v -n ./* 6 | 7 | # vim: set ft=sh : 8 | -------------------------------------------------------------------------------- /ARCHIVE/disownw: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Disown job. 4 | 5 | set -o monitor; 6 | 7 | "${1:?}" "${@:2}" & 8 | pid=$!; 9 | 10 | jn=$( 11 | jobs -lr | 12 | sed "/\[[0-9]*\]+ $pid/ s/\[\([0-9]*\)\].*/\1/"; 13 | ); 14 | 15 | ((jn)) && 16 | builtin disown "%$jn"; 17 | 18 | # vim: set ft=sh : 19 | -------------------------------------------------------------------------------- /ARCHIVE/dpkg-purge-conf.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env dash 2 | # 3 | # dpkg --purge 4 | 5 | dpkg -l \ 6 | | grep '^rc ' \ 7 | | cut -d " " -f3 \ 8 | | xargs dpkg --purge; 9 | 10 | # vim: set ft=sh : 11 | -------------------------------------------------------------------------------- /ARCHIVE/fball: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Show some soccer results from http://www.sportschau.de. 4 | 5 | [[ ${1#-} =~ [0-3] ]] || { 6 | printf 'Richtigen Wettbewerb angeben\n' 1>&2; 7 | exit 1; 8 | }; 9 | 10 | links[1]=https://www.sportschau.de/ergebnisse_tabellen/ergebnisse102~_eam-14d4fb6c588c7fcebc9c5fd4dfd21e2b_eap__liga-BL1_eap__sportart-fb.html?eap=8oI34N4hym4RDV6dhKK0OnLYM%2FNzIoiKmKv2HkJYKgPxCIifwJGZmigVNLw42zmko7u1BzkuenhteE%2FSifHaWb%2BD5g3qtsFGsnGotmb1PcZSS6XXfYWnKf1ELW46g2DdkfFtPY%2BHqJZgCaUEvpeNMw%3D%3D \ 11 | links[2]=https://www.sportschau.de/ergebnisse_tabellen/ergebnisse102~_eam-14d4fb6c588c7fcebc9c5fd4dfd21e2b_eap__liga-BL2_eap__sportart-fb.html?eap=8oI34N4hym4RDV6dhKK0OnLYM%2FNzIoiKmKv2HkJYKgPxCIifwJGZmigVNLw42zmko7u1BzkuenhteE%2FSifHaWb%2BD5g3qtsFGsnGotmb1PcZSS6XXfYWnKf1ELW46g2DdkfFtPY%2BHqJZgCaUEvpeNMw%3D%3D \ 12 | links[3]=https://www.sportschau.de/ergebnisse_tabellen/ergebnisse102~_eam-14d4fb6c588c7fcebc9c5fd4dfd21e2b_eap__liga-BL3_eap__sportart-fb.html?eap=8oI34N4hym4RDV6dhKK0OnLYM%2FNzIoiKmKv2HkJYKgPxCIifwJGZmigVNLw42zmko7u1BzkuenhteE%2FSifHaWb%2BD5g3qtsFGsnGotmb1PcZSS6XXfYWnKf1ELW46g2DdkfFtPY%2BHqJZgCaUEvpeNMw%3D%3D \ 13 | links[0]=https://www.sportschau.de/ergebnisse_tabellen/ergebnisse102~_eam-14d4fb6c588c7fcebc9c5fd4dfd21e2b_eap__liga-uebers_eap__sportart-fb.html?eap=8oI34N4hym4RDV6dhKK0OnLYM%2FNzIoiKmKv2HkJYKgPxCIifwJGZmigVNLw42zmko7u1BzkuenhteE%2FSifHaWb%2BD5g3qtsFGsnGotmb1PcZSS6XXfYWnKf1ELW46g2DdkfFtPY%2BHqJZgCaUEvpeNMw%3D%3D; 14 | 15 | curl -s "${links[${1#-}]}" | 16 | scrape -be div.table | 17 | grep -v '' | 18 | w3m -dump -no-graph -cols 142 -T text/html | 19 | sed -n ' 20 | 2,36{ 21 | s/ Statistik.*//g; 22 | s/ zu //g; 23 | s/Historie//g; 24 | s/gegen:/vs./g; 25 | s/Endstand: //g; 26 | s/Halbzeitstand: //g; 27 | p 28 | }'; 29 | 30 | # vim: set ft=sh : 31 | -------------------------------------------------------------------------------- /ARCHIVE/feh-browser.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Open all files under the current directory with feh. 4 | # Source: archlinux wiki 5 | 6 | shopt -s nullglob 7 | 8 | if 9 | [[ ! -f $1 ]] 10 | then 11 | printf '%s: first argument is not a file\n' "$0" \ 12 | 1>&2; 13 | exit 1 14 | fi 15 | 16 | typeset \ 17 | file=$(basename -- "$1") \ 18 | dir=$(dirname -- "$1"); 19 | typeset -a arr=() 20 | 21 | shift 1 22 | 23 | if 24 | cd -- "$dir" 25 | then 26 | for i in * 27 | do 28 | [[ -f $i ]] || continue; 29 | arr+=( "$i" ) 30 | [[ $i == $file ]] && c=$(( ${#arr[@]} - 1 )); 31 | done 32 | fi 33 | 34 | setsid.sh feh "$@" -- "${arr[@]:c}" "${arr[@]:0:c}" 35 | 36 | # vim: set ft=sh : 37 | -------------------------------------------------------------------------------- /ARCHIVE/find-file: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Find file under the current directory with flag -ls. 4 | 5 | find . -type f -iname "*$*" -ls 6 | 7 | # vim: set ft=sh : 8 | -------------------------------------------------------------------------------- /ARCHIVE/find-string: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Grep string in all files under the current directory with find. 4 | 5 | find . ! -type d -iname "*$2" | 6 | xargs grep -i "$1" 7 | 8 | # vim: set ft=sh : 9 | -------------------------------------------------------------------------------- /ARCHIVE/firefox-backup-history.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Back up latest firefox history with sqlite3. 4 | # Create logfile and a record in um. 5 | 6 | db_path=$(echo ${HOME}/.mozilla/firefox/*.default)/places.sqlite 7 | log_file=${HOME}/local/var/log 8 | log=${log_file}/urls.log 9 | uris=${log_file}/uris_new.log 10 | 11 | if 12 | sqlite3 "$db_path" ' 13 | SELECT DISTINCT moz_places.url 14 | FROM moz_places, moz_historyvisits 15 | WHERE ((url LIKE "http%" OR url LIKE "ftp%" OR url LIKE "file%" OR url LIKE "mailto%" OR url LIKE "gopher%") AND moz_historyvisits.place_id = moz_places.id) 16 | ORDER BY url' \ 17 | | sed 's/"//g' \ 18 | | tee "$uris" \ 19 | | cat "$log" - \ 20 | | sort -u \ 21 | > "${log}.$$"; 22 | then 23 | mv "${log}.$$" "$log"); 24 | fi 25 | 26 | if 27 | [[ -e $uris ]] 28 | then 29 | while 30 | read -r line 31 | do 32 | um add uri="$line" 33 | done < "$uris" 34 | rm -- "$uris" 35 | fi 36 | 37 | # vim: set ft=sh : 38 | -------------------------------------------------------------------------------- /ARCHIVE/firefox-backup-urls.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Backup all uris in firefox with sqlite3. 4 | # Create logfile and a record in urimark. 5 | 6 | db_path=$(echo ${HOME}/.mozilla/firefox/*.default)/places.sqlite 7 | log_file=${HOME}/local/var/log 8 | log=${log_file}/urls.log 9 | uris=${log_file}/uris_new.log 10 | 11 | if 12 | sqlite3 "$db_path" ' 13 | SELECT DISTINCT moz_places.url 14 | FROM moz_places 15 | WHERE (url LIKE "http%" OR url LIKE "ftp%" OR url LIKE "file%" OR url LIKE "mailto%" OR url LIKE "gopher%") 16 | UNION ALL 17 | SELECT DISTINCT moz_favicons.url 18 | FROM moz_favicons 19 | WHERE (url LIKE "http%" OR url LIKE "ftp%" OR url LIKE "file%" OR url LIKE "mailto%" OR url LIKE "gopher%") 20 | ORDER BY url' \ 21 | | sed 's/"//g' \ 22 | | tee "$uris" \ 23 | | cat "$log" - \ 24 | | sort -u \ 25 | > "${log}.$$"; 26 | then 27 | mv "${log}.$$" "$log" 28 | fi 29 | 30 | if 31 | [[ -e $uris ]] 32 | then 33 | while 34 | read -r line 35 | do 36 | um add uri="$line" 37 | done < "$uris" 38 | rm -- "$uris" 39 | fi 40 | 41 | # vim: set ft=sh : 42 | -------------------------------------------------------------------------------- /ARCHIVE/firefox-profiles-refresh.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Refresh Firefox Profiles. 4 | 5 | shopt -s extglob 6 | tmp_dir=$(mktemp -d --tmpdir) 7 | 8 | for i in "${HOME}/.mozilla/firefox/"*.!(clean-template|ini) 9 | do 10 | rsync -var --delete "${tmp_dir}/" "${i}/" 11 | rsync -var ${HOME}/.mozilla/firefox/*.clean-template/ "${i}/" 12 | done 13 | 14 | # vim: set ft=sh : 15 | -------------------------------------------------------------------------------- /ARCHIVE/firefox-steal-flash.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Grep and copy flash from firefox. Open selection in mpv. 4 | 5 | browser=firefox 6 | player=mpv 7 | files=() 8 | 9 | while 10 | IFS= read -r -d '' 11 | do 12 | random=$(od -vAn -N 1 -tu < /dev/urandom) 13 | rsync -a -v --progress --no-l -L "$REPLY" "/tmp/${random// /}.flash" 14 | done < <( 15 | find "/proc/$(pgrep ${browser})/fd" -type l -lname "/tmp/Flash*" -print0 16 | ) 17 | 18 | mapfile -t files < <( 19 | find "/tmp/" -maxdepth 1 -type f -name "*.flash" 20 | ) 21 | 22 | if 23 | (( ! ${#files[@]} )) 24 | then 25 | printf '%s\n' "There is no flash file" \ 26 | 1>&2; 27 | exit 1 28 | elif 29 | (( ${#files[@]} == 1 )) 30 | then 31 | setsid.sh "$player" "/tmp/${random// /}.flash" \ 32 | 2>/dev/null; 33 | else 34 | set -e 35 | ls -l "/tmp" \ 36 | | grep -e ".*flash"; 37 | read -re -p "File: " file 38 | setsid.sh "$player" "/tmp/${file}.flash" \ 39 | 2>/dev/null; 40 | fi 41 | 42 | # vim: set ft=sh : 43 | -------------------------------------------------------------------------------- /ARCHIVE/fzf-curr-pos: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Start fzf from current position. 4 | # Source: https://github.com/junegunn/fzf/issues/405 5 | # 6 | # The logic in the getpos function is stolen from 7 | # http://stackoverflow.com/a/2575525 8 | # Pass "row" or "col" as an argument to get their positions 9 | 10 | function getpos { 11 | exec < /dev/tty; 12 | 13 | typeset -n arg=$1; 14 | typeset \ 15 | col \ 16 | row \ 17 | oldstty=$(stty -g); 18 | 19 | stty raw -echo min 0; 20 | 21 | printf %b '\033[6n' > /dev/tty; 22 | IFS='[;' read -d R _ row col < /dev/tty; 23 | 24 | stty "$oldstty"; 25 | 26 | printf %d "$((arg - 1))"; 27 | 28 | unset -n arg; 29 | }; 30 | 31 | typeset -i \ 32 | lines=$(tput lines) \ 33 | row=$(getpos row); 34 | typeset -i \ 35 | halfway=lines/2 \ 36 | start_row=lines-row; 37 | typeset -x FZF_DEFAULT_OPTS=$FZF_DEFAULT_OPTS; 38 | 39 | # Start fzf from the current row 40 | if 41 | ((row < halfway)); 42 | then 43 | FZF_DEFAULT_OPTS="$FZF_DEFAULT_OPTS --reverse --margin $((row - 1)),0,0"; 44 | else 45 | ((start_row == 1 && (start_row=0))); 46 | FZF_DEFAULT_OPTS="$FZF_DEFAULT_OPTS --no-reverse --margin 0,0,$start_row"; 47 | fi; 48 | 49 | fzf; 50 | 51 | # vim: set ft=sh : 52 | -------------------------------------------------------------------------------- /ARCHIVE/fzf-ls: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Select files listed in a directory. 4 | 5 | arg=$(readlink -f "${1:-$PWD}") 6 | 7 | test -d "$arg" && 8 | ls -A1 --color=always "$arg" | 9 | fzf -m --ansi --prompt=PRINT\ 10 | 11 | # vim: set ft=sh : 12 | -------------------------------------------------------------------------------- /ARCHIVE/gdate2din: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Grep and convert german dates with dateutils using dgrep & strptime. 4 | # DIN 1355-1 => ISO 8601 / DIN 5008 5 | # DIN 5008 mit zwei Leerzeichen und 4-stellige Jahreszahl => ISO 8601 / DIN 5008 6 | 7 | while 8 | IFS= read -r; 9 | do 10 | if 11 | [[ $REPLY =~ [[:digit:]]{2}[[:punct:]][[:space:]][[:alpha:]]{2,3}[[:space:]][[:digit:]]{4} ]]; 12 | then 13 | printf '%s => %s\n' "$REPLY" "$( 14 | strptime -e -i %d.\ %b\ %Y -f %Y-%m-%d "$REPLY"; 15 | )"; 16 | elif 17 | [[ $REPLY =~ [[:digit:]]{2}[[:punct:]][[:space:]][[:alpha:]]{4,}[[:space:]][[:digit:]]{4} ]]; 18 | then 19 | printf '%s => %s\n' "$REPLY" "$( 20 | strptime -e -i %d.\ %B\ %Y -f %Y-%m-%d "$REPLY"; 21 | )"; 22 | elif 23 | [[ $REPLY =~ [[:digit:]]{2}[[:punct:]][[:digit:]]{2}[[:punct:]][[:digit:]]{2} ]]; 24 | then 25 | printf '%s => %s\n' "$REPLY" "$( 26 | strptime -e -i %d.%m.%Y -f %Y-%m-%d "$REPLY"; 27 | )"; 28 | fi; 29 | done < <( 30 | dgrep -z CEST --from-zone=CEST -e -o \ 31 | -i %d.%m.%Y \ 32 | -i %d.\ %b\ %Y \ 33 | -i %d.\ %B\ %Y \ 34 | --gt 1970-01-01 \ 35 | < "$1"; 36 | ); 37 | 38 | # vim: set ft=sh : 39 | -------------------------------------------------------------------------------- /ARCHIVE/get-goog: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Search google. 4 | # Source: http://chneukirchen.org/dotfiles/bin/goog 5 | 6 | Q=$* 7 | 8 | printf '%s\n' "$( 9 | curl -A Mozilla/4.0 -skLm 10 \ 10 | "http://www.google.com/search?nfpr=\&q=${Q// /+}" \ 11 | | grep -oP '\/url\?q=.+?&' \ 12 | | sed 's/\/url?q=//;s/&//;s/\%/\\x/g'; 13 | )" 14 | 15 | # vim: set ft=sh : 16 | -------------------------------------------------------------------------------- /ARCHIVE/grep-man: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Grep pattern in manpage. 4 | 5 | man -- "$1" | 6 | grep -i -C 2 --color=always "$2" | 7 | less -R 8 | 9 | # vim: set ft=sh : 10 | -------------------------------------------------------------------------------- /ARCHIVE/imapfilter-localhost-action: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Wrapper: imapfilter with config localhost-action.lua. 4 | # TODO 5 | 6 | exec imapfilter -c "$HOME/".imapfilter/localhost-action.lua 7 | 8 | # vim: set ft=sh : 9 | -------------------------------------------------------------------------------- /ARCHIVE/imapfilter-localhost-delete: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Wrapper: imapfilter with config localhost-delete.lua. 4 | # TODO 5 | 6 | exec imapfilter \ 7 | -c "$HOME/".imapfilter/localhost-delete.lua \ 8 | -l "${XDG_VAR_HOME:?}/"log/imapfilter.log 9 | 10 | # vim: set ft=sh : 11 | -------------------------------------------------------------------------------- /ARCHIVE/kuno: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Add interactively a note via terminal to use it later in org-mode. 4 | # Ask also for taskwarrior. 5 | 6 | typeset \ 7 | file \ 8 | kuno \ 9 | selection \ 10 | tags \ 11 | time \ 12 | title; 13 | 14 | file=${XDG_DATA_HOME:?}/documents/Notizen/outline/quicknotes.org; 15 | 16 | read -re -p 'Title: ' title; 17 | read -re -p 'Kurznotiz: ' kuno; 18 | read -re -p 'Tags: ' tags; 19 | 20 | printf -v time '%(%Y-%m-%d_%a_%H:%M)T' -1; 21 | 22 | cat >> "$file" << TEMPLATE 23 | * Kurznotiz: $title $tags 24 | :LOGBOOK: 25 | CLOCK: [$time]--[$time] => 0:00 26 | :END: 27 | <$time> 28 | :PROPERTIES: 29 | :TODO: 30 | :PRIORITY: 31 | :DEADLINE: 32 | :SCHEDULED: 33 | :CLOSED: 34 | :CLOCKSUM: 35 | :CLOCKSUM_T: 36 | :BLOCKED: 37 | :ITEM: 38 | :FILE: 39 | :COLUMNS: 40 | :CATEGORY: 41 | :ARCHIVE: 42 | :LOGGING: 43 | :END: 44 | $kuno 45 | TEMPLATE 46 | 47 | #emacsclient -t "$file" 48 | 49 | read -re -n 1 -p 'Add a task to taskwarrior? (y/n)' selection; 50 | [[ $selection == y ]] && 51 | taskwarrior-add; 52 | 53 | # vim: set ft=sh : 54 | -------------------------------------------------------------------------------- /ARCHIVE/kuno2: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Simple notetaker using ledit. 4 | 5 | store=${XDG_DATA_HOME:?}/kuno2 6 | date=$(date --utc --date now +%s) 7 | 8 | mkdir -p -- "$store" 9 | ledit -x -h "${store}/${date}" 10 | 11 | # vim: set ft=sh : 12 | -------------------------------------------------------------------------------- /ARCHIVE/kuno3: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Simple notetaker using rlfe. 4 | 5 | store=${XDG_DATA_HOME:?}/kuno2 6 | date=$(date --utc --date now +%s) 7 | 8 | mkdir -p -- "$store" 9 | rlfe -h "${store}/${date}" cat 10 | 11 | # vim: set ft=sh : 12 | -------------------------------------------------------------------------------- /ARCHIVE/man2pdf: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # man2pdf script. 4 | 5 | man -w "$@" 2>/dev/null 6 | 7 | man -t "$@" | 8 | ps2pdf - "$@.pdf" 9 | 10 | printf '%s.pdf\n' "$@" 11 | 12 | # vim: set ft=sh : 13 | -------------------------------------------------------------------------------- /ARCHIVE/man2text: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # man2text script. 4 | 5 | for i in *.1; do 6 | man -l "./$i" | 7 | sed -r 's/\d027\[[0-9]+m//g' >"$i.txt" 8 | done 9 | 10 | # vim: set ft=sh : 11 | -------------------------------------------------------------------------------- /ARCHIVE/mcalc: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Simple calculation with bc and dmenu. 4 | 5 | function __result { 6 | result=$( 7 | xsel -o | 8 | menu "$1" RESULT | 9 | xargs echo | 10 | bc 2>&1; 11 | ); 12 | 13 | printf %s\\n "$result" | 14 | tee >(xclip -i); 15 | }; 16 | 17 | if 18 | test-tty 2>/dev/null; 19 | then 20 | menu=slmenu; 21 | else 22 | menu=dmenu2; 23 | fi; 24 | 25 | __result "$menu"; 26 | 27 | while 28 | [[ -n $result ]]; 29 | do 30 | __result "$menu"; 31 | done; 32 | 33 | # vim: set ft=sh : 34 | -------------------------------------------------------------------------------- /ARCHIVE/mediathekvieww: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # MediathekView (german tv) 4 | 5 | case $1 in 6 | run) 7 | java -jar /opt/MediathekView.jar 8 | ;; 9 | load) 10 | java -jar /opt/bin/MediathekView.jar -auto -noGui 11 | ;; 12 | *) 13 | printf 'Usage: mediathekieww (run|load)\n' 1>&2 14 | exit 1 15 | ;; 16 | esac 17 | 18 | # vim: set ft=sh : 19 | -------------------------------------------------------------------------------- /ARCHIVE/mlr-add.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env dash 2 | # 3 | # Record repo as personal non-public repo. 4 | 5 | if 6 | [ -e "./.git" -o -e "./.hg" ] 7 | then 8 | if 9 | printf '%s\n' "$PWD" \ 10 | >> "${HOME}/local/var/lib/mlr/repos.txt"; 11 | then 12 | tail -n2 "${HOME}/local/var/lib/mlr/repos.txt" 13 | fi 14 | else 15 | printf '%s\n' "There is no repo in this dir." \ 16 | 1>&2; 17 | fi 18 | 19 | # vim: set ft=sh : 20 | -------------------------------------------------------------------------------- /ARCHIVE/mlr.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env dash 2 | # 3 | # Update personal non-public repos. 4 | 5 | while 6 | read -r repo 7 | do 8 | if 9 | cd -- "$repo" 10 | then 11 | if 12 | test -e "./.git" 13 | then 14 | git ls-files --deleted -z \ 15 | | xargs --null git rm \ 16 | 1>/dev/null \ 17 | 2>&1; 18 | git add -A . \ 19 | 1>/dev/null \ 20 | 2>&1; 21 | git commit -a -m "mlr $(date)" 22 | elif 23 | test -e "./.hg" 24 | then 25 | hg add \ 26 | 1>/dev/null \ 27 | 2>&1; 28 | hg commit -m "mlr $(date)" 29 | fi 30 | fi 31 | done < "${HOME}/local/var/lib/mlr/repos.txt" 32 | 33 | # vim: set ft=sh : 34 | -------------------------------------------------------------------------------- /ARCHIVE/mr-update-own.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | # 3 | # Wrapper: mr update (own repos). 4 | 5 | mr -c "~/.mrconfig-own" -j5 update 6 | 7 | # vim: set ft=sh : 8 | -------------------------------------------------------------------------------- /ARCHIVE/mr-update.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env dash 2 | # 3 | # Wrapper: mr update. 4 | 5 | mr -j 4 update 6 | 7 | # vim: set ft=sh : 8 | -------------------------------------------------------------------------------- /ARCHIVE/mutt--d630: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Wrapper: mutt d630. 4 | 5 | LOCAL_CONFIG=d630 exec mutt -n "$@" 6 | 7 | # vim: set ft=sh : 8 | -------------------------------------------------------------------------------- /ARCHIVE/mutt--d630-archive: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Wrapper: mutt d630.archive. 4 | 5 | LOCAL_CONFIG=d630.archive exec mutt -n "$@" 6 | 7 | # vim: set ft=sh : 8 | -------------------------------------------------------------------------------- /ARCHIVE/mutt--gmail: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Wrapper: mutt gmail. 4 | 5 | LOCAL_CONFIG=gmail exec mutt -n "$@" 6 | 7 | # vim: set ft=sh : 8 | -------------------------------------------------------------------------------- /ARCHIVE/mutt--gmail-archive: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Wrapper: mutt gmail.archive. 4 | 5 | LOCAL_CONFIG=gmail.archive exec mutt -n "$@" 6 | 7 | # vim: set ft=sh : 8 | -------------------------------------------------------------------------------- /ARCHIVE/mutt--hotmail: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Wrapper: mutt hotmail. 4 | 5 | LOCAL_CONFIG=hotmail exec mutt -n "$@" 6 | 7 | # vim: set ft=sh : 8 | -------------------------------------------------------------------------------- /ARCHIVE/mutt--hotmail-archive: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Wrapper: mutt hotmail.archive. 4 | 5 | LOCAL_CONFIG=hotmail.archive exec mutt -n "$@" 6 | 7 | # vim: set ft=sh : 8 | -------------------------------------------------------------------------------- /ARCHIVE/mutt--posteo: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Wrapper: mutt posteo. 4 | 5 | LOCAL_CONFIG=posteo exec mutt -n "$@" 6 | 7 | # vim: set ft=sh : 8 | -------------------------------------------------------------------------------- /ARCHIVE/mutt--posteo-archive: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Wrapper: mutt posteo.archive. 4 | 5 | LOCAL_CONFIG=posteo.archive exec mutt -n "$@" 6 | 7 | # vim: set ft=sh : 8 | -------------------------------------------------------------------------------- /ARCHIVE/mutt--posteo1: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Wrapper: mutt posteo1. 4 | 5 | LOCAL_CONFIG=posteo1 exec mutt -n "$@" 6 | 7 | # vim: set ft=sh : 8 | -------------------------------------------------------------------------------- /ARCHIVE/mutt--posteo1-archive: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Wrapper: mutt posteo1.archive. 4 | 5 | LOCAL_CONFIG=posteo1.archive exec mutt -n "$@" 6 | 7 | # vim: set ft=sh : 8 | -------------------------------------------------------------------------------- /ARCHIVE/mutt--spool: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Wrapper: mutt spool. 4 | 5 | LOCAL_CONFIG=spool exec mutt -n "$@" 6 | 7 | # vim: set ft=sh : 8 | -------------------------------------------------------------------------------- /ARCHIVE/mutt-filter-uri: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Add a bookmark to urimark in mutt. 4 | 5 | grep -oP -e \ 6 | '((http|https|gopher|ftp|ftps|webdav|webdavs|dav|davs):(//)?[^ <>"\t]*|(www|ftp)[0-9]?\.[-a-z0-9.]+)[^ .,;\t\n\r<">\):]?[^, <>"\t]*[^ .,;\t\n\r<">\):]' | 7 | while 8 | read -r r 9 | do 10 | taskum add uri":$r" 11 | done 12 | 13 | # vim: set ft=sh : 14 | -------------------------------------------------------------------------------- /ARCHIVE/newsbeuter2um.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env dash 2 | # 3 | # Add a bookmark to urimark in newsbeuter. 4 | 5 | um add uri="$1" name="$2" desc="$3" 6 | 7 | # vim: set ft=sh : 8 | -------------------------------------------------------------------------------- /ARCHIVE/nottoomuchw: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Wrapper for nottoomuch-addresses using dmenu or slmenu. 4 | 5 | if 6 | test-tty 2>/dev/null; 7 | then 8 | function search { 9 | string=$(menu "slmenu" ">" <<< ""); 10 | }; 11 | else 12 | function search { 13 | string=$(menu "dmenu2" ">" <<< ""); 14 | }; 15 | fi; 16 | 17 | 'search'; 18 | while 19 | [[ -n $string ]]; 20 | do 21 | clear; 22 | column -t < <( 23 | nottoomuch-addresses.sh "$string" | 24 | sed -r 's#(.*)()(<.*)#\3\ \1#g' | 25 | sed -r 's/\"//g;s/(<)(.*)(>)/\2/g' | 26 | sort -k 3; 27 | ); 28 | 'search'; 29 | done; 30 | 31 | # vim: set ft=sh : 32 | -------------------------------------------------------------------------------- /ARCHIVE/ob-rc.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Build openbox configuration file (poor man's method). 4 | 5 | case $1 in 6 | -c|--cat) 7 | command cat \ 8 | <(builtin printf '%s\n' '' '') \ 9 | "${XDG_CONFIG_HOME}"/openbox/rc-*.xml \ 10 | <(builtin printf '%s\n' '') \ 11 | > "${XDG_CONFIG_HOME}/openbox/rc.xml"; 12 | ;; 13 | -s|--split) 14 | i= 15 | sections=( 16 | applications 17 | desktops 18 | dock 19 | focus 20 | keyboard 21 | margins 22 | menu 23 | mouse 24 | placement 25 | resistance 26 | resize 27 | theme 28 | ) 29 | for i in "${sections[@]}" 30 | do 31 | command sed -n "/<${i}> /,/<\/${i}>/ p" "${XDG_CONFIG_HOME}/openbox/rc.xml" \ 32 | > "${XDG_CONFIG_HOME}/openbox/rc-${i}.xml"; 33 | done 34 | ;; 35 | *) 36 | printf '%s\n' "Usage: obrc (-c|--cat|-s|--split)" \ 37 | 1>&2; 38 | exit 1 39 | esac 40 | 41 | # vim: set ft=sh : 42 | -------------------------------------------------------------------------------- /ARCHIVE/ob-reload.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env dash 2 | # 3 | # Reload openbox. 4 | 5 | openbox --reconfigure 6 | xdotool key Super_L+b 7 | 8 | # vim: set ft=sh : 9 | -------------------------------------------------------------------------------- /ARCHIVE/ob-update-xdg-menu.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env dash 2 | # 3 | # Update root menu of openbox3. 4 | 5 | mkdir -p "${XDG_CACHE_HOME}/openbox" 6 | 7 | echo " 8 | 9 | 10 | " \ 11 | > "${XDG_CACHE_HOME}/openbox/xdg-menu.xml" 12 | 13 | xdg_menu.pl --format openbox3 --root-menu "${X_XDG_SOURCE_DIR}/arch-applications.menu" \ 14 | >> "${XDG_CACHE_HOME}/openbox/xdg-menu.xml"; 15 | 16 | echo " 17 | 18 | " \ 19 | >> "${XDG_CACHE_HOME}/openbox/xdg-menu.xml"; 20 | 21 | sed -i \ 22 | -e 's/id=\"/&\/xdg\//' \ 23 | -e 's/\/\/\//\//g' \ 24 | "${XDG_CACHE_HOME}/openbox/xdg-menu.xml"; 25 | 26 | # vim: set ft=sh : 27 | -------------------------------------------------------------------------------- /ARCHIVE/obnam-weekly: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Weekly backup with obnam. 4 | 5 | exec sudo \ 6 | HOME=$HOME \ 7 | XDG_CACHE_HOME=$XDG_CACHE_HOME \ 8 | obnam_conf=$HOME/.obnam.conf \ 9 | sh -c ' 10 | obnam backup --config"=$obnam_conf" --lru-size=8192 --upload-queue-size=8192 \ 11 | --exclude=/home/latch/tmp \ 12 | --exclude=/home/latch/var/mirror \ 13 | --exclude=$XDG_CACHE_HOME \ 14 | /etc/ \ 15 | /home/ \ 16 | /root/ \ 17 | /var/backups/ \ 18 | /var/lib/bitlbee \ 19 | /var/mail/ \ 20 | /var/sieve/ \ 21 | /var/vmail/ \ 22 | /var/www/; 23 | 24 | obnam force-lock --config"=$obnam_conf"; 25 | 26 | obnam forget --config"=$obnam_conf" --keep=2w; 27 | ' 28 | 29 | # vim: set ft=sh : 30 | -------------------------------------------------------------------------------- /ARCHIVE/ocean: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Simulate ocean sound. 4 | # Source: https://github.com/vain/bin-pub/blob/master/ocean 5 | 6 | exec play -q -n -c 2 \ 7 | synth 0 \ 8 | noise 100 \ 9 | noise 100 \ 10 | lowpass 100 \ 11 | gain 12 \ 12 | tremolo 0.125 80 13 | 14 | # vim: set ft=sh : 15 | -------------------------------------------------------------------------------- /ARCHIVE/packen.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env dash 2 | # 3 | # tar and gzip $1. 4 | 5 | tar czvf "${1}-$(date +%y%m%d-%H%M%S).tar.gz" "$1" 6 | 7 | # vim: set ft=sh : 8 | -------------------------------------------------------------------------------- /ARCHIVE/passivedns-archive.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env dash 2 | # 3 | # gzip logs of passivedns. 4 | 5 | if 6 | ! test -e "/var/log/passivedns-archive" 7 | then 8 | sudo mkdir -p "/var/log/passivedns-archive" 9 | fi 10 | 11 | if 12 | test -s "/var/log/passivedns.log" 13 | then 14 | sudo mv "/var/log/passivedns.log" "/var/log/passivedns-archive" 15 | sudo gzip -S ".$(date +%Y-%m-%d_%H:%M:%S).gz" "/var/log/passivedns-archive/passivedns.log" 16 | fi 17 | 18 | # vim: set ft=sh : 19 | -------------------------------------------------------------------------------- /ARCHIVE/passivedns.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env dash 2 | # 3 | # Run passivedns. 4 | 5 | sudo passivedns -i wlan0 -l "/var/log/passivedns.log" -D 6 | 7 | # vim: set ft=sh : 8 | -------------------------------------------------------------------------------- /ARCHIVE/pdf-purge-metadata-recur-with-BecCyPDFMetaEdit.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env dash 2 | # 3 | # Remove PDF metadata with BeCyPDFMetaEdit (recur). 4 | 5 | wine "${HOME}/.wine/drive_c/Program Files/BeCyPDFMetaEdit/BeCyPDFMetaEdit.exe" \ 6 | "./*.pdf" -s -d 2 -T "" -S "" -A "" -K "" -R "" -P "" -C "" -M "" -X 1 -q; 7 | 8 | # vim: set ft=sh : 9 | -------------------------------------------------------------------------------- /ARCHIVE/pdf-purge-metadata-with-BecCyPDFMetaEdit.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env dash 2 | # 3 | # Run BeCyPDFMetaEdit. 4 | 5 | wine "${HOME}/.wine/drive_c/Program Files/BeCyPDFMetaEdit/BeCyPDFMetaEdit.exe" \ 6 | "./*.pdf" -d 2 -T "" -S "" -A "" -K "" -R "" -P "" -C "" -M "" -X 1 -q; 7 | 8 | # vim: set ft=sh : 9 | -------------------------------------------------------------------------------- /ARCHIVE/pdfxviewer.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env dash 2 | # 3 | # Run PDFXCview. 4 | 5 | wine "${HOME}/.wine/drive_c/Program Files/Tracker Software/PDF Viewer/PDFXCview.exe" 6 | 7 | # vim: set ft=sh : 8 | -------------------------------------------------------------------------------- /ARCHIVE/pkg.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env dash 2 | # 3 | # Install that pkg. 4 | 5 | set -e 6 | 7 | PKG_BASE="${PKG_BASE:-${HOME}/stow}" 8 | PKG_DEST="${PKG_DEST:-${HOME}}" 9 | 10 | test -d "$PKG_BASE" || { 11 | printf '%s: %s\n' "stow dir missing" "$PKG_BASE" 1>&2; 12 | exit 1 13 | } 14 | 15 | test -d "$PKG_DEST" || { 16 | printf '%s: %s\n' "target dir missing" "$PKG_DEST" 1>&2; 17 | exit 1 18 | } 19 | 20 | for arg 21 | do 22 | case "${arg#-}" in 23 | S) 24 | action=_ 25 | readonly action 26 | shift 1 27 | ;; 28 | [DR]) 29 | action="$arg" 30 | readonly action 31 | shift 1 32 | ;; 33 | *) 34 | PKG_NAME="$arg" 35 | readonly PKG_NAME 36 | shift 1 37 | esac 38 | done 39 | 40 | : "${PKG_NAME:?pkg name missing}" 41 | : "${action:?action missing}" 42 | 43 | test -d "${PKG_BASE}/${PKG_NAME}" || { 44 | printf '%s: %s\n' "pkg does not exist; no directory found" "${PKG_BASE}/${PKG_NAME}" 1>&2; 45 | exit 1 46 | } 47 | 48 | xstow -v -dir "$PKG_BASE" -target "$PKG_DEST" ${action##*_*} "$PKG_NAME" 49 | 50 | # vim: set ft=sh : 51 | -------------------------------------------------------------------------------- /ARCHIVE/print-horiz.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Print horizontal line. 4 | # Source: http://wiki.bash-hackers.org/snipplets/print_horizontal_line 5 | 6 | #printf '%*s\n' "${1:-$(tput cols)}" ' ' | tr ' ' - 7 | printf -v horiz '%*s\n%s' "${1:-$(tput cols)}" '' 8 | printf '%s' "${horiz// /-}" 9 | #eval printf %.0s- '{1..'"${1:-$(tput cols)}"\}; echo 10 | 11 | # vim: set ft=sh : 12 | -------------------------------------------------------------------------------- /ARCHIVE/proxychains-get-random-server.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env dash 2 | # 3 | # Get a server ip (random) for proxychains. 4 | 5 | __get() 6 | { 7 | line_number="$(wc -l < ${HOME}/.proxychains/server_list.txt)" 8 | line_random="$(expr "$RANDOM" % "$line_number")" 9 | } 10 | 11 | __select() { 12 | printf '%s\n' "$( 13 | sort -Rr "${HOME}/.proxychains/server_list.txt" \ 14 | | head -n"${line_random}" \ 15 | | sort -Rr \ 16 | | sed -n -e'#^$#d' -e'$p'; 17 | )" 18 | } 19 | 20 | __main() 21 | { 22 | if 23 | [ "$line_random" -gt 0 ] 24 | then 25 | __select 26 | else 27 | __get 28 | __main 29 | fi 30 | } 31 | 32 | __get 33 | __main 34 | 35 | # vim: set ft=sh : 36 | -------------------------------------------------------------------------------- /ARCHIVE/pycalendar: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python2 2 | # 3 | # Display calendar. 4 | # Source: https://github.com/vain/bin-pub/blob/master/pycal 5 | # Licence: https://github.com/vain/bin-pub/blob/master/LICENSE 6 | 7 | import gtk 8 | import sys 9 | 10 | dlg = gtk.Dialog('Calendar') 11 | dlg.set_has_separator(False) 12 | dlg.vbox.pack_start(gtk.Calendar()) 13 | dlg.show_all() 14 | 15 | if len(sys.argv) >= 2: 16 | _, x, y, _ = gtk.gdk.display_get_default().get_pointer() 17 | w, h = dlg.get_size() 18 | dlg.move(x - w, y - h) 19 | 20 | dlg.run() 21 | 22 | # vim: set ft=python : 23 | -------------------------------------------------------------------------------- /ARCHIVE/pyrandgen: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # 3 | # Generate random password. 4 | # Source: https://github.com/vain/bin-pub/blob/master/randgen 5 | # Licence: https://github.com/vain/bin-pub/blob/master/LICENSE 6 | 7 | import string 8 | import random 9 | import sys 10 | 11 | if len(sys.argv) > 1: 12 | numchars = int(sys.argv[1]) 13 | else: 14 | numchars = 64 15 | 16 | pool = string.ascii_letters + string.digits 17 | pwd = '' 18 | for i in range(numchars): 19 | pwd += random.choice(pool) 20 | 21 | print(pwd) 22 | 23 | # vim: set ft=python : 24 | -------------------------------------------------------------------------------- /ARCHIVE/pyrandgen-xsel: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # X-select random password. 4 | 5 | printf "$(pyrandgen)" | 6 | xclip -i -l 1 -selection clipboard 7 | 8 | # vim: set ft=sh : 9 | -------------------------------------------------------------------------------- /ARCHIVE/ronn2man.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env dash 2 | # 3 | # Create manpage from ronn. 4 | 5 | cp -- "$1" "${1%.*}.ronn" 6 | ronn --roff "${1%.*}.ronn" 7 | man -l "${1%.*}.1" 8 | 9 | # vim: set ft=sh : 10 | -------------------------------------------------------------------------------- /ARCHIVE/run-xstow-home: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # xstow wrapper. 4 | 5 | exec xstow -v 3 \ 6 | -F /home/latch/etc/xstow/local.ini \ 7 | -dir /home/stow \ 8 | -target "$HOME" \ 9 | "${@:?package missing}" 10 | 11 | # vim: set ft=sh : 12 | -------------------------------------------------------------------------------- /ARCHIVE/screenshot-multi: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Take a quick screenshot. 4 | 5 | mkdir -p /tmp/screenshots 6 | 7 | cd /tmp/screenshots || 8 | exit 1 9 | 10 | exec scrot \ 11 | '%Y-%m-%d--%s_$wx$h.png' \ 12 | -q 100 \ 13 | -m 14 | 15 | # vim: set ft=sh : 16 | -------------------------------------------------------------------------------- /ARCHIVE/show-ports-opened: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Check open network ports. 4 | 5 | ss --all --numeric --processes --ipv4 --ipv6 6 | 7 | # vim: set ft=sh : 8 | -------------------------------------------------------------------------------- /ARCHIVE/show-ports-opened2: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Check still open network ports. 4 | 5 | echo 6 | lsof -a +L1 / 7 | echo 8 | 9 | # vim: set ft=sh : 10 | -------------------------------------------------------------------------------- /ARCHIVE/show-who: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Who. 4 | 5 | echo 6 | uptime 7 | echo 8 | who --all -H 9 | echo 10 | w 11 | echo 12 | 13 | # vim: set ft=sh : 14 | -------------------------------------------------------------------------------- /ARCHIVE/spotify-stream-gist: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Stream music links from my gist file. 4 | 5 | while 6 | read -r; 7 | do 8 | audio-player "$REPLY"; 9 | read -r -t 3 < /dev/tty; 10 | [[ $REPLY == q ]] && exit; 11 | done < <( 12 | curl https://gist.githubusercontent.com/d630/323420bbb1466bcd58925df610ed5fcd/raw/spotify.md | 13 | sed -n 's/^.*(\([^ ]*\))$/\1/p'; 14 | ); 15 | 16 | # vim: set ft=sh : 17 | -------------------------------------------------------------------------------- /ARCHIVE/squid-backup-urls.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env dash 2 | # 3 | # Backup all uris from squid3 log. 4 | 5 | log="${HOME}/local/var/log/urls.log" 6 | 7 | if 8 | grep -o 'GET .* - HIER_DIRECT' "/var/log/squid3/access.log" \ 9 | | cut -d ' ' -f 2 \ 10 | | cat "$log" - \ 11 | | sort -u > "${log}.$$"; 12 | then 13 | mv "${log}.$$" "$log" 14 | fi 15 | 16 | # vim: set ft=sh : 17 | -------------------------------------------------------------------------------- /ARCHIVE/stjerm-autostart.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env dash 2 | # 3 | # Run stjerm. 4 | 5 | stjerm -m windows -k c -ah false -o 100 -w 100% -h 20% -p bottom \ 6 | -sh /bin/bash -l 5000 -st never -ub false \ 7 | -fn "-*-terminus-medium-*-*-*-14-*-*-*-*-*-iso10646-*" -ab false; 8 | 9 | # vim: set ft=sh : 10 | -------------------------------------------------------------------------------- /ARCHIVE/stow-data-new: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Set up a new stow-data package. 4 | 5 | set -- "${1:? need a name}" "${2:-$HOSTNAME}" "${3:-$USER}"; 6 | 7 | s=$( 8 | IFS=; 9 | md5sum <<< "$*"; 10 | ); 11 | s=${s%% *}; 12 | 13 | . /home/stow-data/map || 14 | typeset -A map; 15 | 16 | map[$s]=$2/$3/$1; 17 | 18 | mkdir -v /home/stow-data"/$s" || 19 | exit; 20 | 21 | typeset -p map > /home/stow-data/map; 22 | 23 | chmod 755 /home/stow-data"/$s"; 24 | > /home/stow-data"/$s/".gitignore; 25 | ln -vfrs /home/stow-data"/$s" /home/stow-data"/$1"; 26 | 27 | typeset -x \ 28 | GIT_DIR=/home/stow-data/$s/.git \ 29 | GIT_WORK_TREE=/home/stow-data/$s; 30 | 31 | git init; 32 | git add -f .gitignore; 33 | git commit -m I; 34 | 35 | # vim: set ft=sh : 36 | -------------------------------------------------------------------------------- /ARCHIVE/stow-local.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env dash 2 | # 3 | # xstow wrapper for $HOME. 4 | 5 | xstow -v -t "$HOME" "$@" 6 | 7 | # vim: set ft=sh : 8 | -------------------------------------------------------------------------------- /ARCHIVE/stow-new: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Set up a new stow package. 4 | 5 | set -- "${1:? need a name}" "${2:-$HOSTNAME}" "${3:-$USER}"; 6 | 7 | s=$( 8 | IFS=; 9 | md5sum <<< "$*"; 10 | ); 11 | s=${s%% *}; 12 | 13 | . /home/stow/map || 14 | declare -A map; 15 | 16 | map[$s]=$2/$3/$1; 17 | 18 | mkdir -v "/home/stow/$s" || 19 | exit; 20 | 21 | mv -v /home/stow/map /home/stow/map~; 22 | declare -p map > /home/stow/map; 23 | 24 | chmod -v 750 "/home/stow/$s"; 25 | > "/home/stow/$s/.gitignore"; 26 | ln -vfrs "/home/stow/$s" "/home/stow/$1"; 27 | 28 | declare -x \ 29 | GIT_DIR=/home/stow/$s/.git \ 30 | GIT_WORK_TREE=/home/stow/$s; 31 | 32 | git init; 33 | git add -f .gitignore; 34 | git commit -m I; 35 | 36 | # vim: set ft=sh : 37 | -------------------------------------------------------------------------------- /ARCHIVE/sxiv-browser: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Open all files in the current directory with sxiv. 4 | # source: archlinux wiki 5 | 6 | shopt -s nullglob; 7 | 8 | [[ -f $1 ]] || { 9 | printf '%s: first argument is not a file\n' "$0" 1>&2; 10 | exit 1; 11 | }; 12 | 13 | typeset \ 14 | file=$(basename -- "$1") \ 15 | dir=$(dirname -- "$1"); 16 | typeset -a arr=(); 17 | 18 | shift 1; 19 | 20 | cd -- "$dir" || 21 | exit 1; 22 | 23 | for i in *; do 24 | [[ -f $i ]] || 25 | continue; 26 | arr+=("$i") 27 | [[ $i == "$file" ]] && 28 | c=$((${#arr[@]} - 1)); 29 | done; 30 | 31 | echo exec sxiv -- "${arr[@]:c}" "${arr[@]:0:c}"; 32 | 33 | # vim: set ft=sh : 34 | -------------------------------------------------------------------------------- /ARCHIVE/tcsh--filetest: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env tcsh 2 | # 3 | # Use the filetest builtin command of tcsh. 4 | 5 | filetest $argv[*]; 6 | 7 | # vim: set ft=csh : 8 | -------------------------------------------------------------------------------- /ARCHIVE/tcsh--printenv: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env tcsh 2 | # 3 | # Use the printenv builtin command of tcsh. 4 | 5 | printenv $argv[*]; 6 | 7 | # vim: set ft=csh : 8 | -------------------------------------------------------------------------------- /ARCHIVE/urldiff-add: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Add to urlwatch and urldiff. 4 | 5 | if 6 | test -n "$1" 7 | then 8 | printf '\n%s\n' URLDIFF 9 | printf %s\\n "$1" >>"${XDG_VAR_HOME:?}/"lib/urldiff/urls.txt && 10 | tail -n2 "$XDG_VAR_HOME/"lib/urldiff/urls.txt 11 | else 12 | printf 'Es muss eine url angegeben werden ...\n' 1>&2 13 | exit 1 14 | fi 15 | 16 | # vim: set ft=sh : 17 | -------------------------------------------------------------------------------- /ARCHIVE/urlview2: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Use choose to simulate urlview. 4 | # 5 | # https://github.com/vain/bin-pub/blob/master/choose 6 | # http://www.uninformativ.de/?section=news&ndo=single&newsid=194 7 | # https://github.com/vain/bin-pub/blob/master/urlview2 8 | 9 | while 10 | read -r; 11 | do 12 | if 13 | [[ -n $DISPLAY ]]; 14 | then 15 | setsidw x-web-browser "$REPLY"; 16 | else 17 | exec web-browser "$REPLY"; 18 | fi 19 | done < <( 20 | grep -oP '(((http|https|ftp|gopher)|mailto|file):(//)?[^ <>"\t]*|' \ 21 | '(www|ftp)[0-9]?\.[-a-z0-9.]+)[^ .,;\t\n\r<">\):]?[^, <>"\t]*' \ 22 | '[^ .,;\t\n\r<">\):]' "$@" | 23 | menu choose; 24 | ); 25 | 26 | # vim: set ft=sh : 27 | -------------------------------------------------------------------------------- /ARCHIVE/vfh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Preview files in a directory like in vifm. 4 | 5 | ls -1a "${1:-$PWD}" | 6 | xib -- less -R 7 | 8 | # vim: set ft=sh : 9 | -------------------------------------------------------------------------------- /ARCHIVE/wetter: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Get infos from http://wetter.tagesschau.de. 4 | 5 | case $1 in 6 | -d) 7 | uri=http://wetter.tagesschau.de/deutschland/wetterstationen/ 8 | ;; 9 | -w) 10 | uri=http://wetter.tagesschau.de/europawelt/ 11 | ;; 12 | *) 13 | printf 'argument?\n' 1>&2 14 | exit 1 15 | ;; 16 | esac 17 | 18 | curl -s "$uri" | 19 | scrape -be table | 20 | w3m -dump -T text/html 21 | 22 | # vim: set ft=sh : 23 | -------------------------------------------------------------------------------- /ARCHIVE/xombrero-open-url-run.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env dash 2 | # 3 | # Run script for xombrero-open-url.sh. 4 | 5 | daemonize.sh terminal.sh -e -sh -c "xombrero-open-url.sh;exec ${SHELL}" 6 | 7 | # vim: set ft=sh : 8 | -------------------------------------------------------------------------------- /ARCHIVE/xombrero-open-url-tab-run.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env dash 2 | # 3 | # Run script for xombrero-open-url-tab.sh. 4 | 5 | daemonize.sh terminal.sh -e sh -c "xombrero-open-url-tab.sh; exec ${SHELL}" 6 | 7 | # vim: set ft=sh : 8 | -------------------------------------------------------------------------------- /ARCHIVE/xombrero-open-url-tab.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env dash 2 | # 3 | # Select url with menu and open it in a new tab in xombrero. 4 | 5 | count="$(pgrep -c xombrero)" 6 | 7 | file_uris="${HOME}/local/var/log//urls.log" 8 | uri="$( 9 | grep -oP -e '((http|https|gopher|ftp|ftps|webdav|webdavs|dav|davs):(//)?[^ <>"\t]*|(www|ftp)[0-9]?\.[-a-z0-9.]+)[^ .,;\t\n\r<">\):]?[^, <>"\t]*[^ .,;\t\n\r<">\):]' "$file_uris" \ 10 | | menu.sh "dmenu2" ">"; 11 | )" 12 | 13 | test -n "$uri" || exit 1; 14 | 15 | if 16 | [ "$count" -eq 0 ] 17 | then 18 | setsid.sh xombrero "$uri" 19 | else 20 | xombrero -n "$uri" 21 | fi 22 | 23 | # vim: set ft=sh : 24 | -------------------------------------------------------------------------------- /ARCHIVE/xombrero-open-url.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env dash 2 | # 3 | # Select url with menu and open it in current tab in xombrero. 4 | 5 | count="$(pgrep -c xombrero)" 6 | 7 | file_uris="${HOME}/local/var/log/urls.log" 8 | uri="$( 9 | grep -oP -e '((http|https|gopher|ftp|ftps|webdav|webdavs|dav|davs):(//)?[^ <>"\t]*|(www|ftp)[0-9]?\.[-a-z0-9.]+)[^ .,;\t\n\r<">\):]?[^, <>"\t]*[^ .,;\t\n\r<">\):]' "$file_uris" \ 10 | | menu.sh "dmenu2" ">"; 11 | )" 12 | 13 | test -n "$uri" || exit 1; 14 | 15 | if 16 | [ "$count" -eq 0 ] 17 | then 18 | setsid.sh xombrero "$uri" 19 | else 20 | xombrero -e "open $uri" 21 | fi 22 | 23 | # vim: set ft=sh : 24 | -------------------------------------------------------------------------------- /ARCHIVE/xorg-autolock-old: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Default xautolock program. 4 | 5 | exec daemonize xautolock \ 6 | -detectsleep \ 7 | -time 60 \ 8 | -locker "$XDG_BIN_HOME/xorg-lock" \ 9 | -nowlocker "$XDG_BIN_HOME/xorg-lock" \ 10 | -notify 60 \ 11 | -notifier "loggi 3 .misc.exlamation 'Screen is going to be locked'" 12 | 13 | # vim: set ft=sh : 14 | -------------------------------------------------------------------------------- /ARCHIVE/xorg-dpms-standby: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Set DPMS to standby state. 4 | 5 | sleep 1 6 | xset dpms force standby 7 | 8 | # vim: set ft=sh : 9 | -------------------------------------------------------------------------------- /ARCHIVE/xorg-export-xinfo: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Export the dbus session address on startup so it can be used by cron. 4 | # Based on: http://dev.gentoo.org/~tomka/mail.html 5 | # 6 | # other methode : source "${HOME}/.dbus/session-bus/$(dbus-uuidgen --get)" 7 | 8 | spool_dir=${XDG_VAR_HOME}/spool; 9 | 10 | > "${spool_dir}/xdbus"; 11 | chmod 600 "${spool_dir}/xdbus"; 12 | 13 | env \ 14 | | grep DBUS_SESSION_BUS_ADDRESS >> "${spool_dir}/xdbus"; 15 | 16 | printf '%s\n' "export DBUS_SESSION_BUS_ADDRESS" >> "${spool_dir}/xdbus"; 17 | 18 | # vim: set ft=sh : 19 | -------------------------------------------------------------------------------- /ARCHIVE/xorg-lock-old: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Default xlock program. 4 | 5 | case $1 in 6 | enable | disable) 7 | xautolock "-$1" 8 | exit 9 | ;; 10 | esac 11 | 12 | t() { 13 | xset -dpms 14 | s 15 | } 16 | 17 | s() { 18 | test "${X_DPI:-96}" -eq 96 || 19 | return 20 | 21 | spotify-mpris PlayPause 22 | mpc toogle 23 | } 2>/dev/null 24 | 25 | trap t INT TERM QUIT EXIT HUP 26 | xset +dpms dpms 3 3 3 27 | s 28 | i3lock \ 29 | --nofork \ 30 | --image="$XDG_DATA_HOME/wallpapers/current.wallpaper" \ 31 | --no-unlock-indicator \ 32 | --show-failed-attempts \ 33 | --tiling 34 | 35 | # vim: set ft=sh : 36 | -------------------------------------------------------------------------------- /ARCHIVE/xorg-rename-current-desktop: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # rename current desktop; manipulate _NET_DESKTOP_NAMES. 4 | 5 | read -r _ _ desk_current < <(xprop -root _NET_CURRENT_DESKTOP); 6 | 7 | xorg-set-desktop-name "$desk_current" "$(menu "dmenu2" ">" 0<&-)"; 8 | 9 | # vim: set ft=sh : 10 | -------------------------------------------------------------------------------- /ARCHIVE/xorg-set-desktop-name: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python2 2 | # 3 | # Helper for setting current desktop's name 4 | # http://superuser.com/questions/508128/is-it-possible-to-set-the-name-of-the-current-virtual-desktop-via-commandline 5 | 6 | import sys 7 | 8 | from xpybutil import conn, root 9 | 10 | import xpybutil.ewmh as ewmh 11 | 12 | if len(sys.argv) == 2 and sys.argv[1] == '--help': 13 | print "Usage: " 14 | print " set_desktop_name NAME_OF_NEW_DESKTOP - sets current desktop name" 15 | print " set_desktop_name NR NAME_OF_NEW_DESKTOP - sets name of NRth desktop" 16 | 17 | if len(sys.argv) > 2: 18 | desktop_offset = int(sys.argv[1]) 19 | new_name = sys.argv[2] 20 | 21 | else: 22 | desktop_offset = ewmh.get_current_desktop().reply() 23 | new_name = sys.argv[1] 24 | 25 | current_names = ewmh.get_desktop_names().reply() 26 | 27 | current_names[desktop_offset] = new_name 28 | 29 | # Not sure why I have to do it twice - somehow 30 | # doesn't work if I only call it once 31 | c = ewmh.set_desktop_names(current_names) 32 | c = ewmh.set_desktop_names(current_names) 33 | 34 | # vim: set ft=python : 35 | -------------------------------------------------------------------------------- /ARCHIVE/xorg-switch-keyboard-layout: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env dash 2 | # 3 | # Switch keyboard layout and take the necessary actions. 4 | # and do not use 'setxkbmap -option grp:alt_shift_toggle'. 5 | 6 | if 7 | xkblayout-state set +1 8 | then 9 | layout="$(xkblayout-state print "%s-%e")" 10 | # case "$X_XCLIENT" in 11 | # openbox) 12 | # for i in "${XDG_CONFIG_HOME}/openbox/${layout}"/* 13 | # do 14 | # ln -vsrf "$i" -t "${XDG_CONFIG_HOME}/openbox" 15 | # done 16 | # xdotool key Super_L+q && sleep 1 && xdotool key Super_L+b 17 | # ln -vsrf "${XDG_CONFIG_HOME}/xbindkeys/${layout}/xbindkeysrc_ob" \ 18 | # "${XDG_CONFIG_HOME}/xbindkeys/xbindkeysrc"; 19 | # return 0 20 | # ;; 21 | # bspwm|cwm|spectrwm|x-terminal-tabbed) 22 | # : 23 | # ;; 24 | # *) 25 | # X_XCLIENT=fallback 26 | # esac 27 | ln -vsrf "${XDG_CONFIG_HOME}/sxhkd/${layout}/sxhkdrc_${X_XCLIENT}" \ 28 | "${XDG_CONFIG_HOME}/sxhkd/sxhkdrc"; 29 | fi 30 | 31 | # vim: set ft=sh : 32 | -------------------------------------------------------------------------------- /ARCHIVE/xorg-touchpad: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Xorg: Disable or enable touchpad. 4 | 5 | exec xinput --"${1:?}" "ETPS/2 Elantech Touchpad" 6 | 7 | # vim: set ft=sh : 8 | -------------------------------------------------------------------------------- /ARCHIVE/xorg-uniconify-all-xwins.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env dash 2 | # 3 | # Unhide all xwindows on current desktop, and the active region of xwinreg. 4 | 5 | xwinreg-unhide-active-region.sh 6 | 7 | get-xids.sh \ 8 | | xwinpp -I - --hidden --desk=curr -p \ 9 | | xwinmo - -U; 10 | 11 | # vim: set ft=sh : 12 | -------------------------------------------------------------------------------- /ARCHIVE/xtermj1.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env dash 2 | # 3 | # Use xterm like kuake and yeahconsole terminal. 4 | # Source: https://wiki.archlinux.org/index.php/ \ 5 | # Urxvt#Improved_Kuake-like_behavior_in_Openbox 6 | 7 | id="$(cat /tmp/xtermj1)" 8 | 9 | if 10 | test -n "$id" && xprop -id "0x${id}" 1>/dev/null 2>&1; 11 | then 12 | if 13 | xprop -root _NET_CLIENT_LIST \ 14 | | fgrep -q "0x${id}"; 15 | then 16 | xdotool windowunmap "0x${id}" 17 | else 18 | wmctrl -i -a "0x${id}" 19 | fi 20 | else 21 | ( 22 | exec xterm -b 4 -name xtermj1 \ 23 | -e sh -c "printf '%x\n' \${WINDOWID} >/tmp/xtermj1;bash" & 24 | ) 25 | fi 26 | 27 | # vim: set ft=sh : 28 | -------------------------------------------------------------------------------- /ARCHIVE/xwinreg-close-active-region.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env dash 2 | # 3 | # xwinreg-close-active-region.sh 4 | 5 | xwinreg close -r active 6 | 7 | # vim: set ft=sh : 8 | -------------------------------------------------------------------------------- /ARCHIVE/xwinreg-cycle-anticlock.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env dash 2 | # 3 | # xwinreg-cycle-anticlock.sh 4 | 5 | xwinreg cycle -w -r any -d aclock 6 | 7 | # vim: set ft=sh : 8 | -------------------------------------------------------------------------------- /ARCHIVE/xwinreg-cycle-clock.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env dash 2 | # 3 | # xwinreg-cycle-clock.sh 4 | 5 | xwinreg cycle -w -r any -d clock 6 | 7 | # vim: set ft=sh : 8 | -------------------------------------------------------------------------------- /ARCHIVE/xwinreg-cycle-reg-clock.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env dash 2 | # 3 | # xwinreg-cycle-reg-clock.sh 4 | 5 | xwinreg cycle -d clock -k 6 | 7 | # vim: set ft=sh : 8 | -------------------------------------------------------------------------------- /ARCHIVE/xwinreg-cycle-reverse.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env dash 2 | # 3 | # xwinreg-cycle-reverse.sh 4 | 5 | xwinreg cycle -w -r any -d rev 6 | 7 | # vim: set ft=sh : 8 | -------------------------------------------------------------------------------- /ARCHIVE/xwinreg-focus-active-region.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env dash 2 | # 3 | # xwinreg-focus-active-region.sh 4 | 5 | xwinreg -f -r active 6 | 7 | # vim: set ft=sh : 8 | -------------------------------------------------------------------------------- /ARCHIVE/xwinreg-focus-toggle-next.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env dash 2 | # 3 | # xwinreg-focus-toggle-next.sh 4 | 5 | xwinreg focus-toggle -d next 6 | 7 | # vim: set ft=sh : 8 | -------------------------------------------------------------------------------- /ARCHIVE/xwinreg-focus-toggle-prev.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # xwinreg-focus-toggle-prev.sh 4 | 5 | xwinreg focus-toggle -d prev 6 | 7 | # vim: set ft=sh : 8 | -------------------------------------------------------------------------------- /ARCHIVE/xwinreg-grid-horizontal.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env dash 2 | # 3 | # xwinreg-grid-horizontal.sh 4 | 5 | xorg-get-xids.sh \ 6 | | xwinpp print -I - --visible -P 0 \ 7 | | xwinreg -I - -L 1,max,grid-horiz,alias:0,all; 8 | 9 | # vim: set ft=sh : 10 | -------------------------------------------------------------------------------- /ARCHIVE/xwinreg-grid-square-horizontal.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env dash 2 | # 3 | # xwinreg-grid-square-horizontal.sh 4 | 5 | get-xids.sh \ 6 | | xwinpp print -I - --visible -P 0 \ 7 | | xwinreg -I - -L 1,max,grid-square-horiz,alias:0,all; 8 | 9 | # vim: set ft=sh : 10 | -------------------------------------------------------------------------------- /ARCHIVE/xwinreg-grid-square-vertical.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env dash 2 | # 3 | # xwinreg-grid-square-vertical.sh 4 | 5 | xorg-get-xids.sh \ 6 | | xwinpp print -I - --visible -P 0 \ 7 | | xwinreg -I - -L 1,max,grid-square-verti,alias:0,all; 8 | 9 | # vim: set ft=sh : 10 | -------------------------------------------------------------------------------- /ARCHIVE/xwinreg-grid-vertical.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env dash 2 | # 3 | # xwinreg-grid-vertical.sh 4 | 5 | xorg-get-xids.sh \ 6 | | xwinpp print --visible -P 0 \ 7 | | xwinreg -I - -L 1,max,grid-verti,alias:0,all; 8 | 9 | # vim: set ft=sh : 10 | -------------------------------------------------------------------------------- /ARCHIVE/xwinreg-hide-active-region.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env dash 2 | # 3 | # xwinreg-hide-active-region.sh 4 | 5 | xwinreg hide -r active -A add 6 | 7 | # vim: set ft=sh : 8 | -------------------------------------------------------------------------------- /ARCHIVE/xwinreg-loop.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Do layouting dynamically (xev). 4 | 5 | win_active= 6 | win_active_old= 7 | 8 | while 9 | xev -root -event property \ 10 | | grep -q "(_NET_CLIENT_LIST).*state PropertyNewValue"; 11 | do 12 | read -r _ _ _ _ win_active < <( 13 | xprop -root -notype _NET_ACTIVE_WINDOW 14 | ) 15 | if 16 | [[ 17 | $(xprop -id "$win_active" WM_CLASS) =~ xtermj[12] || 18 | $(xprop -id "${win_active_old:-${win_active}}" WM_CLASS) =~ xtermj[12] 19 | ]] 20 | then 21 | : 22 | else 23 | if 24 | source "${XWINREG_TMP_FILE:-${TMPDIR:-/tmp}/xwinreg_default.tmp}" 25 | then 26 | if 27 | get-xids.sh \ 28 | | xwinpp print -I - --visible -D curr \ 29 | | ! xwinreg ${_xwinreg_options[command]}; 30 | then 31 | source <( 32 | get-xids.sh \ 33 | | xwinpp print -I - --visible -D curr -P 0; 34 | ) 35 | wmctrl -i -r "$_xwinpp_win_xid" -b "add,maximized_vert,maximized_horz" 36 | fi 37 | else 38 | get-xids.sh \ 39 | | xwinpp print -I - --visible -D curr -P end 40 | | xwinreg -I - -L 1,1,maxi,alias:0,west -L 2,max,horiz,alias:0,east; 41 | fi 42 | fi 43 | win_active_old=$win_active 44 | done 2>/dev/null 45 | 46 | # vim: set ft=sh : 47 | -------------------------------------------------------------------------------- /ARCHIVE/xwinreg-loop2.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Do layouting dynamically (xprop -spy -root). 4 | 5 | win_active= 6 | win_active_old= 7 | xids= 8 | 9 | xprop -spy -root _NET_CLIENT_LIST \ 10 | | { 11 | while 12 | read -r _ _ _ _ xids 13 | do 14 | read -r _ _ _ _ win_active < <( 15 | xprop -root _NET_ACTIVE_WINDOW 16 | ) 17 | if 18 | [[ 19 | $(xprop -id "$win_active" WM_CLASS) =~ xtermj[12] || 20 | $(xprop -id "${win_active_old:-${win_active}}" WM_CLASS) =~ xtermj[12] 21 | ]] 22 | then 23 | : 24 | else 25 | if 26 | source "${XWINREG_TMP_FILE:-${TMPDIR:-/tmp}/xwinreg_default.tmp}" 27 | then 28 | if 29 | printf '%s\n' ${xids//,/} \ 30 | | xwinpp print -I - --visible -D curr \ 31 | | ! xwinreg ${_xwinreg_options[command]}; 32 | then 33 | source <( 34 | printf '%s\n' ${xids//,/} \ 35 | | xwinpp print -I - --visible -D curr -P 0; 36 | ) 37 | wmctrl -i -r "$_xwinpp_win_xid" -b "add,maximized_vert,maximized_horz" 38 | } 39 | else 40 | printf '%s\n' ${xids//,/} \ 41 | | xwinpp print -I - --visible -D curr -P end \ 42 | | xwinreg -I - -L 1,1,maxi,alias:0,west -L 2,max,horiz,alias:0,east; 43 | fi 44 | fi 45 | win_active_old=$win_active 46 | done 2>/dev/null 47 | } 48 | 49 | # vim: set ft=sh : 50 | -------------------------------------------------------------------------------- /ARCHIVE/xwinreg-master-east.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env dash 2 | # 3 | # xwinreg-master-east.sh 4 | 5 | xorg-get-xids.sh \ 6 | | xwinpp print -I - --visible -P 0 \ 7 | | xwinreg -I - -L 1,1,maxi,alias:0,east -L 2,max,horiz,alias:0,west; 8 | 9 | # vim: set ft=sh : 10 | -------------------------------------------------------------------------------- /ARCHIVE/xwinreg-master-north.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env dash 2 | # 3 | # xwinreg-master-north.sh 4 | 5 | xorg-get-xids.sh \ 6 | | xwinpp print -I - --visible -P 0 \ 7 | | xwinreg -I - -L 1,1,maxi,alias:0,north -L 2,max,verti,alias:0,south; 8 | 9 | # vim: set ft=sh : 10 | -------------------------------------------------------------------------------- /ARCHIVE/xwinreg-master-south.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env dash 2 | # 3 | # xwinreg-master-south.sh 4 | 5 | xorg-get-xids.sh \ 6 | | xwinpp print -I - --visible -P 0 \ 7 | | xwinreg -I - -L 1,1,maxi,alias:0,south -L 2,max,verti,alias:0,north; 8 | 9 | # vim: set ft=sh : 10 | -------------------------------------------------------------------------------- /ARCHIVE/xwinreg-master-west.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env dash 2 | # 3 | # xwinreg-master-west.sh 4 | 5 | xorg-get-xids.sh \ 6 | | xwinpp print -I - --visible -P 0 \ 7 | | xwinreg -I - -L 1,1,maxi,alias:0,west -L 2,max,horiz,alias:0,east; 8 | 9 | # vim: set ft=sh : 10 | -------------------------------------------------------------------------------- /ARCHIVE/xwinreg-maximize-all.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env dash 2 | # 3 | # xwinreg-maximize-all.sh 4 | 5 | xorg-get-xids.sh \ 6 | | xwinpp print -I - --visible -P 0 \ 7 | | xwinreg -I - -L 1,max,maxi,alias:0,all; 8 | 9 | # vim: set ft=sh : 10 | -------------------------------------------------------------------------------- /ARCHIVE/xwinreg-unhide-active-region.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env dash 2 | # 3 | # xwinreg-unhide-active-region.sh 4 | 5 | xwinreg hide -r active -A remove 6 | 7 | # vim: set ft=sh : 8 | -------------------------------------------------------------------------------- /ARCHIVE/zettelkasten: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Run Zettelkasten. 4 | # 5 | 6 | java -jar /opt/java/Zettelkasten.jar 7 | 8 | # vim: set ft=sh : 9 | -------------------------------------------------------------------------------- /audio-player: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Default audio player (cli). 4 | 5 | IFS=\| 6 | set -f && 7 | set -- $AUDIO_PLAYER_OPTS ${1:+"$@"} && 8 | exec "$AUDIO_PLAYER" "$@" 9 | 10 | # vim: set ft=sh : 11 | -------------------------------------------------------------------------------- /backup-meta: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Backup my system. 4 | # 5 | # Commands: 6 | # - prepare | pp 7 | 8 | backup_dir=${XDG_BACKUP_HOME:?} 9 | 10 | [[ -d $backup_dir ]] || 11 | exit 1 12 | 13 | printf -v horiz %80s 14 | .hd() { 15 | printf '%s\n' "${horiz// /-}" "$1" "${horiz// /-}" 1>&2 16 | } 17 | 18 | apt() ( 19 | .hd apt 20 | 21 | command -- sudo rm -rv -- "$backup_dir/pkgs" 22 | command -- mkdir -pv -- "$backup_dir/pkgs" 23 | 24 | cd -- "$backup_dir/pkgs" || 25 | exit 1 26 | 27 | COLUMNS=200 command -- dpkg-query -l >./query.txt 28 | exec -- sudo sh -c ' 29 | command -- apt-cache policy >./cache.txt 30 | command -- apt-mark showauto >./auto.txt 31 | command -- apt-mark showmanual >./manual.txt 32 | # command -- cp -v /etc/apt/trusted.gpg ./trusted.gpg 33 | exec apt-clone clone . 34 | ' 35 | ) 36 | 37 | bin() ( 38 | .hd bin 39 | 40 | exec -- find /var/lib/dpkg/info/ \ 41 | -daystart \( -name \*.list -a -mtime -7 \) \ 42 | -printf '%f\n' | 43 | exec -- sed 's:.list$::' | 44 | command -- sort >"$backup_dir/7_days.txt" 45 | 46 | IFS=: 47 | set -f 48 | 49 | exec -- whatis -w \* $PATH /usr/bin/X11 2>&1 | 50 | exec -- sort -u >"$backup_dir/whatis.txt" 51 | ) 52 | 53 | # init() ( 54 | # .hd init 55 | 56 | # { 57 | # command -- find /etc/init.d/ -perm /111 -type f -printf '%f\n' 58 | # exec -- find /etc/init -type f -printf '%f\n' 59 | # } | 60 | # exec -- sort -u >"$backup_dir/init.txt" 61 | # ) 62 | 63 | cclean() ( 64 | .hd cclean 65 | 66 | exec -- cclean 67 | ) 68 | 69 | etckeeper() ( 70 | .hd etckeeper 71 | 72 | cd / || 73 | exit 1 74 | 75 | printf -v d %\(%s\)T -1 76 | exec -- sudo etckeeper commit "$d prepare backup" 77 | ) 78 | 79 | case $1 in 80 | prepare | pp) 81 | apt 82 | bin 83 | cclean 84 | etckeeper 85 | ;; 86 | esac 87 | 88 | # vim: set ft=zsh : 89 | -------------------------------------------------------------------------------- /bash-count-occurence: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Count most used commands from bash history. 4 | 5 | exec cut -d ' ' -f 1 -- "${HISTFILE:?}" | 6 | exec sort | 7 | exec uniq -c | 8 | command -- sort -nr 9 | 10 | # vim: set ft=sh : 11 | -------------------------------------------------------------------------------- /bash-dedup-history: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Remove duplicates from bash history and rewrite file. 4 | 5 | exec sed -e 's:^[[:space:][:cntrl:]]*::; s:[[:space:][:cntrl:]]*$::' -- "${HISTFILE:?}" | 6 | exec nl | 7 | exec sort -u -k 2 | 8 | exec sort -n | 9 | command -- cut -f 2 >"$HISTFILE.$$" 10 | 11 | test -s "$HISTFILE.$$" && 12 | exec mv -- "$HISTFILE.$$" "$HISTFILE" 13 | 14 | # vim: set ft=sh : 15 | -------------------------------------------------------------------------------- /binary2nibble: -------------------------------------------------------------------------------- 1 | #!/usr/bin/gawk -f 2 | # 3 | # Group binary numbers into nibbles (used with bc output). 4 | 5 | BEGIN { 6 | FPAT = "...." 7 | } 8 | 9 | { 10 | while (length%4) 11 | $0 = 0$0 12 | 13 | $1 = $1 14 | print $0 15 | } 16 | 17 | # vim: set ft=awk : 18 | -------------------------------------------------------------------------------- /bitbucket-rest-api: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Wrapper: Bitbucket REST API. 4 | 5 | . "$(command -v -- rest-api)" || 6 | exit 7 | 8 | server_address=${BITBUCKET_SERVER_ADDRESS:-https://bitbucket.wir.invalid} 9 | token=${BITBUCKET_REST_TOKEN:-$(exec cat -- "$HOME/.bitbucket-wir-invalid-read-read-token")} 10 | user=${BITBUCKET_REST_USER:-d630} 11 | 12 | unset -v \ 13 | BITBUCKET_REST_TOKEN \ 14 | BITBUCKET_REST_USER \ 15 | BITBUCKET_SERVER_ADDRESS 16 | 17 | curl() { 18 | exec curl -v -s \ 19 | --user "$user:$token" \ 20 | -X "$(echo "$method" | exec tr '[:lower:]' '[:upper:]')" \ 21 | "$server_address$endpoint" \ 22 | ${1:+"$@"} 23 | } 24 | 25 | get() { 26 | case $endpoint in 27 | projects | repos | users) 28 | endpoint=/rest/api/latest/$endpoint?limit=999 29 | ;; 30 | esac 31 | 32 | \curl 33 | } 34 | 35 | \main "$@" 36 | 37 | # vim: set ft=sh noexpandtab : 38 | -------------------------------------------------------------------------------- /bspot-create-featured-lists: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Take pub list1 and create audio-featured public lists. 4 | 5 | token=${1:?} 6 | file=${2:-${XDG_VAR_HOME:?}/lib/bspot/bspot_create_featured_list.sh} 7 | 8 | . "$file" || 9 | exit 1 10 | 11 | _list1=/tmp/$list1.json 12 | 13 | exec -- bspot getTracks "$list1" "$token" | 14 | exec -- cut -d : -f 3 | 15 | command -- bspot getTracksFeatures "$token" >"$_list1" 16 | 17 | for f in "${!Features[@]}"; do 18 | command -- bspot clearList "${Features[$f]}" "$token" 19 | exec -- jq -r ".audio_features[] | [.$f, .uri] | @tsv" "$_list1" | 20 | LC_ALL=C exec -- sort -k 1gr,1gr -k 2d,2d | 21 | exec -- cut -f 2 | 22 | command -- bspot addTracks "${Features[$f]}" "$token" 23 | done 24 | 25 | # vim: set ft=zsh : 26 | -------------------------------------------------------------------------------- /bspot-create-gpb-lists: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Take pub list1 and create public gpb lists. 4 | 5 | token=${1:?} 6 | file=${2:-${XDG_VAR_HOME:?}/lib/bspot/bspot_create_gpb_lists.bash} 7 | 8 | # wants: 9 | # -A dates[%s|playlist-id] 10 | # -a dates_sorted (newest first) 11 | # list1 12 | . "$file" || 13 | exit 1 14 | 15 | while read -r time uri; do 16 | for d in "${dates_sorted[@]}"; do 17 | ((time >= ${d%|*})) && 18 | dates[$d]+=$uri, && 19 | break 20 | done 21 | done < <( 22 | exec -- bspot getTracksObjects "$list1" "$token" | 23 | exec -- jq -r ' 24 | .items[] | 25 | "date --date=\(.added_at) +%s_\(([.track.artists[].uri]|join("/")))_\(.track.uri)" 26 | ' | 27 | exec -- xargs -I {} -P 4 -- sh -c {} | 28 | LC_ALL=C exec -- sort -t _ -k 1nr,1nr -k 2d,2d | 29 | exec -- sed 's/^\([^_]*\)_\([^_]*\)_\([^_]*\)$/\1 \3/' 30 | ) 31 | 32 | for k in "${!dates[@]}"; do 33 | list2=${k#*|} 34 | [[ $list2 == END ]] && 35 | continue 36 | mapfile -t -d , <<<"${dates[$k]}" 37 | command -- bspot clearList "$list2" "$token" 38 | for ((i = ${#MAPFILE[@]} - 2; i >= 0; i--)); do 39 | printf '%s\n' "${MAPFILE[$i]}" 40 | done | 41 | command -- bspot addTracks "$list2" "$token" 42 | done 43 | 44 | # vim: set ft=zsh : 45 | -------------------------------------------------------------------------------- /bspot-create-label: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Take pub list1 and sort it by label. 4 | 5 | list1=${1:?} 6 | list2=${2:?} 7 | token=${3:?} 8 | 9 | command -- bspot clearList "$list2" "$token" 10 | 11 | command -- bspot getAlbums "$list1" "$token" >/tmp/bspot_albums.txt 12 | exec cut -f 1 /tmp/bspot_albums.txt | 13 | exec cut -d : -f 3 | 14 | exec bspot getAlbumsObjects "$token" | 15 | command -- jq -e -r '.albums[].label | [.] | @sh' >/tmp/bspot_labels.txt 16 | 17 | test -s /tmp/bspot_albums.txt && test -s /tmp/bspot_labels.txt && 18 | exec paste /tmp/bspot_albums.txt /tmp/bspot_labels.txt | 19 | LC_ALL=C exec sort -k 3df,3df -k 1d,1d -k 2d,2d | 20 | exec cut -f 2 | 21 | command -- bspot addTracks "$list2" "$token" 22 | 23 | # vim: set ft=sh : 24 | -------------------------------------------------------------------------------- /bspot-create-not-playable: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Take pub list1 and create a list with unplayable tracks. 4 | 5 | list1=${1:?} 6 | list2=${2:?} 7 | token=${3:?} 8 | market=${4:-DE} 9 | 10 | list=/tmp/$list1.json 11 | 12 | command -- bspot getTracksInMarket "$list1" "$token" "$market" >"$list" 13 | 14 | command -- bspot clearList "$list2" "$token" 15 | 16 | exec jq -e -r '.items[] | if .track.is_playable then empty else .track.uri end' "$list" | 17 | command -- bspot addTracks "$list2" "$token" 18 | 19 | # vim: set ft=sh : 20 | -------------------------------------------------------------------------------- /bspot-create-release-date: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Take pub list1 and sort it by release_date. 4 | 5 | list1=${1:?} 6 | list2=${2:?} 7 | token=${3:?} 8 | 9 | command -- bspot clearList "$list2" "$token" 10 | 11 | command -- bspot getAlbums "$list1" "$token" >/tmp/bspot_albums.txt 12 | 13 | exec cut -f 1 /tmp/bspot_albums.txt | 14 | exec cut -d : -f 3 | 15 | exec bspot getAlbumsObjects "$token" | 16 | command -- jq -e -r '.albums[].release_date' >/tmp/bspot_labels.txt 17 | 18 | test -s /tmp/bspot_albums.txt && test -s /tmp/bspot_labels.txt && 19 | exec paste /tmp/bspot_albums.txt /tmp/bspot_labels.txt | 20 | LC_ALL=C exec sort -k 3d,3d -k 1d,1d -k 2d,2d | 21 | exec cut -f 2 | 22 | command -- bspot addTracks "$list2" "$token" 23 | 24 | # vim: set ft=sh : 25 | -------------------------------------------------------------------------------- /bspot-get-tracks: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Get track info of a public playlist. 4 | 5 | list=${1:?} 6 | token=${2:?} 7 | 8 | command -- bspot getTracksObjects "$list" "$token" >"/tmp/$list.json" 9 | 10 | exec jq -e -c ' 11 | .items[] | 12 | [ 13 | ([.track.artists[].name] | join(" / ") ), 14 | .track.name, .track.track_number, 15 | .track.disc_number, 16 | .track.album.name, 17 | .track.duration_ms, 18 | .track.uri, 19 | .added_at 20 | ] 21 | ' "/tmp/$list.json" | 22 | LC_ALL=en_US.UTF-8 command -- sort 23 | 24 | # vim: set ft=sh : 25 | -------------------------------------------------------------------------------- /bspot-shuffle-list: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Take pub list1, shuffle it and add the songs to cleared pub list2. 4 | 5 | list1=${1:?} 6 | list2=${2:?} 7 | token=${3:?} 8 | 9 | command -- bspot clearList "$list2" "$token" 10 | 11 | exec bspot getTracks "$list1" "$token" | 12 | exec shuf | 13 | command -- bspot addTracks "$list2" "$token" 14 | 15 | # vim: set ft=sh : 16 | -------------------------------------------------------------------------------- /cclean: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Clean up some dirs and files. 4 | 5 | command -- rm -frv -- \ 6 | "${HOME:?}/.adobe" \ 7 | "$HOME/.gconf" \ 8 | "$HOME/.git-credential-cache" \ 9 | "$HOME/.gnome2" \ 10 | "$HOME/.gnome2_private" \ 11 | "$HOME/.icedteaplugin" \ 12 | "$HOME/.macromedia" \ 13 | "$HOME/.thumbnails" \ 14 | "$HOME/.vifm/Trash/"* \ 15 | "$XDG_CONFIG_HOME/freshwrapper-data" \ 16 | "$XDG_DATA_HOME/webkit" \ 17 | "${XDG_CONFIG_HOME:?}/cef_user_data" \ 18 | "${XDG_DATA_HOME:?}/gegl-0.3" 19 | 20 | exec rm -fv -- \ 21 | "$HOME/.gksu.lock" \ 22 | "$XDG_CONFIG_HOME/newsboat/newsboat_cache.db" \ 23 | "$HOME/.recentf" \ 24 | "$HOME/.recently-used" \ 25 | "$XDG_DATA_HOME/recently-used.xbel" 26 | 27 | # vim: set ft=sh : 28 | -------------------------------------------------------------------------------- /checkout-all-wir-bare-repos: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Turn all downloaded wir bare git repositories into normal repos. 4 | 5 | src=${1:-$HOME/src/wir} 6 | 7 | exec find -H "$src" \ 8 | -mindepth 2 \ 9 | -maxdepth 2 \ 10 | -type d \ 11 | -print0 | 12 | command -- xargs -0 -n 1 -P 0 -- sh -c ' 13 | test -d "$1/.git" || 14 | exit 1 15 | 16 | export \ 17 | GIT_DIR \ 18 | GIT_WORK_TREE; 19 | GIT_WORK_TREE=$1 20 | GIT_DIR=$1/.git 21 | 22 | eval "$(exec git config --local --get --bool core.bare)" || 23 | exit 0 24 | 25 | command -- git config --local core.bare false 26 | command -- git config --local remote.origin.mirror false 27 | command -- git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" 28 | 29 | command -- git fetch origin 30 | 31 | head=$(exec git symbolic-ref --short HEAD) 32 | 33 | command -- git branch --set-upstream-to="origin/$head" "$head" 34 | 35 | command -- git checkout "$head" 36 | 37 | command -- git submodule sync --recursive 38 | exec git submodule update --init --recursive --jobs 12 39 | ' -- 40 | 41 | # vim: set ft=sh : 42 | -------------------------------------------------------------------------------- /chromium-history: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Browse the history of chromium via fzf, and then open selection. 4 | # 5 | # See: https://github.com/junegunn/fzf/wiki/Examples#browsing-history 6 | 7 | cols=$(($(exec tput cols) / 3)) 8 | sep={{::}} 9 | 10 | command -- cp -f -- "${XDG_CACHE_HOME:?}/run-chromium/Default/History" "$XDG_CACHE_HOME/h.chromium" 11 | 12 | __sqlite() { 13 | exec sqlite3 -separator "$sep" "$XDG_CACHE_HOME/h.chromium" " 14 | select substr(title, 1, $cols), url 15 | from urls 16 | order by last_visit_time desc" 17 | } 18 | 19 | __awk() { 20 | exec gawk -F "$sep" '{ printf "%-'$cols's \x1b[36m%s\n", $1, $2 }' 21 | } 22 | 23 | __chromium() { 24 | while IFS='' read -r REPLY; do 25 | command -- daemonize run-chromium "$REPLY" 26 | done 27 | } 28 | 29 | __sqlite | 30 | __awk | 31 | exec fzf --ansi --multi | 32 | exec sed 's#.*\(https*://\)#\1#' | 33 | __chromium 34 | 35 | # vim: set ft=sh : 36 | -------------------------------------------------------------------------------- /compose-my-confluence-how-to-article: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Compose my confluence how-to article in vim. 4 | 5 | set -e 6 | 7 | title=${1:?title missing} 8 | shift 1 9 | : "${1:?keyword missing}" 10 | keyword_list=$(printf -- '- %s\n' "$@") 11 | 12 | clean_title=$( 13 | printf "$title" | 14 | exec tr -cs '[:alnum:]-' - | 15 | exec tr '[:upper:]' '[:lower:]' 16 | ) 17 | : "${clean_title:?invalid title}" 18 | 19 | author=d630 20 | date_=$(exec date +%Y-%m-%d) 21 | doc_dir=$HOME/src/doc/how-to-articles 22 | if command -- test-ctty; then 23 | v=vim 24 | else 25 | v=gvim 26 | fi 27 | 28 | howto_dir=$doc_dir/$clean_title 29 | command -- mkdir -p "$howto_dir/asset" 30 | 31 | command -- cat >"$howto_dir/metadata.yaml" <"$howto_dir/article.pandoc.md" </dev/null 2>&1 & 10 | #setsid "$@" 11 | 12 | # vim: set ft=sh : 13 | -------------------------------------------------------------------------------- /daylight: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Test against daytime and adjust my theme config. 4 | 5 | f=${XDG_RUNTIME_DIR:?}/DAYLIGHT 6 | 7 | case $1 in 8 | dark | 1) 9 | command -- rm -f -- "$f" 10 | exec theme dark 11 | ;; 12 | light | 0) 13 | : >"$f" 14 | exec theme light 15 | ;; 16 | *) 17 | command -- test-daylight 18 | exec "$0" "$?" 19 | ;; 20 | esac 21 | 22 | # vim: set ft=sh : 23 | -------------------------------------------------------------------------------- /debian-dist-upgrade: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Dist-upgrade packages from Debian. 4 | 5 | exec sudo sh -c 'apt-get update && apt-get -y dist-upgrade' 6 | #sudo aptitude update && sudo aptitude full-upgrade; 7 | 8 | # vim: set ft=sh : 9 | -------------------------------------------------------------------------------- /debian-update-alternatives: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Update Debian alternatives. 4 | 5 | if test "$(exec id -u)" -ne 0; then 6 | echo 'damn. invoke me as root, please' 1>&2 7 | exit 1 8 | fi 9 | 10 | while IFS=' ' read -r a b c; do 11 | update-alternatives --install "$a" "$b" "$c" 100 12 | update-alternatives --set "$b" "$c" 13 | done <"/tmp/$file.$$" 15 | 16 | test -s "/tmp/$file.$$" && 17 | command -- mv -- "/tmp/$file.$$" "$log" && 18 | exec chmod 755 "$log" 19 | 20 | # vim: set ft=sh : 21 | -------------------------------------------------------------------------------- /download-rocketchat-entities: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Download Rocket.Chat user and channel list. 4 | 5 | dir=${XDG_VAR_HOME:?}/lib/rocketchat 6 | 7 | command -- mkdir -p -- "$dir" 8 | 9 | exec rest rocketchat get channels.list 2>/dev/null | 10 | exec jq -r .channels[].name | 11 | exec sort >"$dir/channels.list" & 12 | 13 | exec rest rocketchat get users.list 2>/dev/null | 14 | exec jq -r .users[].username | 15 | exec sort >"$dir/users.list" & 16 | 17 | wait 18 | 19 | # vim: set ft=sh noexpandtab : 20 | -------------------------------------------------------------------------------- /dudel: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Disk usage of unlinked, but still open files. 4 | # 5 | # Source: http://chneukirchen.org/dotfiles/bin/dudel 6 | 7 | exec find -L /proc/*/fd -maxdepth 1 -type f -links 0 -printf '%b %p\n' 2>/dev/null | 8 | while IFS=' ' read -r size fd; do 9 | pid=${fd#/proc/} 10 | pid=${pid%/fd/*} 11 | prog=$(exec readlink -- "/proc/$pid/exe") 12 | prog=${prog##*/} 13 | printf '%-10d %-10s %-20s %s\n' "$size" "$prog" "$fd" "$(exec readlink -- "$fd")" 14 | done | 15 | exec sort -r 16 | 17 | # vim: set ft=sh : 18 | -------------------------------------------------------------------------------- /emacsd: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Wrapper: emacs --daemon. 4 | 5 | exec /usr/bin/emacs --daemon "$@" 6 | 7 | # vim: set ft=sh : 8 | -------------------------------------------------------------------------------- /event: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Wrapper: Use taskwarrior in my 'event' context. 4 | 5 | TASKRC=$XDG_CONFIG_HOME/taskwarrior/taskrc-event exec task "$@" 6 | 7 | # vim: set ft=sh : 8 | -------------------------------------------------------------------------------- /event-editor: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Add a task to Taskwarrior ('event' context) via vim (yaml). 4 | 5 | export TASKRC=$XDG_CONFIG_HOME/taskwarrior/taskrc-event 6 | 7 | eval "$(exec date '+s=%s d=%Y-%m-%d t=%H:%M')" 8 | f=${TMPDIR:-${XDG_RUNTIME_DIR}/tmp}/$s.task 9 | 10 | trap 'exec rm -- "$f"' EXIT 11 | 12 | command -- cat >"$f" <