-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions
94 lines (76 loc) · 2.39 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
function skim() {
open -a Skim $1
}
function latexme() {
latex $1;
NAME=`echo "$1" | cut -f 1 -d '.'`;
PDFNAME=$NAME".pdf"
echo $NAME;
dvipdf $NAME".dvi" > $PDFNAME ;
}
function texmath() {
touch $1
echo '\\documentclass[12pt]{article}' >> $1
echo '\\usepackage{mathtools}' >> $1
echo '\\setlength{\\parindent}{0pt}' >> $1
echo '\\begin{document}' >> $1
\echo '\\end{document}' >> $1
}
function texessay() {
touch $1
echo '\\documentclass[12pt]{article}' >> $1
echo '\\begin{document}' >> $1
\echo '\\end{document}' >> $1
}
function gitrmbunch() {
git ls-files | grep $1 | xargs git rm
}
function jcr() {
javac $1;
java $(basename $1 .java);
}
function gcr() {
if g++ -std=c++14 -Wall "$@" -o out; then
./out
fi
}
function editdot {
vim "$HOME/dotfiles/$1"
}
function sourcedot {
source "$HOME/dotfiles/$1"
}
function test_api {
ENVIRONMENT=test py.test "$@" --log ERROR
}
function pytags {
ctags -R --extras=+f --fields=+l --languages=python --python-kinds=-iv -f ./tags $(python -c "import os, sys; print(' '.join(str(d) for d in sys.path if os.path.isdir(d)) + ' ./')")
}
# https://github.com/ranger/ranger/blob/master/examples/bash_automatic_cd.sh
# Compatible with ranger 1.4.2 through 1.7.*
#
# Automatically change the directory in bash after closing ranger
#
# This is a bash function for .bashrc to automatically change the directory to
# the last visited one after ranger quits.
# To undo the effect of this function, you can type "cd -" to return to the
# original directory.
function ranger-cd {
tempfile="$(mktemp -t tmp.XXXXXX)"
ranger --choosedir="$tempfile" "${@:-$(pwd)}"
test -f "$tempfile" &&
if [ "$(cat -- "$tempfile")" != "$(echo -n `pwd`)" ]; then
cd -- "$(cat "$tempfile")"
fi
rm -f -- "$tempfile"
}
# function snc {
# if [ -z "$1" ]
# then
# echo "No arg passed"
# else
# rsync -avzh "/Users/zhiyan/courses/$1/" "z2foo@linux.student.cs.uwaterloo.ca:/u0/z2foo/$1/"
# fi
# }
# ["trigger", "/Users/zhiyan/tulip/tulip/environments/cloud/services/src/tulip/ingressadjuster", {
# "name": "ingressadjuster", "command": ["rsync", "-avzh", "/Users/zhiyan/tulip/tulip/environments/cloud/services/src/tulip/ingressadjuster", "ubuntu@deploy.bulb.cloud:/home/ubuntu/zhiyan/tulip/environments/cloud/services/src/tulip/ingressadjuster"]}]