Add TODO to consider using numfmt
[khome.git] / lib / login_functions.sh
CommitLineData
c7de24d9 1# Top Disk-Using directories
58bdbfbf 2# TODO: Consider using numfmt instead of awk
c7de24d9
SK
3tdu() {
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
18pa_def_sink() {
19 pactl info | awk '/^Default Sink:/ {print $3}'
20}
21
22void_pkgs() {
23 curl "https://xq-api.voidlinux.org/v1/query/x86_64?q=$1" | jq '.data'
24}
25
26# Colorful man
27man() {
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}
64ec9f23
SK
36
37experiment() {
38 cd "$($HOME/bin/experiment $@)"
39}
801dd7bd
SK
40
41hump() {
42 ledit -l $(stty size | awk '{print $2}') ocaml $@
43}
632b7c4a
SK
44
45howto() {
39b8a1f7 46 cat $(ls -1 -d $HOME/Archives/Documents/HOWTOs/* | fzf)
632b7c4a 47}
f4e0bb58
SK
48
49gh_fetch_repos() {
50 curl "https://api.github.com/$1/$2/repos?page=1&per_page=10000"
51}
52
53gh_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
60gh_clone_user() {
61 gh_clone 'users' "$1"
62}
63
64gh_clone_org() {
65 gh_clone 'orgs' "$1"
66}
e09a8d5a 67
c45bdb58
SK
68work_log_template() {
69cat << EOF
70$(date +%F)
71==========
72
73Morning report
74--------------
75
c44fbbc2 76### Previous
c45bdb58 77
c44fbbc2 78### Current
c45bdb58
SK
79
80### Blockers
81
82Day's notes
83-----------
84EOF
85}
86
87work_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
e09a8d5a
SK
98weather() {
99 curl "http://wttr.in/$WEATHER_LOCATION"
100}
This page took 0.041011 seconds and 4 git commands to generate.