diff options
Diffstat (limited to 'mtr.misc.subr.sh')
| -rw-r--r-- | mtr.misc.subr.sh | 213 |
1 files changed, 0 insertions, 213 deletions
diff --git a/mtr.misc.subr.sh b/mtr.misc.subr.sh deleted file mode 100644 index 268b1c9..0000000 --- a/mtr.misc.subr.sh +++ /dev/null @@ -1,213 +0,0 @@ -updatevimrc() { - OLDWD="$(pwd)" - cd $HOME - git clone https://git.riedstra.us/mitch/vim-cfg .vim - if [ $? -gt 0 ] ; then - cd $HOME/.vim - git pull origin master - else - cd $HOME/.vim - fi - ./setup.sh && \ - ./link-vimrc.sh - cd $OLDWD -} - - -# Run Steam -unfuck_steam() { -LD_PRELOAD='/usr/$LIB/libstdc++.so.6 /usr/$LIB/libgcc_s.so.1 /usr/$LIB/libxcb.so.1 /usr/$LIB/libgpg-error.so' /usr/bin/steam -} -counter_figlet() { -COUNTER="1"; while true ; do figlet "$COUNTER" ; COUNTER="$(echo $COUNTER+1 |bc )" ; sleep 1 ; clear ; done -} -counter_single_line() { -COUNTER="1"; while true ; do sleep 1 ; printf "\t$COUNTER\r" ; COUNTER="$(echo $COUNTER+1 |bc )" ; done -} - -pulltermcolors() { - file="$HOME/bin/terminal-colors" - if ! [ -d $HOME/bin ] ; then - mkdir $HOME/bin - fi - pull -u ${UPDATE_URL}/terminal-colors -f $file - chmod +x $file -} - -pkg_switch_branch() { - _f="/etc/pkg/FreeBSD.conf" - cp $_f ${_f}.orig - sed -e's/quarterly/latest/' < ${_f}.orig > ${_f} -} - -find_most_recent_python() { -_python="$(which python2 2>/dev/null)" -$_python -c 'import os - -max_mtime = 0 -for dirname,subdirs,files in os.walk("."): - for fname in files: - full_path = os.path.join(dirname, fname) - mtime = os.stat(full_path).st_mtime - if mtime > max_mtime: - max_mtime = mtime - max_dir = dirname - max_file = fname - -print max_dir, max_file' -} - - - -install_tmx() { -location="/usr/local/bin/tmx" -if ! [ -z $1 ]; then - location="$1" -fi - -TMP=$(mktemp) -pull -u "https://www.rygel.us/etc/tmx.sh" -o "$TMP" -install -m 555 "$TMP" "$location" && echo "Installed to $location" -} - -find_most_recent() { - if [ "$(uname)" != 'linux'] ; then - path="0" - while [ $# -gt 0 ] ; do - case $1 in - -p) - path="$2"; shift; shift; ;; - esac - done - if [ $path = "0" ] ; then - find "$path" -printf "%T@ %Tc %p\n" | sort -n - else - echo "You need to specify a path with -p" - fi - else - echo "GNU Find only" - fi -} - -startup_zram() { - size="512M" - - while [ $# -gt 0 ] ; do - case $1 in - -s) - size="$2" - shift; shift; ;; - *) - echo "Unknown option $1" - shift; ;; - esac - done - - modprobe zram - zramctl --find --size="$size" - mkswap -f /dev/zram0 - swapon /dev/zram0 - -} - -time_at_yac() { - date --date='September 22 2014' -} -find_php_short_tags() { - egrep --include="*.php" -rniI '<\?[^px=q]' . --color=force -} -gentags() { - options="-R --links --languages=php,-javascript" - dir="." - while [ $# -gt 0 ] ; do - case $1 in - -o) - options="$2" - shift; shift; - ;; - esac - done - - if [ -x $(which exctags 2>/dev/null) ] ; then - $(which exctags 2>/dev/null) $options $dir - elif [ -x $(which ctags 2>/dev/null) ] ; then - $(which ctags 2>/dev/null) $options $dir - fi -} -set_tmux_title() { - text="" - while [ $# -gt 0 ] ; do - text="$( echo $text $1)"; - shift; - done - printf $'\033k'"${text}"$'\033\\'; -} -set_title() { - text="" - while [ $# -gt 0 ] ; do - text="$( echo $text $1)"; - shift; - done - printf $'\033]0;'"$text"$'\007'; -} - -set_ps1() { - PS1='$(precmd)${BG}${ACCENT_C}${ACCENT_P}${USER_C}${USER:=$(id -un)}@$(hostname)${ACCENT_C}${ACCENT_P} ${ACCENT_P}${PATH_C}${PWD:-?}${ACCENT_C}${ACCENT_P}${END_C} -${END_P} [0m' - export PS1; -} -set_root_ps1() { -PS1='$(precmd)${BG}${ACCENT_C}${ACCENT_P}${HOST_C}$(hostname)${ACCENT_C}${ACCENT_P} ${ACCENT_P}${PATH_C}${PWD:-?}${ACCENT_C}${ACCENT_P}${END_C} -${END_P} [0m' -export PS1; -} - -# RED: 31, GREEN: 32, YELLOW: 33, BLUE: 34, MAGENTA: 35, CYAN: 36, WHITE: 37, GREY 38. and No color which is 0. -set_prompt() { - if [ `id -u` -eq 0 ] ; then - # Previously - # Red for root, and no username - # PS1="[1;31m[1;40m$(hostname)[1;33m \$PWD - echo $TERM | grep "256color$" > /dev/null 2>&1 - if [ $? -eq 0 ] ; then - BG="" - ACCENT_C="[38;5;196m" - ACCENT_P="|" - HOST_C="[38;5;196m" - PATH_C="[38;5;27m" - END_C="[38;5;196m" - set_root_ps1 - END_P="#" - else - BG="[1;40m" - ACCENT_C="[0;31m" - ACCENT_P="|" - HOST_C="[1;31m" - PATH_C="[1;33m" - END_P="#" - fi - set_root_ps1 - else - # Previously - # PS1="[1;32m[1;40m${USER:=$(id -un)}@$(hostname)[1;33m \$PWD - echo $TERM | grep "256color$" > /dev/null 2>&1 - if [ $? -eq 0 ] ; then - BG="[1;40m" - ACCENT_C="[38;5;21m" - ACCENT_P="|" - USER_C="[38;5;121m" - PATH_C="[38;5;190m" - END_C="[38;5;226m" - END_P="≈" - else - BG="[1;40m" - ACCENT_C="[1;34m" - ACCENT_P="|" - USER_C="[1;32m" - PATH_C="[1;33m" - END_C="[1;33m" - END_P="$" - fi - set_ps1 - fi -} |
