diff --git a/.bash_aliases b/.bash_aliases index 8d21bc0..afe4be2 100644 --- a/.bash_aliases +++ b/.bash_aliases @@ -16,6 +16,11 @@ alias resrc='source ~/.bash_aliases && source ~/.bashrc && source ~/.profile' alias role='whoami -groups -fo list | grep -i' alias fu='find ./ -type f -print0 | xargs -0 grep -n $1' +# Add an "alert" alias for long running commands. Use like so: +# sleep 10; alert +alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"' + + #git alias gs='git status' diff --git a/.bash_functions b/.bash_functions index c1777f7..150396c 100644 --- a/.bash_functions +++ b/.bash_functions @@ -1,19 +1,6 @@ #!/bin/bash #vim: set ft=sh -IFS=$'\n$\t' - - -# This function checks whether we have a given program on the system. -# -have() -{ - # Completions for system administrator commands are installed as well in - # case completion is attempted via `sudo command ...'. - PATH=$PATH:/usr/sbin:/sbin:/usr/local/sbin type $1 &>/dev/null -} - - # `a` with no arguments opens the current directory in Atom Editor, otherwise # opens the given location function a() { @@ -24,11 +11,6 @@ function a() { fi; } -# prints battery percentage, only works on OSX -function batteryPercent(){ - ioreg -l | grep -i capacity | tr '\n' ' | ' | awk '{printf("%d", $10/$5 * 100)}' -} - # Simple calculator function calc() { local result=""; @@ -47,11 +29,6 @@ function calc() { printf "\n"; } -# Change working directory to the top-most Finder window location -function cdf() { # short for `cdfinder` - cd "$(osascript -e 'tell app "Finder" to POSIX path of (insertion location as alias)')"; -} - # a shortcut for cloning from github # usage: clone user/repo function clone() { @@ -100,81 +77,6 @@ function digga() { dig +nocmd "$1" any +multiline +noall +answer; } -# simplifies using docker-machine -function dm() { - local TARGET=$2 - if [ -z "$2" ]; then - TARGET="default" - fi - - case $1 in - "start" | "up" ) - - if [ -z $(docker-machine ls | grep $TARGET) ]; then - CREATE=false - read -e -p "a machine named \"${TARGET}\" doesn't exist (yes to create): " CREATE - if [[ $CREATE == "yes" ]]; then - docker-machine create --driver="virtualbox" $TARGET - else - echo "exiting" - return 0 - fi - fi - - if [ -z $(docker-machine status $TARGET | grep Running) ]; then - docker-machine start $TARGET - fi - - eval $(docker-machine env $TARGET) ;; - - "stop" | "halt" ) - - echo "stopping docker machine..." - docker-machine stop $TARGET ;; - - "delete" | "destroy" ) - - echo "destroying \"$TARGET\" machine..." - docker-machine rm $TARGET ;; - - "ip" ) - docker-machine ip $TARGET ;; - - "list" | "ls" ) - docker-machine ls ;; - - "clean" ) - docker ps -a | grep "ago" | awk '{print $1}' | xargs docker rm ;; - - "clean-images" ) - if [ -z $2 ]; then - $2 = "weeks" - fi - - docker images -a | grep "ago" | awk '{print $3}' | xargs docker rmi ;; - - "help" | "-h" | "--help" ) - echo "usage: dm COMMAND [arg]" - echo "[machine name] is 'default' if not defined" - echo "Commands:" - echo " help | -h | --help Shows this help text" - echo " start | up [machine name] Brings up a docker machine and adds variables to the environment" - echo " stop | halt [machine name] Stops the specified docker machine" - echo " delete | destroy [machine name] Destroys the specified docker machine" - echo " list | ls Lists available machines" - echo " ip [machine name] Prints the ip address for this machine" - echo " clean [text] Deletes all containers matching [text] in the current machine" - echo " clean-images [text] Deletes all images in the current machine" - echo " * Alias for docker-machine" - ;; - - * ) - docker-machine $@ - ;; - - esac -} - # runs tcp dump on the port specified in $1. $1 defaults to 8080 function dumptcp(){ local DUMPPORT=$1 @@ -376,15 +278,6 @@ function s() { fi; } -function vim(){ - local VIM_EXEC="/Applications/MacVim.app/Contents/MacOS/Vim"; - if [ -f $VIM_EXEC ]; then - $VIM_EXEC "$@"; - else - $(which vim) "$@"; - fi -} - # `v` with no arguments opens the current directory in Vim, otherwise opens the # given location function v(){ @@ -480,6 +373,7 @@ function phpserver() { sleep 1 && open "http://${ip}:${port}/" & php -S "${ip}:${port}"; } + # Decode \x{ABCD}-style Unicode escape sequences function unidecode() { perl -e "binmode(STDOUT, ':utf8'); print \"$@\""; diff --git a/.environment b/.environment index 3d05c5a..1153951 100644 --- a/.environment +++ b/.environment @@ -16,9 +16,6 @@ shopt -s histappend # Append to the history file, not over export LESS='-iMR' # Case insensite search, verbose prompting and raw output export PAGER=less # Used to display text / man files -# setup go paths -export GOPATH="$HOME/projects/go" -export GOROOT="/usr/local/go" export ANSIBLE_HOSTS="~/.ansible/hosts" export LANG="en_US.UTF-8" diff --git a/.gitconfig b/.gitconfig index 7ca3f2c..faed669 100644 --- a/.gitconfig +++ b/.gitconfig @@ -164,4 +164,7 @@ [help] autocorrect=20 [credential] - helper = osxkeychain + # for OSX + #helper = osxkeychain + # for Linux + helper = /usr/share/doc/git/contrib/credential/gnome-keyring/git-credential-gnome-keyring diff --git a/.profile b/.profile index 6933b59..26a735f 100644 --- a/.profile +++ b/.profile @@ -1,5 +1,6 @@ #!/bin/bash + # source environment settings if [ -f ~/.environment ]; then . ~/.environment @@ -20,9 +21,6 @@ if [ -f ~/.shell_colors ]; then . ~/.shell_colors fi -if [ -f /etc/bash_completion ]; then - . /etc/bash_completion -fi # for when you want to do custom junk # Sources a folder with shell extensions @@ -32,6 +30,4 @@ if [ -d ~/.extensions ]; then done fi -printmotd -export PATH="$HOME/.cargo/bin:$PATH"