-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.functions.sh
56 lines (46 loc) · 1.05 KB
/
.functions.sh
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
#!/usr/bin/env bash
function ver() {
echo "${BASH_VERSION:-unknown}"
}
function dict() {
curl "dict://dict.org/d:$1"
}
# always do `ls` after `cd`
function cd() {
builtin cd "$@"; ls;
}
# makes new dir and jumps to dir
function mcd() {
mkdir -p "$1" && cd "$1";
}
# moves file to trash
function trash() {
command mv "$@" ~/.Trash;
}
# open file in MacOS Quicklook Preview
function ql() {
qlmanage -p "$*" >& /dev/null;
}
# git ignore (https://www.gitignore.io/docs)
function gi() {
curl -L -s "https://www.gitignore.io/api/$@";
}
function git_prune() {
local pattern=${1:-""}
if [[ -z "$pattern" ]]; then
echo 'branch pattern expected!'
else
echo "$ git branch -d $(git branch | grep -E "$pattern")"
git branch -d $(git branch | grep -E "$pattern")
fi
}
# list process owned by my user
function my_ps() {
ps $@ -u $USER -o uid,pid,%cpu,%mem,start,time,command;
}
function iii() {
echo "$(uname -av)"
echo "CPU: $(sysctl -n machdep.cpu.brand_string)"
echo "OS: $(sysctl -n machdep.cpu.brand_string)"
echo "Kernel: $(sysctl -n kern.version)"
}