csbio (biocs tumbled) RSS

a tumblelog to supplement my real blog

Things too long to tweet and too unimportant to blog go here.

Archive

Sep
30th
Wed
permalink
So often people are working hard at the wrong thing. Working on the right thing is probably more important than working hard.
Caterina Fake, also pointing to Watson & Crick who discovered the structure of the DNA not working 24/7.
Aug
6th
Thu
permalink

Handle non-UTF8 character in Perl

use Encode;
decode("utf8", $line, Encode::FB_HTMLCREF); 

Jun
30th
Tue
permalink
Genes do not respect disciplinary boundaries.
— Lawrence Hunter in his talk at ISMB/ECCB 2009. Some genes that have been studied in certain clinical areas might be relevant in other areas as well, e.g. relaxin I.
Apr
14th
Tue
permalink
You can predict the neural activity in your brain when you think about a word based on how that word is used on the web.
— Tom M. Mitchell in a most excellent Google Tech Talk: Brains, Meaning and Corpus Statistics.
Mar
5th
Thu
permalink

migrate to Django 1.0 with sed

Doesn’t cover everything, but works for me:

find -name '*py' | xargs sed -i -e 's/maxlength/max_length/' -e 's/FloatField/DecimalField/'

Jan
28th
Wed
permalink

Date regex for grep

(January|February|March|April|May|June|July|August|September|October|November|December) *([1-9]|[1-3][0-9]), *[12][0-9][0-9][0-9]|([1-9]|[1-3][0-9]) *(January|February|March|April|May|June|July|August|September|October|November|December) *[12][0-9][0-9][0-9]

This matches dates like:

12 October 1993
29 June 1982
31 March 2008
4 July 1980
April 21, 2008
February 12, 2007
March 31, 2008
May 27, 2002
November 16, 2006

Jan
26th
Mon
permalink
If you drive too fast (and go over a hill)…

If you drive too fast (and go over a hill)…

permalink
…you’ll end up in the roof of a church
[context]

…you’ll end up in the roof of a church

[context]

permalink

Test if file exists and is not empty (for Makefile)

In case some of your scripts in a Makefile silently fail (e.g. because they’re running on a cluster):

test -s file

(file exists, not empty)

Dec
9th
Tue
permalink

stripping HTML tags in Python

from BeautifulSoup import BeautifulSoup
''.join(BeautifulSoup(page).findAll(text=True))
source: Euan