Skip to content

Instantly share code, notes, and snippets.

Martijn Vermaat martijnvermaat

Block or report user

Report or block martijnvermaat

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@martijnvermaat
martijnvermaat / monkey.py
Created Jul 27, 2011
Monkey patch for the Python SUDS library
View monkey.py
"""
Monkey patch: http://en.wikipedia.org/wiki/Monkey_patch
"""
def monkey_patch_suds():
"""
Apply our monkey patch for the suds package.
For some weird reason the location http://www.w3.org/2001/xml.xsd is used
@martijnvermaat
martijnvermaat / clean_directory.py
Created Aug 19, 2011
Clean a directory (e.g. cache) by removing rarely used files.
View clean_directory.py
#!/usr/bin/env python
"""
Clean a directory (e.g. cache) by removing rarely used files.
Usage:
./clean_directory directory [max_size]
The max_size argument is expected in megabytes. File removals are reported to
standard output and afterwards empty directories are (silently) removed.
@martijnvermaat
martijnvermaat / gpl-and-closed-software.markdown
Created Sep 7, 2011
The GPL in combination with closed source software
View gpl-and-closed-software.markdown

The GPL in combination with closed source software

Here are a few issues concerning GPL-licensed software in combination with closed source software. We assume [version 2 of the GPL] [1] in the following discussion.

What exactly is a work "derived from" the Program?

@martijnvermaat
martijnvermaat / try.py
Created Nov 23, 2011
Try something a predefined number of times
View try.py
#!/usr/bin/env python
"""
Example Python pattern: try something a number of times, and only really fail
after that.
"""
import sys
import time
@martijnvermaat
martijnvermaat / trim_common_suffix.py
Created Dec 28, 2011
Trim common suffix from sequences
View trim_common_suffix.py
def trim_common_suffix(sequences):
"""
Trim a list of sequences by removing the longest common suffix while
leaving all of them at least one character in length.
"""
@martijnvermaat
martijnvermaat / gist:1717830
Created Feb 1, 2012
GitHub mirror of the LOVD3 Subversion repository
View gist:1717830

This documents how to setup and maintain a GitHub mirror of the official LOVD3 Subversion repository. It is synchronized automatically with the LOVD3 Subversion repository every hour. The mirror only contains SNV trunk (Git master branch), so no branches or tags.

The Git repository was setup using the following commands:

mkdir LOVD3.git
cd LOVD3.git
git init
@martijnvermaat
martijnvermaat / variants_by_region.py
Created Feb 23, 2012
Get variants from our in-house database by region
View variants_by_region.py
#!/usr/bin/env python
"""
Get variants from our in-house database by region.
Query our in-house variant database for population study variants (e.g. GoNL
or 1KG) contained in the provided region(s) and show their respective
frequencies. The region(s) must be provided in a BED file [1].
[1] http://genome.ucsc.edu/FAQ/FAQformat.html#format1
@martijnvermaat
martijnvermaat / encrypted-root-debian-wheezy.markdown
Created May 18, 2012
Encrypted root filesystem on Debian Wheezy
View encrypted-root-debian-wheezy.markdown

Encrypted root filesystem on Debian Wheezy

This documents how to set up an encrypted root filesystem (except for /boot) on Debian Wheezy with automatic mounting using a keyfile on a USB drive.

Basic setup

In the Debian Installer, choose "Guided - use entire disk and set up encrypted LVM". That's it, on boot you will be asked to enter you passphrase using the keyboard. My system does not usually have a keyboard attached, so that's not very convenient (but read on).

@martijnvermaat
martijnvermaat / qmake-non-default-project.markdown
Created Sep 13, 2012
Set non-default project name for qmake jobs
View qmake-non-default-project.markdown

Set non-default project name for qmake jobs

This is a hack to run jobs on an SGE cluster using qmake under another project than your default project.

Most of the SGE job runners have the -P option. Unfortunately, as the manpage mentions, the option is not available for qmake:

-P project_name
       Available for qsub, qsh, qrsh, qlogin and qalter only.
       Specifies the project to which this job is assigned.
@martijnvermaat
martijnvermaat / README.md
Last active Oct 20, 2016
Download SRA run files for given sample names
View README.md

Download SRA run files for given sample names

Have all sample names in samples, one per line and run:

for sample in $(cat samples); do
    IFS=$'\n'
    for line in $(./sra-runs.py $sample); do
        echo $sample $line >> runs
    done
You can’t perform that action at this time.