Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
HackHackHack...

Martin Asser Hansen maasha

💭
HackHackHack...
View GitHub Profile
View bleh.bash
# Function to assert no difference between
# two given files.
function assert_no_diff
{
local src=$1
local dst=$2
if [ ! -f $src ]; then
echo_red "FAIL"
log "FAIL"
@maasha
maasha / bp.rb
Created Aug 26, 2014
Example of sequence cleaning using Biopieces 2.0
View bp.rb
#!/usr/bin/env ruby
require 'biopieces'
p = BP.new.
read_fastq(input: "in1.fq", input2: "in2.fq").
clip_primer(primer: "GTGCCAGCMGCCGCGGTAA", direction: :forward, mismatch_percent: 20, search_distance: 50).
clip_primer(primer: "GGACTACHVGGGTWTCTAAT", direction: :forward, mismatch_percent: 20, search_distance: 100).
trim_primer(primer: "GTGCCAGCMGCCGCGGTAA", direction: :forward, mismatch_percent: 20, overlap_min: 1).
trim_primer(primer: "GGACTACHVGGGTWTCTAAT", direction: :forward, mismatch_percent: 20, overlap_min: 1).
@maasha
maasha / benchmark.rb
Last active Aug 29, 2015
Benchmark of Set vs Ruby Hash vs Google Dense Hash vs Google Sparse Hash
View benchmark.rb
#!/usr/bin/env ruby
require 'set'
require 'google_hash'
require 'benchmark'
set = Set.new
hash = Hash.new(0)
ghashd = GoogleHashDenseIntToInt.new
ghashs = GoogleHashSparseIntToInt.new
View authentication_pages_spec.rb
require 'spec_helper'
describe "AuthenticationPages" do
subject { page }
describe "authorization" do
describe "for non-signed-in users" do
let(:user) { FactoryGirl.create(:user) }
describe "when attempting to visit a protected page" do
View gist:4612174
#!/usr/bin/env ruby
class Cmd
def cat(file)
end
def grep(pattern)
end
end
@maasha
maasha / gist:4656341
Created Jan 28, 2013
QIIME 1.6 Installation notes.
View gist:4656341
QIIME-1.6.0 install
===================
Documentation: http://qiime.org/install/install.html
home = /home/maasha/
install = /home/maasha/install
prefix = /home/maasha/install/QIIME1.6/
source = /home/maasha/install/QIIME1.6/src/
bashrc = /home/maasha/install/QIIME1.6/bashrc
View gist:4657199
maasha@orsted:~$ print_qiime_config.py -t
System information
==================
Platform: linux2
Python version: 2.7.3 (default, Jan 28 2013, 09:50:08) [GCC 4.4.5]
Python executable: /disk/orsted/install/maasha/QIIME1.6/bin/python
Dependency versions
===================
View gist:4672102
maasha@mel:~$ mtr -r newton
HOST: mel.local Loss% Snt Last Avg Best Wrst StDev
1.|-- 10.52.32.1 0.0% 10 0.6 0.6 0.5 0.7 0.0
2.|-- 192.38.100.193 0.0% 10 2.6 2.3 1.1 4.8 1.1
3.|-- life3-26.net.ku.dk 0.0% 10 2.3 2.5 1.1 6.3 1.5
4.|-- adm3-28.net.ku.dk 0.0% 10 1.2 2.3 1.2 3.9 0.9
5.|-- kua3-15.net.ku.dk 0.0% 10 1.5 2.0 1.1 2.8 0.6
6.|-- 172.20.120.17 0.0% 10 1.7 1.8 1.3 4.3 0.9
7.|-- ??? 100.0 10 0.0 0.0 0.0 0.0 0.0
8.|-- ??? 100.0 10 0.0 0.0 0.0 0.0 0.0
View gist:4672174
maasha@mel:~$ ssh -vv newton date 2>&1 | perl -MTime::HiRes -ne 'use Time::HiRes; $s=Time::HiRes::time(); print "$s.$ms $_"'
1359540642.5785. OpenSSH_5.6p1, OpenSSL 0.9.8r 8 Feb 2011
1359540642.57853. debug1: Reading configuration data /Users/maasha/.ssh/config
1359540642.57854. debug1: Applying options for newton
1359540642.57854. debug1: Reading configuration data /etc/ssh_config
1359540642.57855. debug1: Applying options for *
1359540642.57855. debug2: ssh_connect: needpriv 0
1359540642.57856. debug1: Connecting to newton.binf.ku.dk [130.225.211.96] port 24222.
1359540642.57856. debug1: Connection established.
1359540642.57856. debug2: key_type_from_name: unknown key type '-----BEGIN'
View gist:4682930
#!/bin/bash
function run()
{
cmd=$1
if error=$($cmd); then
echo "OK"
else
echo "FAIL"