-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
functions
executable file
·107 lines (81 loc) · 2.94 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# make plan9 walk available on all systems
walk() {
if command -v walk >/dev/null 2>&1; then
/usr/local/bin/walk $@
elif command -v fd >/dev/null 2>&1; then
fd -c never .
else
find .
fi
}
# Calculator
calc() { echo "scale=5;$*" | bc -l; }
r()
{
local dst="$(command vifm --choose-dir - ".")"
if [ -z "$dst" ]; then
echo 'Directory picking cancelled/failed'
return 1
fi
cd "$dst"
}
# f() {
# fff "$@"
# cd "$(cat "${XDG_CACHE_HOME:=${HOME}/.cache}/fff/.fff_d")"
# }
#dirsize - finds directory sizes and lists them for the current directory
dirsize() {
du -shx -- * .[a-zA-Z0-9_]* 2>/dev/null | grep -E '^ *[0-9.]*[MG]' | sort -n >/tmp/list
grep -E '^ *[0-9.]*M' /tmp/list
grep -E '^ *[0-9.]*G' /tmp/list
rm /tmp/list
}
#myip - finds your current IP if your connected to the internet
myip() {
lynx -dump -hiddenlinks=ignore -nolist http://checkip.dyndns.org:8245/ | awk '{ print $4 }' | sed '/^$/d; s/^[ ]*//g; s/[ ]*$//g'
}
# define a word
define() { curl -s "dict://dict.org/d:$1" | grep -v '^[0-9]'; }
man() { /bin/man $@ || awman "$@"; }
# Create a shell function as a wrapper
viminfo() { ${EDITOR:-vi} -R -M -c "Info $1 $2" +only; }
# Alias info to our new function
# alias info=viminfo
notegrep() { ${EDITOR:-vi} -c "NGrep $*"; }
fn() { ${EDITOR:-vim} $(rg -n '.*' "$HOME/Documents/org/" | fzf --layout=reverse --height 50% --ansi | sed -E 's/(.*):([0-9]+):.*/\1 +\2/g'); }
fr() { ${EDITOR:-vim} $(rg -n '.*' "$HOME/.config/remind/" | fzf --layout=reverse --height 50% --ansi | sed -E 's/(.*):([0-9]+):.*/\1 +\2/g'); }
cpuspeed() { cpupower frequency-info -fm | grep -oP '(?<=frequency: )([^ ]+ [^ ]+)'; }
powernow() { echo "scale=5;$(cat /sys/class/power_supply/BAT0/power_now)/1000000" | bc -l; }
onecpu() { echo 0 | sudo tee /sys/devices/system/cpu/cpu*/online; }
allcpu() { echo 1 | sudo tee /sys/devices/system/cpu/cpu*/online; }
# may remove if I never end up using it
fzjq() {
echo '' | fzf --print-query --preview "jq {q} \"$*\""
}
fzrec() {
echo '' | fzf --print-query --preview "recsel {q} $*"
}
fzndb() {
echo '' | fzf --print-query --preview "ndbquery -f $* atomicnumber {q}"
}
fzawk() {
echo '' | fzf --layout=reverse --height 50% --print-query --preview 'echo "a\nb\nc\nd" | awk {q}'
}
fzR() {
echo '' | fzf --layout=reverse --height 50% --print-query --preview 'R -s -e {q}'
}
sk() {
screenkey --no-systray -t 2 -p fixed -g '420x61+3300+54'
}
pdfappend() {
gs -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -dAutoRotatePages=/None -dAutoFilterColorImages=false -dAutoFilterGrayImages=false -dColorImageFilter=/FlateEncode -dGrayImageFilter=/FlateEncode -dDownsampleMonoImages=false -dDownsampleGrayImages=false -sOutputFile=fileAll.pdf $* &&
echo "created fileAll.pdf"
}
9start () {
qemu-system-x86_64 -cpu host -enable-kvm -m 1024 \
-net nic,model=virtio,macaddr=52:54:00:00:EE:03 -net user \
-device virtio-scsi-pci,id=scsi \
-drive if=none,id=vd0,file=9front.qcow2.img \
-device scsi-hd,drive=vd0
}
#vim:ft=sh