Skip to content

Instantly share code, notes, and snippets.

@vbajpai
vbajpai / gist:489f7428d4063189b7bd
Last active November 3, 2015 10:09
[el capitan]: create a spanned time capsule
% diskutil list
% diskutil cs create BACKUP disk2s2 disk3s2
% diskutil cs list
% diskutil cs createVolume 90052D5A-340B-43CF-8A93-BD02C2E041DF jhfs+ Time\ Capsule 100%
Reference: http://www.macissues.com/2014/04/10/how-to-make-a-custom-fusion-drive-in-os-x
@vbajpai
vbajpai / basemap-debian
Last active February 20, 2016 10:47
Install basemap on Debian
$ sudo apt-get install libgeos-dev
$ sudo ln -s /usr/lib/libgeos-3.4.2.so /usr/lib/libgeos.so
$ pip install basemap --allow-external basemap --allow-unverified basemap
@vbajpai
vbajpai / gist:3fb5b2db77022ebf1715
Created June 5, 2015 17:39
use truetype fonts with matplotlib (instead of type1)
pdf.fonttype : 42
ps.fonttype : 42
@vbajpai
vbajpai / gist:55091f8a066717bce9c4
Last active August 29, 2015 14:11
OpenWrt Routed AP configuration
OpenWrt:/etc/config$ cat network
...
config interface 'lan'
option ifname 'eth0'
option type 'bridge'
option proto 'dhcp'
config interface 'wwan'
option proto 'static'
@vbajpai
vbajpai / gist:9515165
Last active August 29, 2015 13:57
virtualenv using python3
% virtualenv -p /usr/bin/python3 $HOME/.virtualenv/py3env
% source $HOME/.virtualenv/py3env/bin/activate
% pip freeze
@vbajpai
vbajpai / gist:6992383
Created October 15, 2013 14:27
install a previous version of a software using homebrew
$ brew versions json-c
0.11 git checkout eeb3d65 Library/Formula/json-c.rb
0.10 git checkout 438d334 Library/Formula/json-c.rb
0.9 git checkout 7955181 Library/Formula/json-c.rb
$ git checkout 438d334 /usr/local/Library/Formula/json-c.rb
$ brew install json-c
@vbajpai
vbajpai / gist:6638603
Created September 20, 2013 14:42
safely copy a sqlite3 database
$ sqlite3 $DATABASE
sqlite> begin immediate;
<press CTRL+Z>
$ scp $DATABASE $REMOTE
$ exit
sqlite> rollback;
@vbajpai
vbajpai / latex-diff
Last active April 17, 2021 18:02
latex diff old with new
Create a diff of the new PDF to the old PDF. This flattens the LaTeX structure before diff'ng the contents.
$ latexdiff --flatten old.tex new.tex > diff.tex
$ latexmk -pvc -f -pdf -quiet diff.tex
Environments can also be ignored using the config command
$ latexdiff --config="PICTUREENV=(?:picture|DIFnomarkup|figure|lstlisting)[\w\d*@]*” \
--flatten old.tex new.tex > diff.tex
$ latexmk -pvc -f -pdf -quiet diff.tex
@vbajpai
vbajpai / gist:5395304
Created April 16, 2013 11:44
merge two plots into one a4 sheet
merge two plots into one A4 sheet for easy comparison:
$ convert -append $first.png $second.png $result.png
@vbajpai
vbajpai / timestamp-to-human
Created March 31, 2013 15:30
convert a unix timestamp to human readable format.
$ python -c "import time; print time.ctime(int(1363136889))"
Wed Mar 13 02:08:09 2013