Skip to content

Instantly share code, notes, and snippets.

View thelahunginjeet's full-sized avatar

Kevin Brown thelahunginjeet

View GitHub Profile
@thelahunginjeet
thelahunginjeet / python_job.sh
Last active August 29, 2015 13:57
LSF example of a serial python job, with a virtual environment
#!/bin/bash
#
#BSUB -o pyjob.%J.out
#BSUB -e pyjob.%J.err
#BSUB -n 1
# do stuff
source ~/venv/bin/activate
python -c "import pyica; import sys; print(sys.version); from numpy.random import randn; x = randn(); print '%f' %x"
@thelahunginjeet
thelahunginjeet / python_array_job.sh
Last active August 29, 2015 13:57
LSF array job with python
#!/bin/bash
#BSUB -L /bin/bash
#BSUB -J paj[1-10]
#BSUB -e paj.%I.err
#BSUB -o paj.%I.out
#BSUB -n 1
python -c "import sys; print(sys.version); import pyica; from numpy.random import randn; print '%f' % randn()"
# comments:
@thelahunginjeet
thelahunginjeet / scattertext.m
Created January 31, 2014 16:42
simple example of labeling plotted points with text
% also works with scatter
% may need to play around with axis labels and text positioning to get it to look nice
data = rand(10,2);
plot(data(:,1),data(:,2),'ko','MarkerFaceColor','k');
labels = num2str((1:size(data,1))','%d');
text(data(:,1),data(:,2),labels,'horizontal','left','vertical','bottom');
@thelahunginjeet
thelahunginjeet / startup.m
Created November 8, 2013 21:09
MATLAB startup.m file commands to get nicer looking plots by default
% font sizes
set(0,'DefaultAxesFontSize',18)
set(0,'DefaultTextFontSize',18)
% line widths
set(0,'DefaultAxesLineWidth',2);
set(0,'DefaultLineLineWidth',2);
@thelahunginjeet
thelahunginjeet / latex-chem-reactions
Last active December 27, 2015 19:29
useful latex commands for chemical reactions
\usepackage{amsmath}
% ensures non-italicized chemical species name
\newcommand{\ch}[1]{\mathrm{#1}}
% adds brackets to indicate concentrations
\newcommand{\conc}[1]{[\mathrm{#1}]}
% single right reaction arrow, with rate argument on top
\newcommand{\react}[1]{\stackrel{#1}{\rightarrow}}
% double left/right reaction arrow decorated above/below with rates
\newcommand{\doublereact}[2]{\mathrel{\substack{#1\\\rightleftharpoons\\#2}}}
@thelahunginjeet
thelahunginjeet / vim-spaces-to-tabs
Created November 8, 2013 20:46
spaces to tabs in vim (useful for fixing python indentation issues)
:%s/<space><space><space><space>/<tab>/g