| 1 | # Top Disk-Using directories |
| 2 | # TODO: Consider using numfmt instead of awk |
| 3 | tdu() { |
| 4 | du "$1" \ |
| 5 | | sort -n -k 1 -r --parallel="$(nproc)" \ |
| 6 | | head -50 \ |
| 7 | | awk ' |
| 8 | { |
| 9 | size = $1 |
| 10 | path = $0 |
| 11 | sub("^" $1 "\t+", "", path) |
| 12 | gb = size / 1024 / 1024 |
| 13 | printf("%f\t%s\n", gb, path) |
| 14 | }' \ |
| 15 | | cut -c 1-115 |
| 16 | } |
| 17 | |
| 18 | pa_def_sink() { |
| 19 | pactl info | awk '/^Default Sink:/ {print $3}' |
| 20 | } |
| 21 | |
| 22 | void_pkgs() { |
| 23 | curl "https://xq-api.voidlinux.org/v1/query/x86_64?q=$1" | jq '.data' |
| 24 | } |
| 25 | |
| 26 | # Colorful man |
| 27 | man() { |
| 28 | LESS_TERMCAP_md=$'\e[01;31m' \ |
| 29 | LESS_TERMCAP_me=$'\e[0m' \ |
| 30 | LESS_TERMCAP_se=$'\e[0m' \ |
| 31 | LESS_TERMCAP_so=$'\e[01;44;33m' \ |
| 32 | LESS_TERMCAP_ue=$'\e[0m' \ |
| 33 | LESS_TERMCAP_us=$'\e[01;32m' \ |
| 34 | command man "$@" |
| 35 | } |
| 36 | |
| 37 | experiment() { |
| 38 | cd "$($HOME/bin/experiment $@)" || exit 1 |
| 39 | } |
| 40 | |
| 41 | hump() { |
| 42 | ledit -l $(stty size | awk '{print $2}') ocaml $@ |
| 43 | } |
| 44 | |
| 45 | howto() { |
| 46 | cat $(ls -1 -d $HOME/Archives/Documents/HOWTOs/* | fzf) |
| 47 | } |
| 48 | |
| 49 | gh_fetch_repos() { |
| 50 | curl "https://api.github.com/$1/$2/repos?page=1&per_page=10000" |
| 51 | } |
| 52 | |
| 53 | gh_clone() { |
| 54 | gh_fetch_repos "$1" "$2" \ |
| 55 | | jq --raw-output '.[] | select(.fork | not) | .git_url' \ |
| 56 | | parallel -j 25 \ |
| 57 | git clone {} |
| 58 | } |
| 59 | |
| 60 | gh_clone_user() { |
| 61 | gh_clone 'users' "$1" |
| 62 | } |
| 63 | |
| 64 | gh_clone_org() { |
| 65 | gh_clone 'orgs' "$1" |
| 66 | } |
| 67 | |
| 68 | work_log_template() { |
| 69 | cat << EOF |
| 70 | $(date +%F) |
| 71 | ========== |
| 72 | |
| 73 | Morning report |
| 74 | -------------- |
| 75 | |
| 76 | ### Previous |
| 77 | |
| 78 | ### Current |
| 79 | |
| 80 | ### Blockers |
| 81 | |
| 82 | Day's notes |
| 83 | ----------- |
| 84 | EOF |
| 85 | } |
| 86 | |
| 87 | work_log() { |
| 88 | mkdir -p "$DIR_WORK_LOG" |
| 89 | file_work_log_today="${DIR_WORK_LOG}/$(date +%F).md" |
| 90 | if [ ! -f "$file_work_log_today" ] |
| 91 | then |
| 92 | work_log_template > "$file_work_log_today" |
| 93 | fi |
| 94 | vim "$file_work_log_today" |
| 95 | |
| 96 | } |
| 97 | |
| 98 | weather() { |
| 99 | curl "http://wttr.in/$WEATHER_LOCATION" |
| 100 | } |
| 101 | |
| 102 | bt_devs_paired() { |
| 103 | bluetoothctl -- paired-devices \ |
| 104 | | awk '{print $2}' \ |
| 105 | | xargs bluetoothctl -- info |
| 106 | } |
| 107 | |
| 108 | bt_devs() { |
| 109 | bluetoothctl -- devices \ |
| 110 | | awk '{print $2}' \ |
| 111 | | xargs bluetoothctl -- info |
| 112 | } |