-
Notifications
You must be signed in to change notification settings - Fork 0
/
.bashrc
125 lines (98 loc) · 1.7 KB
/
.bashrc
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# Libraries
# =========
[[ -f /etc/bashrc ]] && source /etc/bashrc
[[ -f /etc/bash_completion ]] && source /etc/bash_completion
# Unsets
# ======
unset PROMPT_COMMAND
# Settings
# ========
shopt -s autocd
# Exports
# =======
export EDITOR=vis
export LANG=en_US.UTF-8
if [[ "$TERM" != dumb ]]; then
export PROMPT_COMMAND="echo -n -e '\x1b[5 q'"
fi
export OPEN=open
export PAGER=less
export PS1='$(basename "$(pwd)") % '
# Functions
# =========
bkp()
{
local repo
repo=$(basename "$(git remote get-url origin)")
git bundle create ~/scratch/"${repo%.git}" --all
}
cd()
{
builtin cd "$@" &&
if [[ -f initialize.sh ]]; then
if [[ -f .autoinit ]]; then
source initialize.sh
fi
fi
}
cm()
{
local files=("${@:1:$#-1}")
local extn=${!#}
for file in "${files[@]}"; do
echo "Processing $file"
if [[ $file != *.$extn ]]; then
ffmpeg -i "$file" "${file%.*}.$extn" &&
rm "$file"
fi &&
mat2 --inplace "${file%.*}.$extn"
done
}
dirty()
{
if ! git diff --quiet; then
git status --porcelain && g
fi
}
exts()
{
find . -type f | grep -oE '\.(\w+)$' | sort -u
}
g(){
git add -p &&
git commit -m "Fixups" &&
git push origin
}
inferno()
{
"$HOME"/src/inferno/Linux/386/bin/emu -g 1600x784 wm/wm
}
ll()
{
ls -lrt
}
mp3()
{
cm "$@" mp3
}
mp4()
{
cm "$@" mp4
}
pdf()
{
exiftool -all= -overwrite_original "$@"
}
plan9()
{
qemu-system-i386 -cdrom plan9.iso
}
rio()
{
spawn Xephyr -br -ac -noreset -screen 1600x784 -resizeable :1 && # 1920x964
sleep 0.1 &&
DISPLAY=:1 spawn rio
}
# Hacks
# =====
[[ -f "$HOME"/.hacks.sh ]] && source "$HOME"/.hacks.sh