My .bash_alises

# remove things to trash
alias rm="trash-rm"

# init ipython with pylab support
#alias myipython="ipython --pylab --pdb"
alias myipython="ipython3 --pylab --matplotlib --pdb"

# record from mic 
alias record="rec -c 1 -e signed-integer -b 16 -r 48000"

# download a website
function dwsite {

    if [ "$#" -ne 2  ]; then
        echo "usage dwsite domains site, (eg dwsite http://math-atlas.sourceforge.net http://math-atlas.sourceforge.net/index)"
    else
        wget --recursive --no-clobber --page-requisites --html-extension --convert-links --domains $1 --no-parent $2
    fi
}

# debug a program using valgrind (memory leaks)
function myvalgrind {
    valgrind --tool=memcheck --leak-check=full -v --show-leak-kinds=all "$1"
}

# show windows scroll (ubuntu)
function showscroll {
    gsettings set com.canonical.desktop.interface scrollbar-mode normal
}

# hide windows scroll (ubuntu)
function hidescroll {
    gsettings reset com.canonical.desktop.interface scrollbar-mode
}

# compile a .tex file for Plos journal
# usage plos file.tex
function plos {
    basename=$(echo "$1" | cut -d . -f 1)
    echo "$basename"
    latex "$basename.tex"
    bibtex "$basename.aux"
    latex "$basename.tex"
    latex "$basename.tex"
    dvipdf "$basename.dvi"    
}

# remove aux files
function clean {
    rm *.aux
    rm *.bbl
    rm *.blg
    rm *.log
    rm *.out 
    rm *.synctex.gz
}

# compile a .tex
# usage mylatex file.tex
function mylatex {
    
    basename=$(echo $1 | cut -d . -f 1)

    pdflatex -shell-escape "$basename.tex" 
    bibtex "$basename.aux"
    pdflatex -shell-escape "$basename.tex"
    pdflatex -shell-escape "$basename.tex"
    
    #clean
}

Some links for python

Matplotlib

  • Accessing to individual axes [1], [2]
  • ax1 = plt.subplot(211)
    plt.plot(t, x)
    plt.subplot(212, sharex=ax1)

  • Get site packages path [1]
  • import site
    In [2]: site.USER_SITE
    Out[2]: '/home/auraham/.local/lib/python3.4/site-packages'
    In [3]: site.USER_BASE
    Out[3]: '/home/auraham/.local'
    In [4]: site.getsitepackages()
    Out[4]:
    ['/usr/local/lib/python3.4/dist-packages',
    '/usr/lib/python3/dist-packages',
    '/usr/lib/python3.4/dist-packages',
    '/usr/lib/dist-python']