-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.functions
35 lines (28 loc) · 1.11 KB
/
.functions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# function names starts with comma
# that way we prevent overwhelming the global namespace
# plus, it makes it easier to find them: just type "," + <tab> key
# @brandon-rhodes style
,words () {
http api.datamuse.com/words "$1" max=="${2:-5}" | jq ".[] | .word"
}
,genpass () {
gpg -a --gen-random 0 "${1:-12}"
}
,pwnedpass () {
digest=$(echo -n $1 | sha1sum | head -c40)
curl -sL api.pwnedpasswords.com/range/${digest:0:5} | grep -i ${digest:5} | cut -d":" -f2
}
,traceroute-mapper() {
xdg-open "https://stefansundin.github.io/traceroute-mapper/?trace=$(traceroute -q1 $* | sed ':a;N;$!ba;s/\n/%0A/g')"
}
,manex() {
man --pager="less -p ^EXAMPLE" $1
}
,colors () {
for i in {0..255}; do
printf "\x1b[38;5;${i}mcolor%-5i\x1b[0m" $i ;
if ! (( ($i + 1 ) % 8 )); then echo ; fi ;
done
}
,summ-web() { curl -sL $1 | strip-tags "${2:-body}" | llm -s "summarize the following text in the language it is written:" | fmt }
,summ-video() { vid=$1; lang=${2:-es}; yt-dlp -q --write-auto-sub --sub-lang $lang --skip-download -o sub $vid && llm -s "summarize" < sub.$lang.vtt | fmt && rm sub.$lang.vtt }