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