Skip to content

Instantly share code, notes, and snippets.


Marcos Oliveira macoj

View GitHub Profile
macoj /
Last active Jun 5, 2020
Having a bold Fig. in figure caption in REVTex4-1

To have a Fig. 1. instead of Fig. 1. when using REVTex4-1, since caption does not work with this class.

\renewcommand*{\fnum@figure}{{\normalfont\bfseries \figurename~\thefigure}}


I’ve been using Mac OS X daily since 2001 when I purchased my Titanium PowerBook and I still can’t get used the home and end key behavior. If, like me, you want Home to send you to the start of the line and not to the top of the document then create a file called DefaultKeyBinding.dict in your ~/Library/KeyBindings folder (might need to create that folder too) with the following contents:

  "\UF729"  = moveToBeginningOfParagraph:; // home
  "\UF72B"  = moveToEndOfParagraph:; // end
  "$\UF729" = moveToBeginningOfParagraphAndModifySelection:; // shift-home
macoj /
Created Feb 24, 2019
scientific notation matplotlib
ax.ticklabel_format(style='sci', axis='y', scilimits=(0, 2))
macoj /
Created Feb 13, 2019
quick numpy array (n,) to (n,1)
np.arange(0, 10).reshape((-1, 1))
macoj /
Created Feb 9, 2019
pip with multiple python versions
$ python-3.6 -m pip install package
$ python-2.7 -m pip install package
macoj / space_cite.tex
Created Jan 27, 2019
cite with space
View space_cite.tex
macoj / plos_one
Created Dec 4, 2018
PLOS One - number of papers over the years
View plos_one
1,254 results for everything:research 2007
2,735 results for everything:research 2008
4,437 results for everything:research 2009
6,765 results for everything:research 2010. On crime: 9
13,858 results for everything:research 2011. On crime: 17
23,575 results for everything:research 2012. On crime: 36
31,719 results for everything:research 2013. On crime: 62
30,247 results for everything:research 2014. On crime: 64
28,348 results for everything:research 2015. On crime: 88
22,211 results for everything:research 2016. On crime: 75
macoj /
Created Oct 1, 2018
including type in csv file

Use a .csvt with the same file name, including just one line about each column:




macoj /
Created Sep 14, 2018
Filter some data based on some criteria with awk
cat data.dat | awk -F '|' -v bb0="$bb0" -v bb1="$bb1" -v bb2="$bb2" -v bb3="$bb3" '$2 > bb0 && $2 < bb1 && $3 > bb2 && $3 < bb3 {print $0}'
macoj /
Created May 21, 2018
setting which python to use with ipcluster
/usr/bin/python2.7 `which ipcluster` start -n 40
# or
/usr/bin/python3 `which ipcluster` start -n 40
You can’t perform that action at this time.