Tuesday, 6 November 2012

Remove lines from file 1 that are in fiel 2




grep -v -x -f f2 f1 should do the trick.

With some explanations:

-v for select non-matching lines
-x for matching whole lines only
-f f2 to get patterns from f2.

sgrep like a player

Used to remove nodes with a given colour from a SVG file

 sgrep -i 'inner("<"..">") not containing ("#00ffff" or "#ff00ff" or "#ff0000")' < survey_plain.svg > survey_really_plain.svg

Friday, 26 October 2012

Create favico using GIMP

Take image,
make sure Image > Mode RGB is selected.

Scale to 32x32

Save as GIF (indexed using default settings)

Save a copy as Microsoft Windows Icon and choose bpp. 4 Worked nicely last time.

Wednesday, 23 May 2012

Stop VIM scrolling two viewports simultaneously:
:set scb!

Keyword:scrollbind

Wednesday, 9 May 2012

Python Adventures Part 1

Add path using shell variable PYTHONPATH
then load module of your file (i.e. survey.py)

Must reload this everytime a change is made using reload(survey). Ugh.
To fix this, go to ipython and 
import ipy_autoreload. 
Then run 
%autoreload 2

 (other behaviours given by %autoreload ?)

To read csv, import numpy and then use function recfromscv

to get help with functions, import the module and type help(module.function)

To automatically make all things in a module accessible just do 
from module import *


Wednesday, 15 February 2012

Bash no clobber

either set noclobber to 0 or just use >| instead of >

Thursday, 19 January 2012

Remove Encryption from PDF

for i in *.pdf; do gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=${i%%.*}_unen.pdf -c .setpdfwrite -f $i; done;