Tuesday 9 July 2013

Vim sudo write

" Allow saving of files as sudo when I forgot to start vim using sudo.
cmap w!! w !sudo tee > /dev/null %

Tuesday 12 February 2013

Javascript, clone array


   

Jiggery pokery to copy the data, useful, but not here
    http://stackoverflow.com/questions/3865139/cast-javascript-object-to-array-how-to#answer-3865808
   
    var d = $.extend(true,{},arrel);
    d.length = arrel.length;
    var dd = Array.prototype.slice.call(d);

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