Skip to content

Instantly share code, notes, and snippets.

@alobato
Created May 6, 2014 14:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alobato/f932a3242f93919e4f05 to your computer and use it in GitHub Desktop.
Save alobato/f932a3242f93919e4f05 to your computer and use it in GitHub Desktop.
aliases.sh
alias reload="source ~/.bash_profile"
alias lsc="ls -G"
alias ll="ls -Glahs"
alias ls="ls -GF"
alias showip="ifconfig | grep broadcast | sed 's/.*inet \(.*\) netmask.*/\1/'"
alias myip="curl whatismyip.nodejitsu.com/index.txt" # alias myip="wget http://myipaddress.com -O - -o /dev/null |grep '<b>'| sed -E 's/<p><b>//g'|sed -E 's/<\/b>//g'"
alias cleanup="sudo rm -rf /private/var/log/asl/*"
alias xmlget="curl -X GET -H 'Accept: application/xml'"
alias jsonget="curl -X GET -H 'Accept: application/json'"
alias xmlpost="curl -X POST -H 'Accept: application/xml'"
alias xmlput="curl -X PUT -H 'Accept: application/xml'"
alias xmldelete="curl -X DELETE -H 'Accept: application/xml'"
# https://coderwall.com/p/obe36w
mdp() {
local tmpfile='~/tmp/markdown-preview.html';
local srcfile=$1;
perl ~/Dropbox/dotfiles/bin/Markdown.pl --html4tags $srcfile > $tmpfile;
open $tmpfile;
}
# http://superuser.com/questions/283071/usefull-aliases-in-bash-profile
alias simpleserver="python -m SimpleHTTPServer"
function l { cd ~/little_projects/$1; }
function take {
mkdir $1
cd $1
}
# Usage: f /some/path [grep options]
f() {
local path="$1"
shift
find "$path" -follow -name '*' | xargs grep "$*"
}
# github repository cloning
# usage:
# github has_permalink ~> will clone $USER repositories
# github username repository ~> will clone someone else's
github() {
if [ $# = 1 ]; then
git clone git@github.com:$USER/$1.git;
builtin cd $1 && ls;
elif [ $# = 2 ]; then
git clone git://github.com/$1/$2.git;
builtin cd $2 && ls;
else
echo "Usage:";
echo " github <repo> ~> will clone $USER's <repo>";
echo " github <user> <repo> ~> will clone <user>'s <repo>";
fi
}
estadistica () {
local site=$1
echo $site
echo ${site} | sed -n 's/./-/gp'
curl -w '
Lookup time:\t%{time_namelookup} s
Connect time:\t%{time_connect} s
Pretransfer time:\t%{time_pretransfer} s
Starttransfer time:\t%{time_starttransfer} s
Size download:\t%{size_download} bytes
Speed download:\t%{speed_download} bytes/s
Total time:\t%{time_total} s
' -o /dev/null -s $site
echo
}
webstats() {
for i in ${@}; do
estadistica $i
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment