alphebatize functions
authorIan Kelling <ian@iankelling.org>
Sun, 31 Jul 2016 17:45:04 +0000 (10:45 -0700)
committerIan Kelling <ian@iankelling.org>
Thu, 4 May 2017 23:40:14 +0000 (16:40 -0700)
.bashrc

diff --git a/.bashrc b/.bashrc
index b906d2e5b8560b476f646a1012e481d9554d90e3..d2b80bf96a4042514a5c7c1675c31af23fb32fdb 100644 (file)
--- a/.bashrc
+++ b/.bashrc
@@ -110,6 +110,28 @@ if [[ $INSIDE_EMACS ]]; then
     # scp completion does not work, but this doesn't fix it. todo, figure this out
     complete -r scp &> /dev/null
     # todo, remote file completion fails, figure out how to turn it off
+    export NODE_DISABLE_COLORS=1
+    # This get's rid of ugly terminal escape chars in node repl
+    # sometime, I'd like to have completion working in emacs shell for node
+    # the offending chars can be found in lib/readline.js,
+    # things that do like:
+    # stream.write('\x1b[' + (x + 1) + 'G');
+    # We can remove them and keep readline, for example by doing this
+    # to start a repl:
+    #!/usr/bin/env nodejs
+    # var readline = require('readline');
+    # readline.cursorTo = function(a,b,c) {};
+    # readline.clearScreenDown = function(a) {};
+    # const repl = require('repl');
+    # var replServer = repl.start('');
+    #
+    # no prompt, or else readline complete seems to be confused, based
+    # on our column being different? node probably needs to send
+    # different kind of escape sequence that is not ugly. Anyways,
+    # completion doesn't work yet even with the ugly prompt, so whatever
+    #
+    export NODE_NO_READLINE=1
+
 fi
 
 
@@ -229,13 +251,6 @@ unalias ls ll grep &>/dev/null ||:
 #####################
 
 
-mkdir() { command mkdir -p "$@"; }
-
-
-# fast commit all
-ic() {
-    git commit -am "$*"
-}
 
 
 # file cut copy and paste, like the text buffers :)
@@ -258,37 +273,10 @@ fpst() { # file paste
     cp "$my_f_tempdir"/* "$target"
 }
 
-# history search
-k() { grep -P --binary-files=text "$@" ${HISTFILE:-~/.bash_history}  | tail -n 40; }
-
-# horizontal row. used to break up output
-hr() { printf "$(tput setaf 5)█$(tput sgr0)%.0s" $(seq $COLUMNS); }
-
-
-# insensitive find
-ifn () {
-    find -L . -iname "*$**" 2>/dev/null
-}
-
-# test existence / exists
-te() {
-    local ret=0
-    for x in "$@"; do
-        [[ -e "$x" || -L "$x" ]] || ret=1
-    done
-    return $ret
-}
 
 # todo, update this
 complete -F _longopt la lower low rlt rld rl lld ts ll dircp ex fcp fct fpst gr
 
-# use sb instead of s is for sudo redirections, eg. sb 'echo "ok fine" > /etc/file'
-sb() {
-    local SUDOD="$PWD"
-    sudo -i bash -c "$@"
-}
-complete -F _root_command s sb
-
 
 _cdiff-prep() {
     # join options which are continued to multiples lines onto one line
@@ -612,7 +600,6 @@ grr() {
     fi
 }
 
-
 hl() { # history limit. Write extra history to archive file.
     # todo: this is not working or not used currently
     local max_lines linecount tempfile prune_lines x
@@ -636,6 +623,12 @@ hl() { # history limit. Write extra history to archive file.
     fi
 }
 
+hr() { # horizontal row. used to break up output
+    printf "$(tput setaf 5)█$(tput sgr0)%.0s" $(seq $COLUMNS)
+    echo
+}
+
+
 i() { git "$@"; }
 # modified from ~/local/bin/git-completion.bash
 # other completion commands are mostly taken from bash_completion package
@@ -649,8 +642,17 @@ if ! type service &>/dev/null; then
     }
 fi
 
+ic() {
+    # fast commit all
+    git commit -am "$*"
+}
 
 
+ifn () {
+    # insensitive find
+    find -L . -iname "*$**" 2>/dev/null
+}
+
 
 if [[ $OS == Windows_NT ]]; then
     # cygstart wrapper
@@ -718,6 +720,12 @@ lower() { # make first letter of filenames lowercase.
     done
 }
 
+
+k() { # history search
+    grep -P --binary-files=text "$@" ${HISTFILE:-~/.bash_history}  | tail -n 40;
+}
+
+
 make-targets() {
     # show make targets, via http://stackoverflow.com/questions/3063507/list-goals-targets-in-gnu-make
     make -qp | awk -F':' '/^[a-zA-Z0-9][^$#\/\t=]*:([^=]|$)/ {split($1,A,/ /);for(i in A)print A[i]}'
@@ -735,6 +743,7 @@ mkc() {
     c "$1"
 }
 
+mkdir() { command mkdir -p "$@"; }
 
 pakaraoke() {
     # from http://askubuntu.com/questions/456021/remove-vocals-from-mp3-and-get-only-instrumentals
@@ -879,9 +888,15 @@ safe_rename() {
     fi
 }
 
-sdf() {
-    c /sdx/test/sandbox/
+
+sb() { # sudo bash -c
+    # use sb instead of s is for sudo redirections,
+    # eg. sb 'echo "ok fine" > /etc/file'
+    local SUDOD="$PWD"
+    sudo -i bash -c "$@"
 }
+complete -F _root_command s sb
+
 
 ser() {
     local s; [[ $EUID != 0 ]] && s=sudo
@@ -998,6 +1013,15 @@ tclock() {
 }
 
 
+te() {
+    # test existence / exists
+    local ret=0
+    for x in "$@"; do
+        [[ -e "$x" || -L "$x" ]] || ret=1
+    done
+    return $ret
+}
+
 tm() {
     # timer in minutes
     (sleep $(calc "$@ * 60") && mpv --volume 50 /a/bin/data/alarm.mp3) > /dev/null 2>&1 &
@@ -1301,6 +1325,9 @@ fi
 # based on warning from rvmsudo
 export rvmsudo_secure_path=1
 
+# for other script I wrote
+export ACME_TINY_PATH=/a/opt/acme-tiny
+export lt ACME_TINY_WRAPPER_CERT_DIR=/p/c/machine_specific/$HOSTNAME
 
 if [[ -s "/usr/local/rvm/scripts/rvm" ]]; then
     source "/usr/local/rvm/scripts/rvm"
@@ -1308,6 +1335,10 @@ elif [[ -s $HOME/.rvm/scripts/rvm ]]; then
     source $HOME/.rvm/scripts/rvm
 fi
 
+mkdir -p ~/.npm-global
+npm config set prefix '~/.npm-global'
+path_add --end ~/.npm-global
+
 # https://wiki.archlinux.org/index.php/Xinitrc#Autostart_X_at_login
 # i added an extra condition as gentoo xorg guide says depending on
 # $DISPLAY is fragile.