Friday, August 28, 2009

Monday, August 24, 2009

Remove any linefeed from line which did not end in capital or special character (vim)

Remove any linefeed from line which did not end in capital or one of ./?<>:'

Like so:

%s/\([^./?<>":'A-Z]\)\n/\1/g

Wednesday, August 19, 2009

Twitter botnet/remote access

Be the envy of your friends! Remote control your PC via twitter! Add the following code to cron to send all tweets with CMD in them to the shell.

curl twitter.com/new299 | html2text | grep "CMD" | awk '{$1="";$0=substr($0,2)}1' | sh

Simulate dataset with samtools, align with Bowtie, BWA, MAQ and pileup

This post has moved here

Wednesday, August 12, 2009

Reset author to filename on a bunch of pdf files

This script will reset the author to metadata on all files in the current directory to be the same as the filename of the file. It will write new files to a sub directory (which should already exist) called fixed.

Quick hacky script to so that papers are index more sensibility on my Sony Reader.

for i in *.pdf
do
echo $i
echo "InfoKey: Author" > data.txt
echo "InfoValue: " $i >> data.txt
cat data.txt
pdftk ./$i update_info data.txt output ./fixed/$i
done

Thursday, August 6, 2009

Wednesday, August 5, 2009

Running samtools pileup on some aligned reads

samtools needs a sorted file for pileup.. doesn't give you an error if it isn't sorted so watch out!

./samtools faidx phi.fa
./samtools import ./phi.fa.fai /scratch/nava/lane7.phi.sam /scratch/nava/lane7.phi.bam
./samtools sort /scratch/nava/lane7.phi.bam /scratch/nava/lane7.phi.bam.sort
./samtools pileup -f ./phi.fa /scratch/nava/lane7.phi.bam.sort.bam > pile

vim/vi inverted replace

Replace any character that isn't the ^ character with nothing:

%s/[^^]//g

Saturday, August 1, 2009

n810 g++ installation (os 2008.1 diablo)

Install the following repositories by editing /etc/apt/sources.list.d/hildon-application-manager.list

add the following:

deb http://repository.maemo.org/ diablo sdk/free sdk/non-free tools/free tools/non-free
deb http://repository.maemo.org/extras/ diablo free non-free
deb http://repository.maemo.org/extras-devel/ diablo free non-free

apt-get update
apt-get install g++

done