Skip to content

Instantly share code, notes, and snippets.

@lemonjp
Last active April 18, 2018 04:06
Show Gist options
  • Save lemonjp/69869ec4c6ebc2d7b8620ff14d0a0acf to your computer and use it in GitHub Desktop.
Save lemonjp/69869ec4c6ebc2d7b8620ff14d0a0acf to your computer and use it in GitHub Desktop.
Ubuntu 16.04 Setup

Ubuntu 16.04 Setup

Customize bash prompt

eazy prompt

# get current branch in git repo
function parse_git_branch() {
	BRANCH=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`
	if [ ! "${BRANCH}" == "" ]
	then
		STAT=`parse_git_dirty`
		echo "[${BRANCH}${STAT}]"
	else
		echo ""
	fi
}

# get current status of git repo
function parse_git_dirty {
	status=`git status 2>&1 | tee`
	dirty=`echo -n "${status}" 2> /dev/null | grep "modified:" &> /dev/null; echo "$?"`
	untracked=`echo -n "${status}" 2> /dev/null | grep "Untracked files" &> /dev/null; echo "$?"`
	ahead=`echo -n "${status}" 2> /dev/null | grep "Your branch is ahead of" &> /dev/null; echo "$?"`
	newfile=`echo -n "${status}" 2> /dev/null | grep "new file:" &> /dev/null; echo "$?"`
	renamed=`echo -n "${status}" 2> /dev/null | grep "renamed:" &> /dev/null; echo "$?"`
	deleted=`echo -n "${status}" 2> /dev/null | grep "deleted:" &> /dev/null; echo "$?"`
	bits=''
	if [ "${renamed}" == "0" ]; then
		bits=">${bits}"
	fi
	if [ "${ahead}" == "0" ]; then
		bits="*${bits}"
	fi
	if [ "${newfile}" == "0" ]; then
		bits="+${bits}"
	fi
	if [ "${untracked}" == "0" ]; then
		bits="?${bits}"
	fi
	if [ "${deleted}" == "0" ]; then
		bits="x${bits}"
	fi
	if [ "${dirty}" == "0" ]; then
		bits="!${bits}"
	fi
	if [ ! "${bits}" == "" ]; then
		echo " ${bits}"
	else
		echo ""
	fi
}

export PS1="\[\e[34m\]\u\[\e[m\]\[\e[37m\]@\[\e[m\]\[\e[32m\]\W\[\e[m\]\[\e[37m\]\`parse_git_branch\`\[\e[m\]-\[\e[36m\]\t\[\e[m\] "

Python supported Vim

sudo apt install vim-nox

Install JDK8

sudo apt-get update
sudo apt-get install default-jdk

vi ~/.bashrc
JAVA_HOME=$(readlink -f /usr/bin/javac | sed "s:/bin/javac::")
export JAVA_HOME
PATH=$PATH:$JAVA_HOME/bin
export PATH

source ~/.bashrc

Install Gradle

mkdir ~/lib && cd ~/lib
https://services.gradle.org/distributions/gradle-2.14-bin.zip
unzip gradle-2.14-bin.zip

vi ~/.profile
PATH="$PATH:$HOME/lib/gradle-2.14/bin"
source ~/.profile

Install Maven

cd ~/lib
wget http://ftp.jaist.ac.jp/pub/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.zip
unzip apache-maven-3.3.9-bin.zip

vi ~/.profile
PATH="$PATH:$HOME/lib/apache-maven-3.3.9/bin"
source ~/.profile

Install Node Using NVN

sudo apt-get update
sudo apt-get install build-essential libssl-dev
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.3/install.sh | bash
source ~/.profile
nvm ls-remote
nvm install 5.8.0
nvm use 5.8.0
node -v
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment