Skip to content

Instantly share code, notes, and snippets.

@bougui505
bougui505 / replace_spaces.sh
Last active August 29, 2015 13:56
replace spaces in file name
find -name "* *" -type d | rename 's/ /_/g' # do the directories first
find -name "* *" -type f | rename 's/ /_/g'
@bougui505
bougui505 / findIncludegraphics.sh
Last active August 29, 2015 13:56
Finding graphics file names in tex file
egrep -o '\bincludegraphics([^}]*\})?' file.tex | egrep -o '\{.+\}' | sed 's/{\|}//g'
@bougui505
bougui505 / find_input.sh
Last active August 29, 2015 13:56
Finding input file names in tex file
egrep 'input{.*}' file.tex | grep -o '{.*}' | sed 's/{\|}//g'
@bougui505
bougui505 / git_diff.sh
Created February 25, 2014 10:11
git diff between a file (here SOM2.py) and a previous commit
git diff 14156a8430ebef7dfaf59d249dc1a5d864ebf71c -- SOM2.py
@bougui505
bougui505 / testtex.sh
Created February 25, 2014 13:44
Get header from tex file maintexfile and inlude tex file includefile and test the compilation with latexmk
#!/usr/bin/env sh
maintexfile=$1
includefile=$2
rootfilename=$(echo $includefile | cut -d. -f1)
(grep -B9999 'begin{document}' $maintexfile && echo " " && echo "\include{$rootfilename}" && echo "\\end{document}") > header.tex
latexmk -pdf -pvc header.tex
@bougui505
bougui505 / getTexHeader.sh
Last active August 29, 2015 13:56
Get Header from TeX/LaTeX file
#!/usr/bin/env sh
filename=$1
grep -B9999 'begin{document}' $filename && echo ' ' && echo '\end{document}'
@bougui505
bougui505 / .gitignore
Last active August 29, 2015 13:56
.gitignore for LaTeX directory
#To compile with:
# latexmk -outdir=outdir -pdf BOUVIER_Guillaume_dossier_MCF.tex
BOUVIER_Guillaume_audition_COMESP.pdf
outdir
.trash
*.swp
*.aux
*.bbl
*.blg
*.fdb_latexmk
@bougui505
bougui505 / gaussianMixture.py
Last active August 29, 2015 13:56
Fit mixture of Gaussian
from sklearn import mixture
%pylab
def fit_mixture(data, ncomp=2, doplot=False):
clf = mixture.GMM(n_components=ncomp, covariance_type='full')
clf.fit(data)
ml = clf.means_
wl = clf.weights_
cl = clf.covars_
ms = [m[0] for m in ml]
@bougui505
bougui505 / .zshrc
Created February 26, 2014 15:43
.zshrc for arcturus
# arcturus
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="kphoen"
eval $(dircolors ~/.dircolors) # dircolors -p > ~/.dircolors
@bougui505
bougui505 / .vimrc
Last active August 29, 2015 13:56
.vimrc for arcturus
" arcturus
" choose colorscheme according to vim version
syntax on
set t_Co=256
set gfn=DejaVu\ Sans\ Mono\ 11
"set gfn=DejaVu\ LGC\ Sans\ Mono\ 11
" No highlight search
set nohls
" No error bell
set noeb