Skip to content

Instantly share code, notes, and snippets.

View blahah's full-sized avatar

Rik blahah

View GitHub Profile
@blahah
blahah / terminal_colours.sh
Created February 9, 2014 11:45
set nice colours for terminal
# bash colours
export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced
# define colors
C_DEFAULT="\[\033[m\]"
C_WHITE="\[\033[1m\]"
C_BLACK="\[\033[30m\]"
C_RED="\[\033[31m\]"
C_GREEN="\[\033[32m\]"
@blahah
blahah / open-fellowships.md
Last active August 29, 2015 13:56
Fellowships and funding for best practise and openness

Open science & data

Scientific software best practise

@blahah
blahah / devtools.r
Last active August 29, 2015 13:56 — forked from hadley/devtools.r
if ("devtools" %in% loadedNamespaces()) {
stop("You must restart R before installing devtools")
}
url <- "https://github.com/hadley/devtools/archive/v1.4.1.zip"
temp <- file.path(tempdir(), "devtools.zip")
setInternet2(TRUE)
suppressWarnings(download.file(url, temp, mode = "wb"))
install.packages(temp, repos = NULL)
@blahah
blahah / gene_counts.R
Created April 7, 2014 13:21
extract gene counts from transcript ID/count
# convert transcript ID to gene ID
df <- data.frame(a = c("AT1G2.1", "AT1G2.3", "AT1G2.3", "AT1G3.1", "AT1G3.3", "AT1G3.3"), b=1:6)
df$t <- gsub(df$a, pattern="\\.[0-9]+", replacement="")
# sum by gene ID
aggregate(df[,2], by=list(as.factor(df$t)), sum)
@blahah
blahah / seqahead_software.md
Last active August 29, 2015 13:59
TGAC SeqAhead software requirements
@blahah
blahah / osm_badger.rb
Created April 22, 2014 00:57
OpenSourceMalaria - add OSM badge to Twitter profile image
#! /udr/bin/env ruby
require 'twitter'
require 'rmagick'
require 'open-uri'
# set up the twitter client
client = Twitter::REST::Client.new do |config|
config.consumer_key = # redacted
config.consumer_secret = # redacted
@blahah
blahah / test_subsample.rb
Created April 22, 2014 11:18
With warnings off
#!/usr/bin/env ruby
require 'bio'
require 'inline'
require 'benchmark'
require 'trollop'
class TestC
@blahah
blahah / rubocop.yml
Created April 24, 2014 12:15
HibberdLab RuboCop styleguide enforcement config
# This is the default configuration file. Enabling and disabling is configured
# in separate files. This file adds all other parameters apart from Enabled.
inherit_from:
- enabled.yml
- disabled.yml
# Common configuration.
AllCops:
# Include gemspec and Rakefile
@blahah
blahah / combinator.rb
Created April 25, 2014 16:19
Recursive, on-demand yielding, lazy parameter sweep generator
class Combinator
include Enumerable
def initialize parameters
@parameters = parameters
end
def generate_combinations(index, opts, &block)
if index == @parameters.length
@blahah
blahah / journal_scrape.js
Created May 9, 2014 09:29
Baisc proof of principle: scraping academic sites by emulated browsing in Node.js with Phantom, Casper, Spooky and JSDom
#! /usr/bin/exec node
var Spooky = require('spooky');
var dom = require('jsdom').jsdom;
var xpath = require('jsdom-xpath');
// Set up the spooky agent to retrieve URLs
var spooky = new Spooky({
child: {
transport: 'http'