shopt -s globstar
-# inside emacs fixes
+# inside emcas fixes
if [[ $RLC_INSIDE_EMACS ]]; then
# EMACS is used by bash on startup, but we don't need it anymore.
# plus I hit a bug in a makefile which inherited it
bitcoin-cli -$(s grep rpcuser= $f) -$(s grep rpcpassword= $f) "$@"
}
+btcusd() {
+ local price
+ price="$(curl -s https://blockchain.info/ticker | jq .USD.last)"
+ printf "$%s\n" "$price"
+ if [[ $1 ]]; then
+ printf "$%.2f\n" "$(echo "scale=2; $price * $1"| bc -l)"
+ fi
+}
+
+# c. better cd
if [[ $RLC_INSIDE_EMACS ]]; then
- c() { wcd -z 50 -o "$@"; }
+ c() { wcd -c -z 50 -o "$@"; }
else
# lets see what the fancy terminal does from time to time
- c() { wcd -z 50 "$@"; }
+ c() { wcd -c -z 50 "$@"; }
fi
caa() { git commit --amend --no-edit -a; }
echo "${p%%/.git}"
}
-# quit will prompt if the program crashes.
-gmacs() { gdb -ex=r -ex=quit --args emacs "$@"; r; }
+gmacs() {
+ # quit will prompt if the program crashes.
+ gdb -ex=r -ex=quit --args emacs "$@"; r;
+}
+
+gdkill() {
+ # kill the emacs daemon
+ pk1 emacs --daemon
+}
gse() {
git send-email --notes '--envelope-sender=<ian@iankelling.org>' \
find "${pathArray[@]}" -iname "*$1*"
}
+pk1() {
+ local pid
+ pid=($(pgrep -f "$*"))
+ case ${#pid[@]} in
+ 1)
+ ps -F $pid
+ m kill $pid
+ ;;
+ 0) echo "no pid found" ;;
+ *)
+ ps -F ${pid[@]}
+ ;;
+ esac
+}
+
pick-trash() {
# trash-restore lists everything that has been trashed at or below CWD
# This picks out files just in CWD, not subdirectories,
(sleep $(calc "$@ * 60") && mpv --volume 50 /a/bin/data/alarm.mp3 --loop=no) > /dev/null 2>&1 &
}
-ts() { # start editing a new file
- [[ $# != 1 ]] && echo "I need a filename." && return 1
- local quiet
- if [[ $- != *i* ]]; then
- quiet=true
- fi
- if [[ $1 == *.c ]]; then
- e '#include <stdio.h>' >"$1"
- e '#include <stdlib.h>' >>"$1"
- e 'int main(int argc, char * argv[]) {' >>"$1"
- e ' printf( "hello world\n");' >>"$1"
- e ' return 0;' >>"$1"
- e '}' >>"$1"
- e "${1%.c}: $1" > Makefile
- e " g++ -ggdb -std=gnu99 -o ${1%.c} $<" >> Makefile
- e "#!/bin/bash" >run.sh
- e "./${1%.c}" >>run.sh
- chmod +x run.sh
- elif [[ $1 == *.java ]]; then
- e "public class ${1%.*} {" >"$1"
- e ' public static void main(String[] args) {' >>"$1"
- e ' System.out.println("Hello, world!");' >>"$1"
- e ' }' >>"$1"
- e '}' >>"$1"
- else
- echo "#!/bin/bash" > "$1"
- chmod +x "$1"
- fi
- [[ $quiet ]] || g "$1"
-}
-
tu() {
local s;