Skip to content

Instantly share code, notes, and snippets.

View marcora's full-sized avatar

Edoardo "Dado" Marcora marcora

View GitHub Profile
javascript:sel=document.getSelection();doi=/doi\s*:\s*(10\.\S+\/\S+)/i;pmid=/pmid\s*:\s*(\d+)(:?\s+|$)/i;fonek=/href="\/pubmed\/(\d+)"/i;html=document.body.innerHTML;txt=html.replace(/(<([^>]+)>)/ig,'%20');if(!sel){if(html.search(fonek)>=0&&document.location.href.search("www.f1000")>=0){sel=fonek.exec(html)[1];}else%20if(txt.search(pmid)>=0){sel=pmid.exec(txt)[1];}else%20if(txt.search(doi)>=0){sel=doi.exec(txt)[1];}else{sel=prompt('Enter%20DOI%20or%20PMID%20of%20article%20to%20fetch:','')}}if(sel)location.href='http://localhost:8888/fetch?id='+escape(sel)+'&url='+escape(document.location.href);void%200
@marcora
marcora / Snakefile
Created October 8, 2015 07:15
Snakefile template
DATASETS = ["D1", "D2", "D3"]
rule all:
input:
expand("{dataset}.sorted.txt", dataset=DATASETS)
rule sort:
input:
"path/to/{dataset}.txt"
output:
awk 'FNR==1 && NR!=1{next;}{print}' *.csv
## Reads data
S <- read.table(input,header=F)
if (stat_type == "Z")
z=S[,1]
if (stat_type == "CHISQ")
@marcora
marcora / gist:cb37b2432c072e8e9d77
Created September 15, 2015 03:24
Install Adobe Source Code Pro font on Linux
#!/bin/sh
echo "installing fonts at $PWD to ~/.fonts/"
mkdir -p ~/.fonts/adobe-fonts/source-code-pro
git clone https://github.com/adobe-fonts/source-code-pro.git ~/.fonts/adobe-fonts/source-code-pro
# find ~/.fonts/ -iname '*.ttf' -exec echo \{\} \;
fc-cache -f -v ~/.fonts/adobe-fonts/source-code-pro
echo "finished installing"