Created
July 30, 2015 15:38
-
-
Save dsebastien/47d24a5d6c1b8005f434 to your computer and use it in GitHub Desktop.
Bash profile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this file should be loaded using "source" in the Bash Profile (~/.profile) | |
# source /c/CloudStation/Configuration/Bash/bashProfile.txt | |
# ================================================================================================= | |
# Bash config | |
# ================================================================================================= | |
clear # clear the MSYS MOTD | |
HISTSIZE=3000 # Big history | |
SAVEHIST=3000 # Big history | |
HISTCONTROL=ignoreboth # ignore duplicates and spaces in .bash_history | |
# ================================================================================================= | |
# General | |
# ================================================================================================= | |
export CLOUDSTATION_HOME=/c/CloudStation | |
export HOME=$CLOUDSTATION_HOME/Configuration/SebHome | |
# ================================================================================================= | |
# Utility | |
# ================================================================================================= | |
export HOSTNAME=`hostname` | |
alias saveprofile='cp $CLOUDSTATION_HOME/Configuration/Bash/bashProfile.txt /c/dev/wks/dotFiles/bash/; cd /c/dev/wks/dotFiles/bash; git add bashProfile.txt; git commit -m "Updated bash profile"; git push origin master; cd -' | |
# ================================================================================================= | |
# Functions and aliases | |
# ================================================================================================= | |
export NPP_HOME=$CLOUDSTATION_HOME/Programs/tools/npp.6.6.9.bin/ | |
npp(){ ("$NPP_HOME/notepad++.exe" "$1")& } | |
export SUBLIMETEXT_HOME=$CLOUDSTATION_HOME/Programs/tools/SublimeText3_build_3083_x64/ | |
sublime(){ ("$SUBLIMETEXT_HOME/sublime_text.exe" "$1")& } | |
alias sub='sublime' | |
alias s='sublime' | |
append_to_path(){ | |
PATH=$1":"$PATH | |
} | |
# change the extension of all files (recursively) from extension A to extension B | |
# Example: chgext zip cbz (rename all zip files to cbz) | |
chgext(){ | |
SAVEIFS=$IFS # save the internal field separator (IFS) (reference: http://bash.cyberciti.biz/guide/$IFS) | |
IFS=$(echo -en "\n\b") # change it to newline | |
filesToRename=`find . -type f -name "*.$1"` # recursively find all files matching the original extension | |
#for fileToRename in *.$1; do # non-recursive version | |
for fileToRename in $filesToRename; do | |
mv "$fileToRename" "${fileToRename%.$1}.$2" # the original extension is removed then the new one is added | |
#fileName="`basename $fileToRename .$1`" # find the filename without the extension | |
#mv "$fileToRename" "$fileName.$2" # assuming that we have the filename alone | |
#mv "$fileToRename" "$(sed "s/\."$1"/."$2"/" <<< $fileToRename)" # sed alternative | |
done | |
#unset fileName | |
unset fileToRename | |
unset filesToRename | |
IFS=$SAVEIFS # restore the internal field separator (IFS) | |
} | |
## Make a folder and cd into it | |
mkcd() | |
{ | |
mkdir -p $1 && cd $1 | |
} | |
## Auto ls after cd | |
cd () { | |
builtin cd "$@" && ls -al --color=auto --human-readable; | |
} | |
## Infinite cd (invoke with number to go up n folders: .. 5 --> go up 5 folders) | |
..() { | |
N=$(($1)) | |
if [ $N -lt 1 ]; then | |
N=1 | |
fi | |
while ((N)); do | |
cd .. | |
let N-=1 | |
done; | |
} | |
## Create a backup file | |
bak() | |
{ | |
cp $1 $1_`date +%Y-%m-%d_%Hh%Mm%Ss` | |
ls | |
} | |
## Calculator | |
calc(){ awk "BEGIN{ print $* }" ;} | |
## Extraction | |
extract () { | |
if [ -f $1 ] ; then | |
case $1 in | |
*.tar.bz2) tar xjf $1 ;; | |
*.tar.gz) tar xzf $1 ;; | |
*.bz2) bunzip2 $1 ;; | |
*.rar) unrar e $1 ;; | |
*.gz) gunzip $1 ;; | |
*.tar) tar xf $1 ;; | |
*.tbz2) tar xjf $1 ;; | |
*.tgz) tar xzf $1 ;; | |
*.zip) unzip $1 ;; | |
*.Z) uncompress $1 ;; | |
*.7z) 7z x $1 ;; | |
*) echo "'$1' cannot be extracted via extract()" ;; | |
esac | |
else | |
echo "'$1' is not a valid file" | |
fi | |
} | |
## Tools | |
gmail() { (explorer "https://mail.google.com" )& } | |
alias mail='gmail' | |
alias inbox='gmail' | |
gcalendar() { ( explorer "https://www.google.com/calendar" )& } | |
alias calendar='gcalendar' | |
alias gcal='gcalendar' | |
contacts() { ( explorer "https://www.google.com/contacts" )& } | |
alias contact='contacts' | |
feedly() { ( explorer "https://feedly.com/#my" )& } | |
alias news='feedly' | |
facebook() { ( explorer "https://www.facebook.com/" )& } | |
alias fb='facebook' | |
alias f='facebook' | |
## Search | |
google(){ (explorer "https://www.google.com/search?hl=en&q=$*" )& } | |
alias goo='google' | |
alias g='google' | |
alias search='google' | |
googleid(){ (explorer "https://www.google.com/search?hl=en&tbs=ida:1&gl=us&q=$*" )& } # in-depth articles: http://lifehacker.com/find-in-depth-articles-on-google-with-a-url-trick-1678500306?utm_campaign=socialflow_lifehacker_facebook&utm_source=lifehacker_facebook&utm_medium=socialflow | |
alias gid='googleid' | |
youtube(){ (explorer "https://www.youtube.com/results?search_query=$*" )& } | |
alias you='youtube' | |
alias y='youtube' | |
duckduckgo(){ (explorer "https://duckduckgo.com/?q=$*" )& } | |
alias duck='duckduckgo' | |
wikipedia() { (explorer "http://en.wikipedia.org/w/index.php?search=$*" )& } | |
wikien() { (explorer "http://en.wikipedia.org/w/index.php?search=$*" )& } | |
wikifr() { (explorer "http://fr.wikipedia.org/w/index.php?search=$*" )& } | |
imdb() { (explorer "http://www.imdb.com/find?s=all&q=$*" )& } | |
dico() { (explorer "http://www.cnrtl.fr/definition/$*" )& } | |
img(){ (explorer "https://www.google.com/search?tbm=isch&q=$*" )& } | |
vid(){ (explorer "https://www.google.com/search?tbm=vid&q=$*" )& } | |
# Translation | |
frnl(){ (explorer "https://translate.google.com/#fr/nl/$*" )& } | |
fren(){ (explorer "https://translate.google.com/#fr/en/$*" )& } | |
nlfr(){ (explorer "https://translate.google.com/#nl/fr/$*" )& } | |
nlen(){ (explorer "https://translate.google.com/#nl/en/$*" )& } | |
enfr(){ (explorer "https://translate.google.com/#en/fr/$*" )& } | |
ennl(){ (explorer "https://translate.google.com/#en/nl/$*" )& } | |
# General | |
alias mark='echo =================================================' | |
alias cls='clear' | |
alias c='clear' | |
alias .1='cd ..' | |
alias .2='cd ../..' | |
alias .3='cd ../../..' | |
alias .4='cd ../../../../' | |
alias .5='cd ../../../../../' | |
alias .6='cd ../../../../../../' | |
alias .7='cd ../../../../../../../' | |
alias .8='cd ../../../../../../../../' | |
alias ..1='.1' | |
alias ..2='.2' | |
alias ..3='.3' | |
alias ..4='.4' | |
alias ..5='.5' | |
alias ..6='.6' | |
alias ..7='.7' | |
alias ..8='.8' | |
alias ...='.. 2' # see function .. | |
alias ....='.. 3' | |
alias .....='.. 4' | |
alias ......='.. 5' | |
alias .......='.. 6' | |
alias .......='.. 7' | |
alias ........='.. 8' | |
alias cd..='cd ..' | |
alias cd...='.. 2' | |
alias cd....='.. 3' | |
alias cd.....='.. 4' | |
alias cd......='.. 5' | |
alias cd.......='.. 6' | |
alias cd........='.. 7' | |
alias cd.........='.. 8' | |
alias CD='cd' # can't bother with case sensitivity bullshit | |
alias back='cd -' # go back to previous location | |
alias prev='back' | |
alias mkdir='mkdir -p -v' # create folder (including parents if necessary) | |
alias rm='rm --force --verbose' # let me see what's going on | |
alias mv='mv --verbose' # let me see what's going on | |
alias cp='cp --verbose' # let me see what's going on | |
alias ls='ls --color=auto --human-readable -al' # colored and human readable sizes | |
alias ll='ls -t --reverse' # last modified | |
alias lsrecursive='ls -R | grep ":$" | sed -e '\''s/:$//'\'' -e '\''s/[^-][^\/]*\//--/g'\'' -e '\''s/^/ /'\'' -e '\''s/-/|/'\''' | |
alias lsr='lsrecursive' | |
alias lr='lsrecursive' | |
alias lrec='lsrecursive' | |
alias l.='ls -d .*' # list only hidden | |
alias lx='ls -XB' # sort by extension. | |
alias lk='ls -S --reverse' # sort by size, biggest last. | |
alias lt='ls -t --reverse' # sort by date, most recent last. | |
alias lc='ls -tc --reverse' # sort by/show change time,most recent last. | |
alias lu='ls -tu --reverse' # sort by/show access time,most recent last. | |
alias ld='ls -G | grep ^d' # only list directories | |
alias lsd='ls -G | grep ^d' # only list directories | |
alias lf='find . -type f' # list files in current and sub folders | |
alias lldu="find -maxdepth 1 -mindepth 1 -type d -exec du -sh {} \;" # find directory sizes | |
alias qfind="find . -iname " | |
alias h='history' | |
alias grep='grep -i' # ignore case. Add '--color=auto' for *nix | |
alias df='df -h' # human friendly | |
alias du='du -h' # human friendly | |
alias ds='du -sck * | sort -n' # disk usage of files in current directory | |
alias ping='ping -c 4' # we don't ping forever | |
alias path='echo -e ${PATH//:/\\n}' # display the path in a readable form | |
alias generatepassword='openssl rand -base64 9' # basic pwd generator | |
alias genpwd='generatepassword' | |
alias pwdgen='generatepassword' | |
alias netstat='netstat -tafo' # active connections, FQDNs, process ids, ... | |
alias untargz='tar -zxvf' # i can't remember that shit | |
alias untarbz2='tar -jxvf' # i can't remember that shit | |
alias pud='pushd' # symmetry is beautiful | |
alias pod='popd' # symmetry is beautiful | |
alias hs='history | grep --color=auto' # search in history | |
alias freq='cut -f1 -d" " $HISTFILE | sort | uniq -c | sort -nr | head -n 30' # frequently used commands | |
## Dev | |
alias locjava='wc -l `find . -iname "*.java"` | sort -n' | |
## Windows world | |
alias dir='ls' # Windows friendly | |
alias copy='cp' | |
alias del='rm' | |
alias md='mkdir' | |
alias rd='rmdir' | |
alias rename='mv' | |
alias e='explorer .' # open file explorer here | |
alias explore='e' | |
alias reboot='/c/WINDOWS/system32/shutdown.exe /r /t 0 /d p /f' | |
#alias shutdown='/c/WINDOWS/system32/shutdown.exe /s /t 0 /d p /f' | |
# ================================================================================================= | |
# Bash profile | |
# ================================================================================================= | |
alias profile='(sublime $CLOUDSTATION_HOME/Configuration/Bash/bashProfile.txt)&' | |
alias p='profile' | |
# ================================================================================================= | |
# Seb | |
# ================================================================================================= | |
alias home='start ~' | |
alias ehome='home' | |
alias homee='home' | |
export SEB_NOTES=$CLOUDSTATION_HOME/NOTES.txt | |
alias notes='sublime $SEB_NOTES' | |
alias n='notes' | |
export SEB_TODO=$CLOUDSTATION_HOME/TODO.txt | |
alias todos='sublime $SEB_TODO' | |
alias todo='todos' | |
export SEB_MINDMAP=$CLOUDSTATION_HOME/Seb.mm | |
alias mindmap='freemind $SEB_MINDMAP' | |
# ================================================================================================= | |
# TOOLS | |
# ================================================================================================= | |
export TOOLS_HOME=$CLOUDSTATION_HOME/Programs/tools | |
# 7-zip | |
append_to_path $TOOLS_HOME/7-Zip | |
alias 7zip='7z' | |
alias extract-all='7z x -y '\''*.zip'\' # extract every archive it can :) | |
# ANT movie catalog | |
append_to_path $TOOLS_HOME/AntMovieCatalog | |
alias antmoviecatalog='(MovieCatalog.exe)&' | |
alias moviecatalog='antmoviecatalog' | |
alias amc='antmoviecatalog' | |
# ffmpeg | |
export FFMPEG_HOME=$TOOLS_HOME/ffmpeg-20140214-git-fd982f2-win64-static | |
append_to_path $FFMPEG_HOME/bin | |
# FreeMind | |
append_to_path $TOOLS_HOME/freemind-bin-max-1.0.1 | |
freemind(){ ("FreeMind64.exe" "$1")& } | |
alias fm='freemind' | |
# JDownloader | |
append_to_path $TOOLS_HOME/JDownloader | |
alias jdownloader='(JDownloader.exe)&' | |
# Jude Professional | |
export JUDE_HOME=$TOOLS_HOME/jude_professional | |
append_to_path ${JUDE_HOME} | |
alias jude='cd $JUDE_HOME;((start JudeWindowsRun.bat)&); cd -;' | |
# Putty | |
append_to_path $TOOLS_HOME/putty | |
alias pageant='(PAGEANT.EXE)&' | |
alias putty='(kitty_portable.exe)&' # portable alternative to putty | |
alias plink='(PLINK.EXE)&' | |
alias pscp='(PSCP.EXE)&' | |
alias psftp='(PSFTP.EXE)&' | |
alias puttygen='(PUTTYGEN.EXE)&' | |
# SolEol | |
append_to_path $TOOLS_HOME/SolEol-Windows/SolEol | |
alias soleol='(SolEol.exe)&' | |
alias srt='soleol' | |
alias dldsrt='soleol' | |
# SysInternals | |
append_to_path $TOOLS_HOME/SysInternalsSuite | |
alias procexp='(procexp.exe)&' | |
alias procxp='procexp' | |
alias pe='procexp' | |
alias autoruns='(autoruns.exe)&' # should be started as admin | |
# USB Ejector | |
append_to_path $TOOLS_HOME/USBDiskEjector1.3.0.3 | |
alias usbeject='(USB_Disk_Eject.exe)&' | |
alias ejectusb='usbeject' | |
# uTorrent | |
append_to_path $TOOLS_HOME/uTorrentPortable | |
alias utorrent='(uTorrentPortable.exe)&' | |
alias torrent='utorrent' | |
# win32diskimager | |
append_to_path $TOOLS_HOME/win32diskimager-v0.8-binary | |
alias w32diskimager='(Win32DiskImager.exe)&' | |
# WinDirStat | |
append_to_path $TOOLS_HOME/WinDirStatPortable | |
alias windirstat='(WinDirStatPortable.exe)&' | |
# WinSplitRevolution | |
append_to_path $TOOLS_HOME/WinSplitRevolution | |
alias winsplitrevolution='(WinSplit.exe)&' | |
alias winsplit='winsplitrevolution' | |
# WinMerge | |
append_to_path $TOOLS_HOME/WinMerge-2.12.4-exe | |
alias winmerge='(WinMerge.exe)&' | |
alias merge='winmerge' | |
# WinSCP | |
append_to_path $TOOLS_HOME/winscp555 | |
alias winscp='(WinSCP.exe)&' | |
# KeePass | |
append_to_path $TOOLS_HOME/KeePass-2.28 | |
alias keepass='(KeePass.exe)&' | |
alias kp='keepass' | |
# wget | |
export WGET_HOME=$TOOLS_HOME/wget-1.11.4-1-bin | |
export SYSTEM_WGETRC=$WGET_HOME | |
append_to_path $WGET_HOME/bin | |
wget(){ ("wget.exe" "$1")& } | |
# Internet Explorer | |
append_to_path /c/Program\ Files\ \(x86\)/Internet\ Explorer | |
alias internetexplorer='iexplore.exe' | |
alias ie='internetexplorer' | |
# MS Edge | |
alias microsoftedge='explorer "shell:AppsFolder\Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge"' | |
alias mse='microsoftedge' | |
alias edge='microsoftedge' | |
# Office tools | |
append_to_path /c/Program\ Files\ \(x86\)/Microsoft\ Office\ 2010/Office14; # ensure that office binaries are on the path | |
alias excel='EXCEL.EXE' | |
alias word='WINWORD.EXE' | |
alias outlook='OUTLOOK.EXE' | |
alias powerpoint='POWERPNT.EXE' | |
alias ppt='powerpoint' | |
alias onenote='ONENOTE.EXE' | |
# wake on lan | |
append_to_path $TOOLS_HOME/wakemeonlan | |
alias wol='(WakeMeOnLan.exe)&' | |
alias wakemeonlan='wol' | |
# XBMC | |
export XBMC_HOME=$CLOUDSTATION_HOME/XBMC | |
append_to_path $XBMC_HOME | |
kodi(){ ( cd $XBMC_HOME; start KODI.exe -p; cd -; ) } | |
alias xbmc='kodi' | |
# WinAuth | |
append_to_path $CLOUDSTATION_HOME/Security/Battle.net/WinAuth | |
alias winauth='WinAuth.exe &' | |
# ImageMagick | |
export IMAGEMAGICK_HOME=$TOOLS_HOME/ImageMagick-6.9.0-4 | |
append_to_path $IMAGEMAGICK_HOME | |
# mplayer & mencoder | |
export MPLAYER_HOME=$TOOLS_HOME/mplayer-svn-37353-x86_64 | |
append_to_path $MPLAYER_HOME | |
# sqlite | |
export SQLITE_HOME=$TOOLS_HOME/SQLite | |
append_to_path $SQLITE_HOME | |
alias sqlite3='(sqlite3.exe)&' | |
alias sqlite='sqlite3' | |
# Twitter (twt) | |
append_to_path $TOOLS_HOME/twt | |
tweet(){ # FIXME needs proper escaping | |
("twt.exe" "$@")& | |
} | |
alias twt='tweet' | |
alias t='tweet' | |
# ================================================================================================= | |
# READERS | |
# ================================================================================================= | |
export READERS_HOME=$CLOUDSTATION_HOME/Programs/readers | |
# ComicRack | |
append_to_path $READERS_HOME/ComicRack | |
alias comicrack='(ComicRack.exe)&' | |
alias comics='comicrack' | |
alias comic='comicrack' | |
# ================================================================================================= | |
# GAMES | |
# ================================================================================================= | |
export GAMES_HOME=$CLOUDSTATION_HOME/Programs/games | |
# Minecraft | |
append_to_path $GAMES_HOME/minecraft | |
append_to_path $GAMES_HOME/minecraft/CraftBukkitServer | |
alias minecraft='(minecraftp.exe)&' | |
#alias minecraftserver='(minecraftftp_server.exe)&' | |
alias minecraftserver='(bukkitgui.exe)&' | |
alias minecraftsrv='minecraftserver' | |
# ================================================================================================= | |
# EMULATION | |
# ================================================================================================= | |
export EMULATION_HOME=$CLOUDSTATION_HOME/Programs/emulation | |
# ZSNES | |
append_to_path $EMULATION_HOME/zsnesw151 | |
alias zsnes='(zsnesw.exe)&' | |
alias znes='zsnes' | |
alias snes='zsnes' | |
# Project64 | |
append_to_path $EMULATION_HOME/Project64 | |
alias project64='(Project64.exe)&' | |
alias n64='project64' | |
alias nintendo64='project64' | |
# ================================================================================================= | |
# SCRIPTS | |
# ================================================================================================= | |
export SCRIPTS_HOME=$CLOUDSTATION_HOME/Scripts | |
switchproxy(){ (PowerShell.exe -ExecutionPolicy Bypass "$SCRIPTS_HOME/switchProxy.ps1") } | |
alias proxy='switchproxy' | |
alias pxy='switchproxy' | |
alias spxy='switchproxy' | |
alias swpxy='switchproxy' | |
checkroutingtable(){ (PowerShell.exe -ExecutionPolicy Bypass "$SCRIPTS_HOME/checkRoutingTable.ps1") } | |
alias fixroutes='checkroutingtable' | |
alias fixroute='checkroutingtable' | |
alias routingtable='checkroutingtable' | |
alias checkroutes='checkroutingtable' | |
ipconfigrenew(){ ( ipconfig //renew ) } | |
alias renew='ipconfigrenew' | |
# ================================================================================================= | |
# WRITING | |
# ================================================================================================= | |
export WRITING_TOOLS_HOME=$CLOUDSTATION_HOME/Programs/writing | |
export WRITING_HOME=$CLOUDSTATION_HOME/Writing | |
export WRITING_HOME_UTILS=$WRITING_HOME/_utile | |
alias ewrite='start $WRITING_HOME' | |
alias writee='ewrite' | |
alias book='ewrite' | |
alias writinghome='ewrite' | |
alias homewriting='ewrite' | |
alias writing='ewrite' | |
alias whome='ewrite' | |
writenow(){ ("start" "$WRITING_HOME/Project-$1")& } | |
alias verbes='sublime $WRITING_HOME_UTILS/verbes.txt' | |
alias mots='sublime $WRITING_HOME_UTILS/mots.txt' | |
alias words='mots' | |
alias voc='mots' | |
alias vocabulaire='mots' | |
alias prenoms='sublime $WRITING_HOME_UTILS/prenoms.txt' | |
alias expressions='sublime $WRITING_HOME_UTILS/expressions.txt' | |
alias idees='sublime $WRITING_HOME_UTILS/idees.txt' | |
alias ideas='idees' | |
# WriteMonkey | |
export WRITEMONKEY_HOME=$WRITING_TOOLS_HOME/WriteMonkey-2603 | |
append_to_path $WRITEMONKEY_HOME | |
writeproject() { (cd $WRITEMONKEY_HOME; start WriteMonkey.exe $WRITING_HOME/Project-$1/notes.txt; cd -;) } # starts detached | |
alias write='writeproject' | |
alias w='writeproject' | |
alias wm='writeproject' | |
alias wp='writeproject' | |
# Scrivener | |
export SCRIVENER_HOME=$WRITING_TOOLS_HOME/Scrivener | |
scrivener() { (cd $SCRIVENER_HOME; start Scrivener.exe $WRITING_HOME/Project-$1/project$1.scriv; cd -;) } # starts detached | |
# Mindmap project | |
mindmapproject(){ ("FreeMind64.exe" "$WRITING_HOME/Project-$1/mindmap.mm")& } | |
alias writemap='mindmapproject' | |
alias writemind='mindmapproject' | |
alias writemindmap='mindmapproject' | |
alias wmm='mindmapproject' | |
# ClicKey (typewriter sound) | |
export CLICKEY_HOME=$WRITING_TOOLS_HOME/ClicKey | |
clickey() { (cd $CLICKEY_HOME; start ClicKey.exe; cd -;) } # starts detached | |
alias typewriter='clickey' | |
alias tw='typewriter' | |
alias sound='clickey' | |
# ================================================================================================= | |
# DEV | |
# ================================================================================================= | |
# Folders | |
export DEV_HOME=/c/dev/wks | |
export DEV_SOFT_HOME=$CLOUDSTATION_HOME/Programs/dev | |
export DEV_SOFT_DATA_HOME=/c/dev/toolsdata | |
export DEV_WKS_HOME=$DEV_HOME | |
export DEV_WKS_HOME_FOLDER_NAME="`basename ${DEV_WKS_HOME}`" | |
export DEV_WKS_HOME_TEMP=$DEV_WKS_HOME/_temp | |
alias dev='cd $DEV_WKS_HOME' | |
alias d='dev' | |
alias workspace='dev' | |
alias wks='dev' | |
alias deve='start $DEV_WKS_HOME' | |
alias edev='deve' | |
alias ewks='deve' | |
alias wkse='deve' | |
alias software='start $DEV_SOFT_HOME' | |
alias soft='software' | |
alias softe='software' | |
alias esoft='software' | |
alias softwaredata='start $DEV_SOFT_DATA_HOME' | |
alias softdata='softwaredata' | |
alias swdata='softwaredata' | |
alias softdatae='softwaredata' | |
alias esoftdata='softwaredata' | |
# Java | |
alias j8_05_64='export JAVA_HOME=$DEV_SOFT_HOME/Java64/jdk1.8.0_25; export JDK_HOME=${JAVA_HOME}; append_to_path ${JAVA_HOME}/bin' | |
# Maven | |
export MAVEN_REPOSITORY=$DEV_SOFT_DATA_HOME/maven/repository | |
alias repo='start $MAVEN_REPOSITORY' | |
alias mvnrepo='repo' | |
alias mavenrepo='repo' | |
alias repoe='repo' | |
alias erepo='repo' | |
alias m3='export MAVEN_HOME=$DEV_SOFT_HOME/apache-maven-3.2.3;export M2_HOME=$MAVEN_HOME;append_to_path ${MAVEN_HOME}/bin' | |
export DEBUG_MAVEN_OPTS="-Xmx1024m -agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=y" | |
export NORMAL_MAVEN_OPTS="-Xmx1024m" | |
export MAVEN_OPTS="-Xmx1024m" | |
alias mvncv='mvn versions:update-child-modules' | |
alias mvnvuc='mvncv' | |
alias mvnuc='mvncv' | |
alias mvncvc='mvn versions:commit' | |
alias mvnucc='mvncvc' | |
alias mvnvrb='mvn versions:rollback' | |
alias mvnv='mvn versions:update-child-modules; mvn versions:commit' | |
alias mvnt='mvn clean test' | |
alias mvnit='mvn clean test -Pit' | |
alias mvnclean='mvn clean -T 4' | |
alias mvnc='mvnclean' | |
alias mvneclipse='mvn eclipse:clean eclipse:eclipse -T 4' | |
alias mvne='mvneclipse' | |
alias mvnec='mvn eclipse:clean -T 4' | |
alias mvnidea='mvn idea:clean idea:idea' | |
alias mvnid='mvnidea' | |
alias mvnpackage='mvn clean package' | |
alias mvnp='mvnpackage' | |
alias mvncp='mvnp' | |
alias mvni='mvn clean install' | |
alias mvndt='mvn dependency:tree' | |
alias mvndep='mvndt' | |
alias mvnep='mvn help:effective-pom' | |
alias mvntomcat='mvn clean install tomcat8:run-war' | |
alias mvntc='mvntomcat' | |
alias mvnweb='mvntomcat' | |
alias mvnw='mvntomcat' | |
alias mvnwar='mvntomcat' | |
alias mvnjetty='mvn jetty:run' | |
alias mvnj='mvnjetty' | |
alias mvnrp='mvn release:prepare' | |
alias mvnrprep='mvnrp' | |
alias mvnrb='mvn release:rollback' | |
alias mvnrrb='mvnrb' | |
alias mvnrperf='mvn release:perform' | |
alias mvnd='mvn clean deploy' | |
alias mvnoffline='mvn dependency:go-offline' | |
alias mvnoff='mvnoffline' | |
alias mvno='mvnoffline' | |
# Python | |
alias python2='export PYTHON_HOME=$DEV_SOFT_HOME/Python27;append_to_path ${PYTHON_HOME}' | |
alias py='python' | |
alias urlencode='python -c "import sys, urllib as ul; print ul.quote_plus(sys.argv[1])"' | |
alias urldecode='python -c "import sys, urllib as ul; print ul.unquote_plus(sys.argv[1])"' | |
# Ruby (screw that damn language and its ugly DevKit) | |
#alias ruby222='export RUBY_HOME=$DEV_SOFT_HOME/ruby-2.2.2-x64-mingw32;append_to_path ${RUBY_HOME}/bin' | |
#alias ruby='ruby.exe' | |
# Groovy | |
alias groovy24='export GROOVY_HOME=$DEV_SOFT_HOME/groovy-2.4.0-beta-3;append_to_path ${GROOVY_HOME}/bin' | |
alias gc='groovyc' | |
alias gcomp='gc' | |
alias gsh='groovysh' | |
alias gcon='groovyConsole' | |
# Dart | |
export DART_HOME=$DEV_SOFT_HOME/dart-sdk | |
export DART_SDK=$DART_HOME | |
alias dart111='append_to_path ${DART_HOME}/bin' | |
# Gradle | |
alias gradle21='export GRADLE_HOME=$DEV_SOFT_HOME/gradle-2.1;append_to_path ${GRADLE_HOME}/bin' | |
# NodeJS | |
alias nodejs='export NODEJS_HOME=$DEV_SOFT_HOME/nodejs;append_to_path ${NODEJS_HOME}' | |
# NPM | |
npm_search(){ ( explorer "https://www.npmjs.org/search?q=$*" )& } | |
alias npmsearch='npm_search' | |
alias npms='npm_search' | |
alias npmi='npm install' | |
alias npmg='npm install -g' | |
alias npmu='npm update' | |
# Configure the NPM packages folder | |
NPM_PACKAGES="/c/npm/" | |
#NPM_PACKAGES="/c/CloudStation/Configuration/dev/npm" | |
append_to_path $NPM_PACKAGES | |
# requires a npmrc or .npmrc file in the nodejs\node_modules\npm folder or in C:\Users\<user>\ with the following in it | |
# prefix="C:/CloudStation/Configuration/dev/npm" | |
# prefix="C:/npm/" | |
# Bower | |
bower_search(){ ( explorer "http://bower.io/search/?q=$*" )& } | |
alias bowers='bower_search' | |
alias bowersearch='bower_search' | |
# Git | |
alias gis='git status' | |
alias gs='gis' | |
alias gad='git add' | |
alias gitsearch='git rev-list --all | xargs git grep -F' # search in git log | |
alias gitlog="git log --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit" # show git log | |
alias gl='gitlog' | |
alias gitlogv='git log --graph --full-history --all --color --pretty=format:"%x1b[31m%h%x09%x1b[32m%d%x1b[0m%x20%s"' # visualize git log | |
alias glv='gitlogv' | |
alias gc='git clone' | |
alias gitback='git reset --soft HEAD^' # Undoes previous commit, keeps changes | |
# GitHub | |
alias github='(explorer "https://github.com/dsebastien?tab=repositories")&' | |
alias gh='github' | |
# SVN | |
export SVN_HOME=$DEV_SOFT_HOME/svn_1.8.10 | |
append_to_path $SVN_HOME | |
alias svnco='svn checkout' | |
alias svnc='find . -name ".svn" -type d -exec rm -rf {} \;' # remove all '.svn' folders | |
alias svnu='svn update' | |
# Eclipse | |
alias eclipse='($DEV_SOFT_HOME/sts362/STS.exe)&' | |
alias ecl='eclipse' | |
alias sts='eclipse' | |
# IntelliJ IDEA | |
alias intellij='($DEV_SOFT_HOME/IntelliJIDEA_14/bin/idea64.exe)&' | |
# WebStorm | |
alias webstorm='($DEV_SOFT_HOME/WebStorm_10/bin/WebStorm64.exe)&' | |
alias ws='webstorm' | |
alias sourcetree='($DEV_SOFT_HOME/SourceTreePortable/SourceTreePortable.exe)&' | |
alias stree='sourcetree' | |
# Seb Java | |
tpl-standalone() # create a stand-alone project | |
{ | |
cd $DEV_WKS_HOME | |
mkdir $1 | |
cp -r $CLOUDSTATION_HOME/Configuration/Dev/Templates/mavenTemplateJava/* ./$1/ | |
cd $1 | |
mvn clean eclipse:clean eclipse:eclipse | |
} | |
# Virtualbox | |
append_to_path /c/Program\ Files/Oracle/VirtualBox | |
alias virtualbox='VirtualBox.exe &' | |
alias vbox='virtualbox' | |
alias vboxmanage='VBoxManage.exe' | |
alias vboxmng='vboxmanage' | |
# Docker | |
export DOCKER_HOME=$DEV_SOFT_HOME/Docker | |
append_to_path $DOCKER_HOME | |
alias docker='docker.exe' | |
alias docker-machine='docker-machine.exe' | |
alias dockermachine='docker-machine' | |
alias dm='docker-machine' | |
export DOCKER_LOCAL_VM_NAME='docker-local' | |
is-docker-vm-running() | |
{ | |
echo "Checking if the local Docker VM ($DOCKER_LOCAL_VM_NAME) is running" | |
vmStatusCheckResult=$(vboxmanage list runningvms) | |
#echo $vmStatusCheckResult | |
if [[ $vmStatusCheckResult == *"$DOCKER_LOCAL_VM_NAME"* ]] | |
then | |
echo "The local Docker VM is running!" | |
return 0 | |
else | |
echo "The local Docker VM is not running (or does not exist or runs using another account)" | |
return 1 | |
fi | |
} | |
# redirect a port from the host to the local Docker VM | |
# call: docker-add-port-redirection <rule name> <host port> <guest port> | |
docker-add-port-redirection() | |
{ | |
echo "Preparing to add a port redirection to the Docker VM" | |
is-docker-vm-running | |
if [ $? -eq 0 ]; then | |
# vm is running | |
vboxmanage modifyvm $DOCKER_LOCAL_VM_NAME --natpf1 "$1,tcp,127.0.0.1,$2, ,$3" | |
else | |
# vm is not running | |
vboxmanage controlvm $DOCKER_LOCAL_VM_NAME natpf1 "$1,tcp,127.0.0.1,$2, ,$3" | |
fi | |
echo "Port redirection added to the Docker VM" | |
} | |
alias dapr='docker-add-port-redirection' | |
# remove a port redirection by name | |
# call: docker-remove-port-redirection <rule name> | |
docker-remove-port-redirection() | |
{ | |
echo "Preparing to remove a port redirection to the Docker VM" | |
is-docker-vm-running | |
if [ $? -eq 0 ]; then | |
# vm is running | |
vboxmanage modifyvm $DOCKER_LOCAL_VM_NAME --natpf1 delete "$1" | |
else | |
# vm is not running | |
vboxmanage controlvm $DOCKER_LOCAL_VM_NAME natpf1 delete "$1" | |
fi | |
echo "Port redirection removed from the Docker VM" | |
} | |
alias drpr='docker-remove-port-redirection' | |
docker-list-port-redirections() | |
{ | |
portRedirections=$(vboxmanage showvminfo $DOCKER_LOCAL_VM_NAME | grep -E 'NIC 1 Rule') | |
for i in "${portRedirections[@]}" | |
do | |
printf "$i\n" | |
done | |
} | |
alias dlrr='docker-list-port-redirections' | |
alias dlpr='docker-list-port-redirections' | |
docker-get-local-vm-ip(){ | |
export DOCKER_LOCAL_VM_IP=$(docker-machine ip $DOCKER_LOCAL_VM_NAME) | |
echo "Docker local VM ($DOCKER_LOCAL_VM_NAME) IP: $DOCKER_LOCAL_VM_IP" | |
} | |
alias dockerip='docker-get-local-vm-ip' | |
alias dip='docker-get-local-vm-ip' | |
docker-open(){ | |
docker-get-local-vm-ip | |
( explorer "http://$DOCKER_LOCAL_VM_IP:$*" )& | |
} | |
alias dop='docker-open' | |
docker-config-client() | |
{ | |
echo "Configuring the Docker client to point towards the local Docker VM ($DOCKER_LOCAL_VM_NAME)..." | |
is-docker-vm-running | |
if [ $? -eq 0 ]; then | |
eval "$(docker-machine env $DOCKER_LOCAL_VM_NAME)" | |
if [ $? -eq 0 ]; then | |
docker-get-local-vm-ip | |
echo "Docker client configured successfully! (IP: $DOCKER_LOCAL_VM_IP)" | |
else | |
echo "Failed to configure the Docker client!" | |
return; | |
fi | |
else | |
echo "The Docker client can't be configured because the local Docker VM isn't running. Please run 'docker-start' first." | |
fi | |
} | |
alias dockerconfig='docker-config-client' | |
alias configdocker='docker-config-client' | |
docker-check-local-vm() # check docker-machine status and clean up if necessary | |
{ | |
echo "Verifying the status of the local Docker VM ($DOCKER_LOCAL_VM_NAME)" | |
dmCheckResult=$(docker-machine ls) | |
#echo $dmCheckResult | |
if [[ $dmCheckResult == *"error getting state for host $DOCKER_LOCAL_VM_NAME: machine does not exist"* ]] | |
then | |
echo "The local Docker VM ($DOCKER_LOCAL_VM_NAME) is known by docker-machine but does not exist anymore." | |
echo "Cleaning docker-machine." | |
dmCleanupResult=$(docker-machine rm $DOCKER_LOCAL_VM_NAME) | |
if [[ $dmCleanupResult == *"successfully removed"* ]] | |
then | |
echo "docker-machine cleanup successful! Run 'docker-init' to create the local Docker VM." | |
fi | |
return | |
fi | |
echo "No problem with the local Docker VM ($DOCKER_LOCAL_VM_NAME) and docker-machine. If the machine does not exist yet you can create it using 'docker-init'" | |
} | |
alias dockercheck='docker-check-local-vm' | |
alias checkdocker='docker-check-local-vm' | |
docker-start() | |
{ | |
echo "Trying to start the local Docker VM ($DOCKER_LOCAL_VM_NAME)" | |
dmStartResult=$(docker-machine start $DOCKER_LOCAL_VM_NAME) | |
#echo $dmStartResult | |
if [[ $dmStartResult == *"machine does not exist"* ]] | |
then | |
echo "The local Docker VM ($DOCKER_LOCAL_VM_NAME) does not seem to exist." | |
docker-check-local-vm | |
return | |
fi | |
if [[ $dmStartResult == *"VM not in restartable state"* ]] | |
then | |
echo "The local Docker VM ($DOCKER_LOCAL_VM_NAME) is probably already running." | |
docker-config-client | |
return | |
fi | |
if [[ $dmStartResult == *"Waiting for VM to start..."* ]] | |
then | |
echo "The local Docker VM ($DOCKER_LOCAL_VM_NAME) was successfully started!" | |
docker-config-client | |
return | |
fi | |
if [[ $dmStartResult == *"Host does not exist"* ]] | |
then | |
echo "The local Docker VM ($DOCKER_LOCAL_VM_NAME) does not exist. Run 'docker-init' first!" | |
return | |
fi | |
} | |
alias dockerstart='docker-start' | |
alias startdocker='docker-start' | |
docker-stop() | |
{ | |
echo "Trying to stop the local Docker VM ($DOCKER_LOCAL_VM_NAME)" | |
dmStopResult=$(docker-machine stop $DOCKER_LOCAL_VM_NAME) | |
#echo $dmStopResult | |
if [[ $dmStopResult == *"Host does not exist"* ]] | |
then | |
echo "The local Docker VM ($DOCKER_LOCAL_VM_NAME) does not seem to exist." | |
docker-check-local-vm | |
return | |
fi | |
if [[ $dmStopResult == *"exit status 1"* ]] | |
then | |
echo "The local Docker VM ($DOCKER_LOCAL_VM_NAME) is already stopped (or doesn't exist anymore)." | |
docker-check-local-vm | |
return | |
fi | |
echo "The local Docker VM ($DOCKER_LOCAL_VM_NAME) was stopped successfully." | |
} | |
alias dockerstop='docker-stop' | |
alias stopdocker='docker-stop' | |
docker-init() | |
{ | |
echo "Trying to create a local Docker VM called $DOCKER_LOCAL_VM_NAME" | |
dmCreateResult=$(docker-machine create --driver virtualbox $DOCKER_LOCAL_VM_NAME) | |
#echo $dmCreateResult | |
if [[ $dmCreateResult == *"has been created and is now the active machine."* ]] | |
then | |
echo "Stopping the VM in order to configure port redirections" | |
docker-stop | |
docker-add-port-redirection "webdev1" 8080 8080 | |
docker-add-port-redirection "webdev2" 8081 8081 | |
docker-add-port-redirection "webdev3" 8090 8090 | |
docker-add-port-redirection "browsersync" 3000 3000 | |
docker-add-port-redirection "browsersyncui" 3001 3001 | |
echo "Port redirections configured successfully" | |
echo "Local Docker VM ($DOCKER_LOCAL_VM_NAME) created successfully! Use 'docker-start' to start the VM" | |
return | |
fi | |
if [[ $dmCreateResult == *"already exists"* ]] | |
then | |
echo "The local Docker VM ($DOCKER_LOCAL_VM_NAME) already exists!" | |
dockerstart | |
return | |
fi | |
} | |
alias dockerinit='docker-init' | |
alias initdocker='docker-init' | |
# Balsamiq | |
export BALSAMIQ_HOME=$DEV_SOFT_HOME/BalsamiqMockups | |
append_to_path $BALSAMIQ_HOME | |
alias balsamiq='BalsamiqMockups.exe' | |
# MongoDB | |
export MONGODB_HOME=$DEV_SOFT_HOME/mongodb-win32-x86_64-2008plus-2.6.7 | |
append_to_path $MONGODB_HOME/bin | |
alias mongodb='mongod.exe' | |
# ================================================================================================= | |
# ELECTRONICS | |
# ================================================================================================= | |
# Folders | |
export ELECTRONICS_SOFT_HOME=$CLOUDSTATION_HOME/Programs/electronics | |
export ARDUINO_HOME=$ELECTRONICS_SOFT_HOME/arduino-1.6.0 | |
export ELECTRONICS_DEV_HOME=$CLOUDSTATION_HOME/Electronics | |
export ELECTRONICS_HOME=$ELECTRONICS_DEV_HOME | |
append_to_path $ARDUINO_HOME | |
append_to_path $ARDUINO_HOME/hardware/tools/avr/bin | |
alias arduinoide='arduino.exe' | |
alias arduino='arduinoide' | |
alias avrdude='avrdude.exe' | |
alias electronics='cd $ELECTRONICS_DEV_HOME' | |
alias eelectronics='electronics' | |
alias earduino='electronics' | |
export JAVABREADBOARD_HOME=$ELECTRONICS_SOFT_HOME/JavaBreadboard | |
alias javabreadboard='cd $JAVABREADBOARD_HOME;start JavaBreadboard.bat; cd -;' | |
export FRITZING_HOME=$ELECTRONICS_SOFT_HOME/fritzing.0.9.1b.64.pc | |
alias fritzing='cd $FRITZING_HOME;start Fritzing.exe; cd -;' | |
export ATANUA_HOME=$ELECTRONICS_SOFT_HOME/atanua130617 | |
alias atanua='cd $ATANUA_HOME; ./Atanua.exe; cd -;' | |
export LTSPICE_HOME=$ELECTRONICS_SOFT_HOME/LTspiceIV | |
append_to_path $LTSPICE_HOME | |
alias ltspice='(scad3.exe)&' | |
# ================================================================================================= | |
# INITIALIZATION | |
# ================================================================================================= | |
# Default tools | |
alias defaultjava='j8_05_64' | |
alias defaults='defaultjava; m3; python2; groovy24; gradle21; nodejs; dart111' | |
alias default='defaults' | |
# Initialization | |
workspace # Go home | |
defaults # Load default tools |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment