Skip to content

Instantly share code, notes, and snippets.

View ericvanjohnson's full-sized avatar
🐘
Probably doing PHP Stuff.

Eric Van Johnson ericvanjohnson

🐘
Probably doing PHP Stuff.
View GitHub Profile
@ericvanjohnson
ericvanjohnson / gist:3165983
Created July 23, 2012 20:17
Search for all cron jobs for all users
# List all cron jobs for all users
# Run from command line as root
for user in $(cut -f1 -d: /etc/passwd); do crontab -u $user -l; done
# To know, which user does a crontab belong to insert echo $user
for user in $(cut -f1 -d: /etc/passwd); do echo $user; crontab -u $user -l; done
# List of useful Vim tricks. Most taken from @vimtips on Twitter
# CTRL-w | and CTRL-W _ maximize your current split vertically and horizontally, respectively. CTRL-W = equalizes 'em CTRL-w s CTRL-w T will open current buffer in new tab (via @vrybas_)
# qa starts a recording in register 'a'. q stops it. @a repeats the recording. 5@a repeats it 5 times.
# Comment out lines containing _pattern_ (if '#' is your comment character/sequence) (via @vrybas_)
:g/_pattern_/s/^/#/g
# re-tab all files in the buffers list.
public function gravatar($email, $size = 70, $default = "monsterid") {
return "http://www.gravatar.com/avatar/" .
md5(strtolower($email)) .
"?s=" . (integer) $size .
"&d=" . urlencode($default) .
"&r=G";
}
@ericvanjohnson
ericvanjohnson / gist:4235452
Created December 7, 2012 18:47
Nice BASH Prompt with Git Awareness
export PS1='\n\[\e[0;36m\]┌─[\[\e[0m\]\[\e[1;33m\]\u\[\e[0m\]\[\e[1;36m\]@\[\e[0m\]\[\e[1;33m\]\h\[\e[0m\]\[\e[0;36m\]]─[\[\e[0m\]\[\e[1;34m\]\w\[\e[0m\]\[\e[0;36m\]]\[\e[0;36m\]─$(__git_ps1 "[\[\e[1;37m\]%s\[\e[0m\]\[\e[0;36m\]]─")[\[\e[0m\]\[\e[0;31m\]\T\[\e[0m\]\[\e[0;36m\]]\[\e[0m\]\n\[\e[0;36m\]└─[\[\e[0m\]\[\e[1;37m\]\$\[\e[0m\]\[\e[0;36m\]]› \[\e[0m\]'
@ericvanjohnson
ericvanjohnson / bashprompt2.sh
Created January 22, 2013 01:14
Bash Prompt without Git Autocomplete
export PS1='\n\[\e[0;36m\]┌─[\[\e[0m\]\[\e[1;33m\]\u\[\e[0m\]\[\e[1;36m\]@\[\e[0m\]\[\e[1;33m\]\h\[\e[0m\]\[\e[0;36m\]]─[\[\e[0m\]\[\e[1;34m\]\w\[\e[0m\]\[\e[0;36m\]]\[\e[0;36m\]─[\[\e[0m\]\[\e[0;31m\]\T\[\e[0m\]\[\e[0;36m\]]\[\e[0m\]\n\[\e[0;36m\]└─[\[\e[0m\]\[\e[1;37m\]\$\[\e[0m\]\[\e[0;36m\]]› \[\e[0m\]'
@ericvanjohnson
ericvanjohnson / gist:4597775
Created January 22, 2013 19:45
Create a tree like structure from the ls command:
ls -R | grep ":" | sed -e 's/://' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/'
@ericvanjohnson
ericvanjohnson / gist:4597822
Created January 22, 2013 19:49
Rsync over SSH (Remote to local)
rsync -ave "ssh" USER@REMOTE_SERVER:/remote/file/path/ /local/file/path/
@ericvanjohnson
ericvanjohnson / gist:4597890
Created January 22, 2013 19:56
Figure out what the size of files and folders in a particular directory.
ls -1A | tr '\n' '\0' | xargs -0 du -sk | sort -
@ericvanjohnson
ericvanjohnson / gist:4597876
Last active December 11, 2015 11:59
Rsync over SSH (local to remote)
rsync -ave "ssh" /local/file/path/ USER@REMOTE_SERVER:/remote/file/path/
@ericvanjohnson
ericvanjohnson / .vimrc
Created March 8, 2013 20:48
My Current VIMRC Configuration
set nocompatible " be iMproved
filetype off " required!
" Setting my ColorScheme
color murphy
" colors getafe
" Environment {
" Basics {
set nocompatible " must be first line