Skip to content

Instantly share code, notes, and snippets.

View jcpst's full-sized avatar
💯

Joseph Post jcpst

💯
View GitHub Profile
alias aliases="colorize ~/.oh-my-zsh/custom/aliases.zsh | grep --color='never' alias | cut -d' ' -f2-"
alias c="colorize"
alias clean="sudo pkgcacheclean -v"
alias fig="docker-compose"
alias reload=". ~/.zshrc && echo 'Your zshrc file has been reloaded'"
alias repos="find ~ -type d -name .git | xargs -n 1 dirname"
alias s="screen -r"
alias serve="http-server"
alias update="yaourt -Syua"
alias VIALIAS="vim ~/.oh-my-zsh/custom/aliases.zsh"
@jcpst
jcpst / gist:fd5234c6a7268a20c91d
Created April 11, 2015 05:09
if gpg is unable to add and sign keys...
# dirmngr < /dev/null
# Colors
GREEN='\e[0;32m'
LIGHT_GREY='\e[0;37m'
RED='\e[0;31m'
END_COLOR='\e[m'
### 'dstop'
function docker_stop_all_containers {
echo -e "${RED}Stopping all Docker containers...i${END_COLOR}"
docker stop $(docker ps -a -q)
@jcpst
jcpst / gist:2a6dc89d849445a4a9ac
Created May 11, 2015 17:56
Full system backup with rsync
# From here: https://wiki.archlinux.org/index.php/Full_system_backup_with_rsync
# One Liner:
rsync -aAXv --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} /* /path/to/backup/folder
@jcpst
jcpst / gist:3f3ab560923803c1547c
Created June 24, 2015 20:13
Remove passphrase from ssh key
#From: http://www.thinkplexx.com/learn/howto/security/ssl/remove-passphrase-password-from-private-rsa-key
openssl rsa -in ~/.ssh/id_rsa -out ~/.ssh/id_rsa_new
cp ~/.ssh/id_rsa ~/.ssh/id_rsa.backup
rm ~/.ssh/id_rsa
cp ~/.ssh/id_rsa_new ~/.ssh/id_rsa
chmod 400 ~/.ssh/id_rsa
@jcpst
jcpst / mh.zsh-theme
Created August 19, 2015 17:31
Oh My ZSH prompt with git/node/docker-machine awareness
# mh theme
# Modified by Joseph Post
# features:
# path is autoshortened to ~25 characters
# displays git status, short SHA, and clean/dirty
# displays node/npm versions
# displays docker machine name if active.
# prompt
@jcpst
jcpst / gist:e835ad986ef5505a4e40
Created September 14, 2015 17:48
Bash: directories of a directory in an array
ls -d */ | sed 's/\/*$//'
@jcpst
jcpst / gist:00d6685c5a2dd48f55a0
Created October 15, 2015 02:37
build node.js on arch linux
mkdir -p ~/bin/
ln -s $(which python2) ~/bin/python
export PATH=~/bin/:$PATH
./configure
make
@jcpst
jcpst / use-jdk.sh
Created October 28, 2015 15:21
switch JAVA_HOME
function use-jdk {
jdk=$(/usr/libexec/java_home $1)
sed -i "s/^JAVA_HOME=.*/JAVA_HOME=\"$jdk\"/" "~/.zprofile"
source .zshrc
}
@jcpst
jcpst / gist:c7cc936ed4a597869e77
Created October 30, 2015 05:38
ls: list directories and dotfiles first
LC_COLLATE='C' ls -lah --group-directories-first