Skip to content

Instantly share code, notes, and snippets.

@renaudmathieu
Last active September 23, 2016 13:52
Show Gist options
  • Save renaudmathieu/4d9e368db38d7364d1ca5e0be5b8e8a3 to your computer and use it in GitHub Desktop.
Save renaudmathieu/4d9e368db38d7364d1ca5e0be5b8e8a3 to your computer and use it in GitHub Desktop.
A simple Android developer basic file.
#!/bin/bash
# ------------------------------------------------------------------------------
# This is a configuration file to set up a clean and safe development environment.
# To use this file, you need to source it (add a call in your ~/.bashrc file
# for example) then you can simply run functions
# Contact renaudmathieu.fr if you have any question.
# ------------------------------------------------------------------------------
# ------------------------------------------------------------------------------
# Environment variables
# ------------------------------------------------------------------------------
# Android SDK
SDK=${HOME}/Library/Android/sdk
SDK_PLATFORM=${SDK}/platform-tools
SDK_TOOLS=${SDK}/tools
# Android NDK
NDK=${HOME}/Library/Android/android-ndk-r10e
# Gradle
#GRADLE=${HOME}/Library/Gradle/gradle-2.5/bin
# GSUTIL
GSUTIL=${HOME}/Library/gsutil
# Personal scripts and tools
SCRIPTS=${HOME}/Documents/scripts
export PATH=${PATH}:
export PATH+=${SCRIPTS}:
export PATH+=${SDK}:
export PATH+=${SDK_PLATFORM}:
export PATH+=${SDK_TOOLS}:
export PATH+=${NDK}:
export PATH+=${GRADLE}:
export PATH+=${GSUTIL}:
export ANDROID_HOME=${SDK}
export ANDROID_NDK=${NDK}
# Node Version Manager
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
# PS1
source /usr/local/git/contrib/completion/git-completion.bash
source /usr/local/git/contrib/completion/git-prompt.sh
# Java config
export JAVA7_HOME=$(/usr/libexec/java_home -v 1.7)
export JAVA8_HOME=$(/usr/libexec/java_home -v 1.8)
# ------------------------------------------------------------------------------
# Aliases
# ------------------------------------------------------------------------------
alias pylogcat="python ~/Documents/scripts/pylogcat.py"
alias log="pidcat com.renaudmathieu.beta"
# Git
alias repo_clean="git remote update origin --prune && git branch --merged development | grep -v development | xargs git branch -d"
alias repo_check="git for-each-ref --sort=committerdate --format='%(refname:short) * %(authorname) * %(committerdate:relative)' refs/remotes/ | column -t -s '*'."
#git diff --name-only checkstyle $(git merge-base checkstyle development) # Get modified files in a branch
# Android
alias adbclear="adb shell pm clear com.renaudmathieu.beta"
alias adbactivities="adb shell dumpsys activity | grep -i 'run' | grep -i 'com.renaudmathieu.beta'"
# ------------------------------------------------------------------------------
# Functions
# ------------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# Miscellaneous
# -----------------------------------------------------------------------------
export PS1='\[\e[0m\]$yyy\[\e[01;30m\]\t `if [ $? = 0 ]; then echo "\[\e[32m\]✔"; else echo "\[\e[31m\]✘"; fi` \[\e[31m\]($(__git_ps1 "%s"))\[\e[00m\] \[\e[0;96m\]\w\[\e[00m\]$ '
@renaudmathieu
Copy link
Author

renaudmathieu commented Jul 13, 2016

Add this in your .bashrc or .profile file

if [ -n "$BASH_VERSION" ]; then
  # include my personal script if it exists
  if [ -f ~/Documents/scripts/global.sh ]; then
    . ~/Documents/scripts/global.sh
  fi
fi

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