commit
d8b0da2565
|
|
@ -0,0 +1,5 @@
|
||||||
|
cite 'about-alias'
|
||||||
|
about-alias 'Atom.io editor abbreviations'
|
||||||
|
|
||||||
|
alias a='atom'
|
||||||
|
alias ah='atom .'
|
||||||
|
|
@ -3,13 +3,13 @@ about-alias 'docker abbreviations'
|
||||||
|
|
||||||
alias dklc='docker ps -l' # List last Docker container
|
alias dklc='docker ps -l' # List last Docker container
|
||||||
alias dklcid='docker ps -l -q' # List last Docker container ID
|
alias dklcid='docker ps -l -q' # List last Docker container ID
|
||||||
alias dklcip="docker inspect `dklcid` | grep IPAddress | cut -d '\"' -f 4" # Get IP of last Docker container
|
alias dklcip="docker inspect `docker ps -l -q` | grep IPAddress | cut -d '\"' -f 4" # Get IP of last Docker container
|
||||||
alias dkps='docker ps' # List running Docker containers
|
alias dkps='docker ps' # List running Docker containers
|
||||||
alias dkpsa='docker ps -a' # List all Docker containers
|
alias dkpsa='docker ps -a' # List all Docker containers
|
||||||
alias dki='docker images' # List Docker images
|
alias dki='docker images' # List Docker images
|
||||||
alias dkrmac='docker rm $(docker ps -a -q)' # Delete all Docker containers
|
alias dkrmac='docker rm $(docker ps -a -q)' # Delete all Docker containers
|
||||||
alias dkrmlc='docker-remove-most-recent-container' # Delete most recent (i.e., last) Docker container
|
alias dkrmlc='docker-remove-most-recent-container' # Delete most recent (i.e., last) Docker container
|
||||||
alias dkrmui='docker rmi $(docker images | grep "^<none>" | awk "{print $3}")' # Delete all untagged Docker images
|
alias dkrmui='docker images -q -f dangling=true |xargs -r docker rmi' # Delete all untagged Docker images
|
||||||
alias dkrmli='docker-remove-most-recent-image' # Delete most recent (i.e., last) Docker image
|
alias dkrmli='docker-remove-most-recent-image' # Delete most recent (i.e., last) Docker image
|
||||||
alias dkrmi='docker-remove-images' # Delete images for supplied IDs or all if no IDs are passed as arguments
|
alias dkrmi='docker-remove-images' # Delete images for supplied IDs or all if no IDs are passed as arguments
|
||||||
alias dkideps='docker-image-dependencies' # Output a graph of image dependencies using Graphiz
|
alias dkideps='docker-image-dependencies' # Output a graph of image dependencies using Graphiz
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,10 @@ about-alias 'emacs editor'
|
||||||
case $OSTYPE in
|
case $OSTYPE in
|
||||||
linux*)
|
linux*)
|
||||||
alias em='emacs'
|
alias em='emacs'
|
||||||
|
alias et='emacs -nw'
|
||||||
alias e='emacsclient -n'
|
alias e='emacsclient -n'
|
||||||
|
alias et='emacsclient -t'
|
||||||
|
alias ed='emacs --daemon'
|
||||||
alias E='SUDO_EDITOR="emacsclient" sudo -e'
|
alias E='SUDO_EDITOR="emacsclient" sudo -e'
|
||||||
;;
|
;;
|
||||||
darwin*)
|
darwin*)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
cite 'about-alias'
|
||||||
|
about-alias 'Tmux terminal multiplexer'
|
||||||
|
|
||||||
|
alias txl='tmux ls'
|
||||||
|
alias txn='tmux new -s'
|
||||||
|
alias txa='tmux a -t'
|
||||||
|
|
@ -3,6 +3,7 @@ about-alias 'vagrant aliases'
|
||||||
|
|
||||||
# Aliases
|
# Aliases
|
||||||
alias vup="vagrant up"
|
alias vup="vagrant up"
|
||||||
|
alias vupl="vagrant up 2>&1 | tee vagrant.log"
|
||||||
alias vh="vagrant halt"
|
alias vh="vagrant halt"
|
||||||
alias vs="vagrant suspend"
|
alias vs="vagrant suspend"
|
||||||
alias vr="vagrant resume"
|
alias vr="vagrant resume"
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
# http://github.com/drush-ops/drush/blob/master/drush.complete.sh
|
# http://github.com/drush-ops/drush/blob/master/drush.complete.sh
|
||||||
|
|
||||||
# Ensure drush is available.
|
# Ensure drush is available.
|
||||||
which drush > /dev/null || alias drush &> /dev/null || return
|
which drush &> /dev/null || alias drush &> /dev/null || return
|
||||||
|
|
||||||
__drush_ps1() {
|
__drush_ps1() {
|
||||||
f="${TMPDIR:-/tmp/}/drush-env/drush-drupal-site-$$"
|
f="${TMPDIR:-/tmp/}/drush-env/drush-drupal-site-$$"
|
||||||
|
|
|
||||||
|
|
@ -361,3 +361,21 @@ all_groups ()
|
||||||
cat $file | sort | uniq
|
cat $file | sort | uniq
|
||||||
rm $file
|
rm $file
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ! type pathmunge > /dev/null 2>&1
|
||||||
|
then
|
||||||
|
function pathmunge () {
|
||||||
|
_about 'prevent duplicate directories in you PATH variable'
|
||||||
|
_group 'lib helpers'
|
||||||
|
_example 'pathmunge /path/to/dir is equivalent to PATH=/path/to/dir:$PATH'
|
||||||
|
_example 'pathmunge /path/to/dir after is equivalent to PATH=$PATH:/path/to/dir'
|
||||||
|
|
||||||
|
if ! [[ $PATH =~ (^|:)$1($|:) ]] ; then
|
||||||
|
if [ "$2" = "after" ] ; then
|
||||||
|
export PATH=$PATH:$1
|
||||||
|
else
|
||||||
|
export PATH=$1:$PATH
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
|
|
||||||
|
|
@ -4,21 +4,17 @@ about-plugin 'AWS helper functions'
|
||||||
function awskeys {
|
function awskeys {
|
||||||
about 'helper function for AWS credentials file'
|
about 'helper function for AWS credentials file'
|
||||||
group 'aws'
|
group 'aws'
|
||||||
if [[ $# -eq 0 ]]; then
|
if [[ $# -eq 1 ]] && [[ "$1" = "list" ]]; then
|
||||||
__awskeys_help
|
|
||||||
elif [[ $# -eq 1 ]] && [[ "$1" = "list" ]]; then
|
|
||||||
__awskeys_list "$2"
|
__awskeys_list "$2"
|
||||||
elif [[ $# -eq 2 ]]; then
|
elif [[ $# -eq 1 ]] && [[ "$1" = "unset" ]]; then
|
||||||
if [[ "$1" = "show" ]]; then
|
__awskeys_unset "$2"
|
||||||
|
elif [[ $# -eq 2 ]] && [[ "$1" = "show" ]]; then
|
||||||
__awskeys_show "$2"
|
__awskeys_show "$2"
|
||||||
elif [[ "$1" = "export" ]]; then
|
elif [[ $# -eq 2 ]] && [[ "$1" = "export" ]]; then
|
||||||
__awskeys_export "$2"
|
__awskeys_export "$2"
|
||||||
else
|
else
|
||||||
__awskeys_help
|
__awskeys_help
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
__awskeys_help
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function __awskeys_help {
|
function __awskeys_help {
|
||||||
|
|
@ -26,9 +22,10 @@ function __awskeys_help {
|
||||||
echo -e "Helper to AWS credentials file.\n"
|
echo -e "Helper to AWS credentials file.\n"
|
||||||
echo -e "Commands:\n"
|
echo -e "Commands:\n"
|
||||||
echo " help Show this help message"
|
echo " help Show this help message"
|
||||||
echo " list List available credentials profiles"
|
echo " list List available AWS credentials profiles"
|
||||||
echo " show Show the keys associated to a credentials profile"
|
echo " show Show the AWS keys associated to a credentials profile"
|
||||||
echo " export Export a credentials profile keys as environment variables"
|
echo " export Export an AWS credentials profile keys as environment variables"
|
||||||
|
echo " unset Unset the AWS keys variables from the environment"
|
||||||
}
|
}
|
||||||
|
|
||||||
function __awskeys_get {
|
function __awskeys_get {
|
||||||
|
|
@ -39,7 +36,7 @@ function __awskeys_get {
|
||||||
}
|
}
|
||||||
|
|
||||||
function __awskeys_list {
|
function __awskeys_list {
|
||||||
local credentials_list="$(egrep '^\[ *[a-zA-Z0-0_-]+ *\]$' ~/.aws/credentials)"
|
local credentials_list="$(egrep '^\[ *[a-zA-Z0-9_-]+ *\]$' ~/.aws/credentials)"
|
||||||
if [[ -n $"{credentials_list}" ]]; then
|
if [[ -n $"{credentials_list}" ]]; then
|
||||||
echo -e "Available credentials profiles:\n"
|
echo -e "Available credentials profiles:\n"
|
||||||
for cred in ${credentials_list}; do
|
for cred in ${credentials_list}; do
|
||||||
|
|
@ -61,12 +58,18 @@ function __awskeys_show {
|
||||||
}
|
}
|
||||||
|
|
||||||
function __awskeys_export {
|
function __awskeys_export {
|
||||||
local p_keys="$(__awskeys_get $1)"
|
local p_keys=( $(__awskeys_get $1 | tr -d " ") )
|
||||||
if [[ -n "${p_keys}" ]]; then
|
if [[ -n "${p_keys}" ]]; then
|
||||||
eval $(echo "${p_keys}" | tr -d " " | sed -r -e "s/(.+=)(.+)/export \U\1\E\2/")
|
for p_key in ${p_keys[@]}; do
|
||||||
|
local key="${p_key%=*}"
|
||||||
|
export "$(echo ${key} | tr [:lower:] [:upper:])=${p_key#*=}"
|
||||||
|
done
|
||||||
export AWS_DEFAULT_PROFILE="$1"
|
export AWS_DEFAULT_PROFILE="$1"
|
||||||
else
|
else
|
||||||
echo "Profile $1 not found in credentials file"
|
echo "Profile $1 not found in credentials file"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function __awskeys_unset {
|
||||||
|
unset AWS_DEFAULT_PROFILE AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,15 @@ function ips ()
|
||||||
{
|
{
|
||||||
about 'display all ip addresses for this host'
|
about 'display all ip addresses for this host'
|
||||||
group 'base'
|
group 'base'
|
||||||
|
if command -v ifconfig &>/dev/null
|
||||||
|
then
|
||||||
ifconfig | awk '/inet /{ print $2 }'
|
ifconfig | awk '/inet /{ print $2 }'
|
||||||
|
elif command -v ip &>/dev/null
|
||||||
|
then
|
||||||
|
ip addr | grep -oP 'inet \K[\d.]+'
|
||||||
|
else
|
||||||
|
echo "You don't have ifconfig or ip command installed!"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function down4me ()
|
function down4me ()
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,7 @@
|
||||||
# enter a few characters and press UpArrow/DownArrow
|
# enter a few characters and press UpArrow/DownArrow
|
||||||
# to search backwards/forwards through the history
|
# to search backwards/forwards through the history
|
||||||
|
if [ -t 1 ];
|
||||||
|
then
|
||||||
bind '"[A":history-search-backward'
|
bind '"[A":history-search-backward'
|
||||||
bind '"[B":history-search-forward'
|
bind '"[B":history-search-forward'
|
||||||
|
fi
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,8 @@
|
||||||
cite about-plugin
|
cite about-plugin
|
||||||
about-plugin 'manage your nginx service'
|
about-plugin 'manage your nginx service'
|
||||||
|
|
||||||
# Set the path nginx
|
|
||||||
export NGINX_PATH='/opt/nginx'
|
export NGINX_PATH='/opt/nginx'
|
||||||
|
pathmunge $NGINX_PATH/sbin after
|
||||||
# Add nginx to the path
|
|
||||||
export PATH=$PATH:$NGINX_PATH/sbin
|
|
||||||
|
|
||||||
function nginx_reload() {
|
function nginx_reload() {
|
||||||
about 'reload your nginx config'
|
about 'reload your nginx config'
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,7 @@
|
||||||
cite about-plugin
|
cite about-plugin
|
||||||
about-plugin 'Node.js helper functions'
|
about-plugin 'Node.js helper functions'
|
||||||
|
|
||||||
export PATH=./node_modules/.bin:$PATH
|
pathmunge ./node_modules/.bin
|
||||||
|
|
||||||
# Make sure the global npm prefix is on the path
|
# Make sure the global npm prefix is on the path
|
||||||
[[ `which npm` ]] && export PATH=$(npm config get prefix)/bin:$PATH
|
[[ `which npm` ]] && pathmunge $(npm config get prefix)/bin
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
cite about-plugin
|
cite about-plugin
|
||||||
about-plugin 'alias "http" to SimpleHTTPServer'
|
about-plugin 'alias "shttp" to SimpleHTTPServer'
|
||||||
|
|
||||||
if [ $(uname) = "Linux" ]
|
if [ $(uname) = "Linux" ]
|
||||||
then
|
then
|
||||||
alias http='python2 -m SimpleHTTPServer'
|
alias shttp='python2 -m SimpleHTTPServer'
|
||||||
else
|
else
|
||||||
alias http='python -m SimpleHTTPServer'
|
alias shttp='python -m SimpleHTTPServer'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
function pyedit() {
|
function pyedit() {
|
||||||
|
|
|
||||||
|
|
@ -55,8 +55,7 @@ function set_rgb_color {
|
||||||
|
|
||||||
function powerline_shell_prompt {
|
function powerline_shell_prompt {
|
||||||
SHELL_PROMPT_COLOR=${SHELL_THEME_PROMPT_COLOR}
|
SHELL_PROMPT_COLOR=${SHELL_THEME_PROMPT_COLOR}
|
||||||
CAN_I_RUN_SUDO=$(sudo -n uptime 2>&1 | grep "load" | wc -l)
|
if sudo -n uptime 2>&1 | grep -q "load"; then
|
||||||
if [ ${CAN_I_RUN_SUDO} -gt 0 ]; then
|
|
||||||
SHELL_PROMPT_COLOR=${SHELL_THEME_PROMPT_COLOR_SUDO}
|
SHELL_PROMPT_COLOR=${SHELL_THEME_PROMPT_COLOR_SUDO}
|
||||||
fi
|
fi
|
||||||
SEGMENT_AT_RIGHT=0
|
SEGMENT_AT_RIGHT=0
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ THEME_PROMPT_SEPARATOR=""
|
||||||
|
|
||||||
SHELL_SSH_CHAR=" "
|
SHELL_SSH_CHAR=" "
|
||||||
SHELL_THEME_PROMPT_COLOR=32
|
SHELL_THEME_PROMPT_COLOR=32
|
||||||
SHELL_SSH_THEME_PROMPT_COLOR=208
|
SHELL_THEME_PROMPT_COLOR_SUDO=202
|
||||||
|
|
||||||
VIRTUALENV_CHAR="ⓔ "
|
VIRTUALENV_CHAR="ⓔ "
|
||||||
VIRTUALENV_THEME_PROMPT_COLOR=35
|
VIRTUALENV_THEME_PROMPT_COLOR=35
|
||||||
|
|
@ -37,13 +37,17 @@ function set_rgb_color {
|
||||||
}
|
}
|
||||||
|
|
||||||
function powerline_shell_prompt {
|
function powerline_shell_prompt {
|
||||||
if [[ -n "${SSH_CLIENT}" ]]; then
|
SHELL_PROMPT_COLOR=${SHELL_THEME_PROMPT_COLOR}
|
||||||
SHELL_PROMPT="${bold_white}$(set_rgb_color - ${SHELL_SSH_THEME_PROMPT_COLOR}) ${SHELL_SSH_CHAR}\u@\h ${normal}"
|
if sudo -n uptime 2>&1 | grep -q "load"; then
|
||||||
LAST_THEME_COLOR=${SHELL_SSH_THEME_PROMPT_COLOR}
|
SHELL_PROMPT_COLOR=${SHELL_THEME_PROMPT_COLOR_SUDO}
|
||||||
else
|
|
||||||
SHELL_PROMPT="${bold_white}$(set_rgb_color - ${SHELL_THEME_PROMPT_COLOR}) \u ${normal}"
|
|
||||||
LAST_THEME_COLOR=${SHELL_THEME_PROMPT_COLOR}
|
|
||||||
fi
|
fi
|
||||||
|
if [[ -n "${SSH_CLIENT}" ]]; then
|
||||||
|
SHELL_PROMPT="${SHELL_SSH_CHAR}\u@\h"
|
||||||
|
else
|
||||||
|
SHELL_PROMPT="\u"
|
||||||
|
fi
|
||||||
|
SHELL_PROMPT="${bold_white}$(set_rgb_color - ${SHELL_PROMPT_COLOR}) ${SHELL_PROMPT} ${normal}"
|
||||||
|
LAST_THEME_COLOR=${SHELL_PROMPT_COLOR}
|
||||||
}
|
}
|
||||||
|
|
||||||
function powerline_virtualenv_prompt {
|
function powerline_virtualenv_prompt {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue