Skip to content

Instantly share code, notes, and snippets.

Marcos Oliveira macoj

Block or report user

Report or block macoj

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View mac_home_key.md

From https://damieng.com/blog/2015/04/24/make-home-end-keys-behave-like-windows-on-mac-os-x:

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
macoj / scientific_notation.py
Created Feb 24, 2019
scientific notation matplotlib
View scientific_notation.py
ax.yaxis.set_major_formatter(ScalarFormatter(useMathText=True))
ax.ticklabel_format(style='sci', axis='y', scilimits=(0, 2))
@macoj
macoj / n_1.py
Created Feb 13, 2019
quick numpy array (n,) to (n,1)
View n_1.py
np.arange(0, 10).reshape((-1, 1))
@macoj
macoj / pip.sh
Created Feb 9, 2019
pip with multiple python versions
View pip.sh
$ python-3.6 -m pip install package
$ python-2.7 -m pip install package
@macoj
macoj / space_cite.tex
Created Jan 27, 2019
cite with space
View space_cite.tex
\let\Oldcite\cite
\renewcommand{\cite}[1]{~\Oldcite{#1}}
@macoj
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
macoj / csvt.md
Created Oct 1, 2018
including type in csv file
View csvt.md

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

"Integer","Real","String"

or

"Integer(6)","Real(5.5)","String(22)"

www.gdal.org/ogr/drv_csv.html

@macoj
macoj / filter.sh
Created Sep 14, 2018
Filter some data based on some criteria with awk
View filter.sh
#!/bin/bash
bb0=$1
bb1=$2
bb2=$3
bb3=$4
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
macoj / ipcluster.sh
Created May 21, 2018
setting which python to use with ipcluster
View ipcluster.sh
/usr/bin/python2.7 `which ipcluster` start -n 40
# or
/usr/bin/python3 `which ipcluster` start -n 40
@macoj
macoj / git_submodules.sh
Created May 21, 2018
git clone with the submodules
View git_submodules.sh
$ git clone --recurse-submodules https://github.com/macoj/rep
You can’t perform that action at this time.