Skip to content

Instantly share code, notes, and snippets.

@lucianomlima
Last active August 21, 2018 22:28
Show Gist options
  • Save lucianomlima/cc4571f98bcf46e7e9d5 to your computer and use it in GitHub Desktop.
Save lucianomlima/cc4571f98bcf46e7e9d5 to your computer and use it in GitHub Desktop.
.bashrc file
# Homebrew bash completion
COMPLETIONS="docker gem grunt vagrant"
COMPLETION_DIR=$(brew --prefix)/etc
. $COMPLETION_DIR/bash_completion
for i in $COMPLETIONS; do
if [ -f $COMPLETION_DIR/bash_completion.d/$i ]; then
. $COMPLETION_DIR/bash_completion.d/$i
fi
done
# Colors
RESET="\[\033[0m\]";
BLACK="\[\033[0;30m\]";
LIGHT_BLACK="\[\033[1;30m\]";
RED="\[\033[0;31m\]";
LIGHT_RED="\[\033[1;31m\]";
GREEN="\[\033[0;32m\]";
LIGHT_GREEN="\[\033[1;32m\]";
YELLOW="\[\033[0;33m\]";
LIGHT_YELLOW="\[\033[1;33m\]";
BLUE="\[\033[0;34m\]";
LIGHT_BLUE="\[\033[1;34m\]";
PURPLE="\[\033[0;35m\]";
LIGHT_PURPLE="\[\033[1;35m\]";
CYAN="\[\033[0;36m\]";
LIGHT_CYAN="\[\033[1;36m\]";
LIGHT_GRAY="\[\033[0;37m\]";
WHITE="\[\033[1;37m\]";
# Aliases
alias ls='ls -AFG'
alias ll='ls -AlFG'
alias ..='cd ..'
alias ...='cd ../..'
alias gs='git status'
alias ga='git add '
alias gb='git branch '
alias gc='git commit '
alias gd='git diff'
alias go='git checkout '
alias push='git push '
alias pull='git pull '
alias targz='tar -czf'
alias tarbz='tar -cjf'
alias untargz='tar -xvzf'
alias untarbz='tar -xvjf'
alias menu='adb shell input keyevent 82'
# Functions
function chrome {
open -a Google\ Chrome --args --disable-web-security;
}
function edit_externals {
svn pg svn:externals . > ./svn.externals --strict && sublime ./svn.externals;
}
function save_externals {
svn ps svn:externals -F ./svn.externals && rm -f ./svn.externals;
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ \(\1\)/';
}
function parse_git_tag {
TAG=`git name-rev --tags --name-only $(git rev-parse HEAD 2> /dev/null) 2> /dev/null`
if [[ "$TAG" != "undefined" && "$TAG" != "" ]]; then
echo "[$TAG]" | sed "s/\^0//"
fi
}
function global_update {
echo "Atualizando Homebrew...";
brew update;
echo "Atualizando Ruby Gems...";
sudo gem update;
}
function android_keystore {
if [[ -z $1 ]]; then
echo "Generate android keystore file sintax:"
echo "android_keystore app_name"
return
fi
keytool -genkey -v -keystore $1.keystore -alias $1 -keyalg RSA -keysize 2048 -validity 10000
}
function android_signing {
if [[ -z $1 && -z $2 ]]; then
echo "Signing android application sintax:"
echo "android_signing app_name app_file.apk"
return
fi
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore $1.keystore $2 $1
}
function android_sign_check {
if [[ -z $1 ]]; then
echo "Check signed android application sintax:"
echo "android_sign_check app_file.apk"
return
fi
jarsigner -verify -verbose -certs $1
}
function android_zipalign {
if [[ -z $1 && -z $2 ]]; then
echo "Zipalign android application sintax:"
echo "android_zipalign unaligned_app.apk final_app.apk"
return
fi
zipalign -v 4 $1 $2
}
function android_align {
$ANDROID_HOME/build-tools/android-4.4W/zipalign -v 4 $1 $2
}
function mov2gif {
PALETTE=/tmp/palette.png
ffmpeg -i $1 -y -vf palettegen $PALETTE
ffmpeg -i $1 -i $PALETTE -lavfi paletteuse=bayer_scale=5:dither=bayer -r 10 -f gif -y $2
rm $PALETTE
}
function keystore_alias {
if [[ -z $1 ]]; then
echo "Check android keystore alias sintax:"
echo "keystore_alias path/to/filename.keystore"
return
fi
keytool -v -list -keystore "$1" | grep "alias"
}
function android_screenshot {
FILENAME=`date +%Y%m%d%H%M%S`;
adb shell /system/bin/screencap -p /sdcard/$FILENAME.png;
adb pull /sdcard/$FILENAME.png ~/Desktop/$FILENAME.png;
}
function icon_generator {
if [[ -z $1 && -z $2 ]]; then
echo "Icon Generator sintax:"
echo "icon_generator icon.png ../path/to/export"
return
fi
ticons icons -p ios,android -d $2 $1
}
function splash_generator {
if [[ -z $1 && -z $2 ]]; then
echo "SplashScreen Generator sintax:"
echo "splash_generator splashscreen.png ../path/to/export"
return
fi
ticons splashes -n -p ios,android -d $2 $1
}
# Git branch info
export PS1="$WHITE[$LIGHT_GRAY\u$WHITE@$LIGHT_GRAY\H$WHITE] \$\n$LIGHT_YELLOW\w$GREEN\$(parse_git_branch)\$(parse_git_tag)$WHITE:$RESET"
# PATH Reset
PATH=/usr/local/bin:/usr/local/Cellar/node/5.4.1_1/bin:/usr/bin:/bin:/usr/sbin:/sbin
# Android SDK
ANDROID_HOME=$HOME/AndroidDevelopmentTools/sdk
export PATH=$PATH:$ANDROID_HOME/platform-tools:$ANDROID_HOME/tools
# Sencha Cmd
export SENCHA_CMD_3_0_0="$HOME/bin/Sencha/Cmd/5.1.3.61"
export PATH=$PATH:$SENCHA_CMD_3_0_0:$HOME/bin/Sencha/Cmd/3.0.0.250
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment