Skip to content

Instantly share code, notes, and snippets.

@kaziridwan
Last active July 4, 2016 17:30
Show Gist options
  • Save kaziridwan/166416e8cbd77ac1e2fc to your computer and use it in GitHub Desktop.
Save kaziridwan/166416e8cbd77ac1e2fc to your computer and use it in GitHub Desktop.
My osx bash profile
#Paths
export PATH="~/.composer/vendor/bin:$PATH"
export XAMPP_HOME=/Applications/XAMPP
export PATH=${XAMPP_HOME}/bin:${PATH}
export PATH="/Volumes/secondary/apps/apache-ant-1.9.6/bin:$PATH"
export PATH="/Users/ridwan/Library/Android/sdk/platform-tools/":$PATH
export PATH="/usr/local/lib/express:$PATH"
export PATH="/Users/ridwan/Library/Android/sdk/platform-tools:/Users/ridwan/Library/Android/sdk/tools:$PATH"
#aliases
alias pr='cd /Volumes/secondary/projects'
alias ht=' cd /Applications/XAMPP/htdocs'
alias gc='git config user.name ridwan ;git config user.email [email protected]'
alias gl='git log --oneline --graph --decorate --pretty'
alias bp='sudo nano ~/.bash_profile'
alias bpr=' source ~/.bash_profile'
alias bpc='cat ~/.bash_profile | pbcopy'
alias git-completion-init='curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash -o ~/.git-completion.bash'
alias gulpw='gulp;gulp watch'
alias ionic-android-reset='ionic platform rm android; ionic platform add android'
alias ion-fb-reset='ionic platform rm android;ionic platform add android;android update project --subprojects --path "platforms/android" --target android-23 --library "CordovaLib"; nf android update project --subprojects --path "platforms/android" --target android-23 --library "com.phonegap.plugins.facebookconnect/FacebookLib"'
alias heroku-resync='git add . --all; git commit -m 'resync'; git branch -f master dev-ridwan; git push heroku master;heroku logs -t --app cashus-api'
#addons
if [ -f ~/.git-completion.bash ]; then
. ~/.git-completion.bash
fi
#functions
function somefunction() {
if [ -x /usr/bin/open ]; then
man -t "$1" | open -f -a Preview
else
man "$1"
fi
}
irFunc() {
#do things with parameters like $1 such as
adb connect 192.168.1.$1
ionic run android --livereload -c -s
#learnt about piping echo / printf c | ionic ru...
}
alias ir=irFunc
gpFunc() {
#do things with parameters like $1 such as
git add . --all;
git commit -m "${*:2}";
git push origin $1;
echo "pushed with message ${@:2}"
}
alias gp=gpFunc
gprFunc() {
#do things with parameters like $1 such as
git add . --all;
git commit -m "${*:3}";
git push $1 $2;
echo "pushed with message ${@:3}"
}
alias gpr=gprFunc
cmmtFunc() {
#do things with parameters like $1 such as
git add . --all;
git commit -m "${*:1}";
}
alias cmmt=cmmtFunc
wcFunc() {
#do things with parameters like $1 such as
httrack http://$1 -W -O "./$1" -%v -r $2
}
alias wc=wcFunc
alias nf=notfFunc
notfFunc(){
eval ${*:1}
terminal-notifier -title ':D' -message 'Task done! Check your terminal!' -sound default
#terminal-notifier -title ':D' -message 'Task done! Check your terminal!' | ${*:2}
}
#bash plugins
#source bash_test_plugin.sh
function genaboutme(){
things=$3
things=$(echo $things | tr "=" "\n")
echo $things
index=0
for x in $things
do
if [ ! $index -eq 0 ]; then
echo "> [$x]"
fi
let index+=1
done
COUNTER=20
until [ $COUNTER -lt 10 ]; do
directories="$directories and $4"
let COUNTER-=1
done
#my name is alex,
#sed -e "s;%name%;$1;g" -e "s;%age%;$2;g" -e "s;%things%;$things;g" template.txt > $5
echo "new file $4 generated"
}
function looptest(){
string=$1
COUNTER=20
until [ $COUNTER -lt 10 ]; do
string="$string and $2"
let COUNTER-=1
done
echo "new string is $string"
}
alias _kl='ssh [email protected]'
alias hst='sudo nano /private/etc/hosts'
alias kl='ssh [email protected]'
if [ -f ~/.git-completion.bash ]; then
. ~/.git-completion.bash
fi
#end
@kaziridwan
Copy link
Author

kaziridwan commented Nov 13, 2015

This is the bash profile that I use day to day, one
of the secrets of my super productive workflow,
and happiness in coding.

To start off with a bash profile, in terminal

cd
sudo nano .bash_profile

paste the entries with cmd+v
save with ctrl+x, press y, and press enter
then, in terminal

source .bash_profile

to update this file just do
(in mac)

cat ~/.bash_profile | pbcopy

(in linux)

cat ~/.bash_profile | xclip

in the terminal, and paste it over the gist

_Later you could do_
bp to open up the bash profile
bpr to reload the bash source to the current profile
bpc to copy the current bash profle content in clipboard

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment