Skip to content

Instantly share code, notes, and snippets.

@jasmainak
Forked from raghavrv/automations.sh
Created January 6, 2019 04:42
Show Gist options
  • Save jasmainak/7eb849244a60ee475fce1b82e0fab896 to your computer and use it in GitHub Desktop.
Save jasmainak/7eb849244a60ee475fce1b82e0fab896 to your computer and use it in GitHub Desktop.
Some automation aliases and scripts for Telecom Paristech desktop / TSI server
export LANG=en_US.UTF-8
# COMMON CONFS
# Use pgrep with full command path and display the name
alias checktuns="ps x | grep 'ssh -N'"
alias pgrep="ps x | grep "
# Set the scikit path env var
export SCIKIT_LEARN_PATH=~/raghav/code/scikit-learn
export CHROME_USER_DATA_DIR=~/raghav/google-chrome
# TSI SERVER CONFS -----------------------------
# The distro is now same as telecom desktops - debian instead of spark
# if [[ "$(uname -a)" == *"spark"* ]]
if [[ "$(uname -a)" == *"ssh"* ]]
then
echo "The lib/binaries for TSI server have been loaded";
# The distro is now same as telecom desktops - debian instead of spark
# Same lib/binaries can be used
# export HOME2=~/raghav/tsi_server
# export PATH=$PATH:~/raghav/tsi_server/bin
# export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/raghav/tsi_server/lib
# export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/raghav/tsi_server/lib64
# xset r rate 213 200
alias o="xdg-open ."
echo "The lib/binaries for desktop have been loaded"
export HOME2=~/raghav
export PATH=$PATH:~/raghav/bin
# For custom libraries
#export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/raghav/lib
#export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/raghav/lib64
alias sdesk="echo 'SSH to desk -'; ssh vrajagopalan@tsilinuxd98"
alias salex="echo 'SSH to alex -'; ssh vrajagopalan@tsilinuxd74"
# For quick jumping into directories
eval "$(fasd --init auto)"
# For ssh-tunnelling the ipython notebook
# (from telecom desktop to ssh.enst.fr)
# (to access from home)
# ===================================================================
# Link TSI servers's 9009 to tsilinuxd*:9009
alias jupytundesk="ssh -N -f -L localhost:9009:localhost:9009 vrajagopalan@tsilinuxd98"
# Link TSI servers's 9008 to localhost:9008
alias jupytunalex="ssh -N -f -L localhost:9008:localhost:9008 vrajagopalan@tsilinuxd74"
# Link My 9009 and Alex's 9008 to localhost
alias jupytunall='jupytundesk; jupytunalex;'
# Kill previous ssh tunnels and re-establish them
alias rejupytunall="pkill -f 'ssh -N'; jupytunall"
else
# LOCAL DESKTOP CONFS -----------------------------
xset r rate 213 200
alias o="xdg-open ."
export HOME2=~/raghav
export PATH=":/usr/lib/ccache/:$PATH:~/raghav/bin"
#export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/raghav/lib
#export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/raghav/lib64
# Use commands inside screens of tsilinud* machines to run the notebooks
alias jupydesk="cd ~/raghav/code/sklearn_dev_sandbox;jupyter notebook --no-browser --port=9009"
alias jupyalex="cd ~/raghav/code/sklearn_dev_sandbox;jupyter notebook --no-browser --port=9008"
# Add anaconda to path
export PATH=/ldaphome/vrajagopalan/miniconda3/bin:$PATH
source activate python35
# Autojump for easier navigation - https://github.com/clvv/fasd
eval "$(fasd --init auto)"
echo "The lib/binaries for desktop have been loaded"
# Recompile cython extenstions. Can be called from any directory
function isk {
if [ "$(pwd)" != $SCIKIT_LEARN_PATH ]
then
pushd "$SCIKIT_LEARN_PATH"
else
export IN_SKLEARN="true"
fi
~/raghav/anaconda/anaconda3/envs/python35/bin/python setup.py build_ext -i
if [ "$IN_SKLEARN" != "" ]
then
echo "Installation completed."
unset IN_SKLEARN
else
popd
fi
}
# Aliases for ls - typos
alias sl=ls
alias SL=ls
alias LS=ls
alias l=ls
# Aliases for ls + git status
alias lsg="ls;print;git status"
# Aliases for clear
alias c=clear
# Restart xfce panel
alias panelreset="dbus-send --print-reply --dest=org.xfce.Panel /org/xfce/Panel org.xfce.Panel.Terminate boolean:true"
# Some git shortcuts
alias gits="git status"
alias gitl="git log"
alias gitc="git commit -m "
alias gitpom="git pull origin master "
alias gitpr="git push -f ragvrv "
alias gcon='git grep ">>>>"'
# Git interactive rebase
function gi() {
git rebase -i "HEAD~$1"
}
# Directory navigation shortcuts
alias b="cd .."
alias b1="b"
alias b2="b;b;"
alias b3="b;b;b;"
alias bl="b;l;"
# Use htop sorted by MEM_RES
alias htop="htop --sort-key M_RESIDENT"
# Default nbtop to check at port 9009
alias nbtop="nbtop -u http://localhost:9009"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment