Skip to content

Instantly share code, notes, and snippets.

View jvhaarst's full-sized avatar

Jan van Haarst jvhaarst

  • FB-IT, Wageningen University and Research
  • Wageningen, Netherlands
View GitHub Profile
@jvhaarst
jvhaarst / sym2hard.py
Created January 21, 2014 12:20
Python script to convert symbolic links to hard links, if possible.
#!/usr/bin/env python
import os
import sys
import uuid
random_unique_name = str(uuid.uuid4()) + str(uuid.uuid1())
def find_mount_point(path): # http://stackoverflow.com/questions/4453602/how-to-find-the-mountpoint-a-file-resides-on
path = os.path.abspath(path)
@harith
harith / shellmarks.sh
Last active September 18, 2022 07:50
Utilities to let you easily reach frequently visited but deeply nested directories.
# Utilities for quickly accessing frequently used directories in bash.
# Usage:
# $ cd /path/to/project/src/
# $ mark code # Will create a new shortcut.
# # Becomes interactive if a shortcut already exists
# # m is an alias for mark. You can also `m code`
#
# $ code # From now on, running this anywhere in the shell
# # will put you in /path/to/project/src/code
@rgbkrk
rgbkrk / hubdecrypt.sh
Last active April 6, 2022 02:55
Encrypt a (short) file using someone's public key from github
#!/usr/bin/env bash
# HubCrypt
# ========
#
# Decrypt a file encrypted using hubencrypt (ok, it's just openssl + rsautl +
# your SSH keys). It needs the private key that matches your last public key
# listed at github.com/<user>.keys
#
@kgturner
kgturner / Minima.mer.func.R
Last active December 22, 2015 06:19
Find two minima around a peak, given data structured like an output kmer counting histogram table from jellyfish. Requires 'zoo' and 'ggplot2' packages. More information at http://alienplantation.wordpress.com/2013/09/04/nuts-and-bolts-finding-minima-around-a-peak-in-r/
#####Minima.mer.func.R#####
#Kathryn Turner June 21, 2013
#Given an output kmer counting histogram table from jellyfish,
#find two minima around a peak
#input table from jellyfish
dat <- read.table("data.from.jellyfish.hist", head=T)
head(dat)
frequency multiplicity
@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@jasonrudolph
jasonrudolph / about.md
Last active January 6, 2024 07:40
Programming Achievements: How to Level Up as a Developer
@faried
faried / maildirtocouch.py
Created February 1, 2011 22:02
Store messages in a Maildir into a couchdb database.
#!/usr/bin/env python
"""Store messages in a Maildir into a couchdb database."""
import couchdb
from mailbox import Maildir
from optparse import OptionParser
import os
from pprint import pprint
import sys
from uuid import uuid4
# OfflineIMAP config for GMail backup (only tested on OS X)
# Save it as ~/.offlineimaprc
# NB: this will sync *everything*, including All Mail, Spam, Bin, etc.
[general]
metadata = ~/.offlineimap
accounts = GMail
maxsyncaccounts = 1
# You might want to change the below to ui = TTY.TTYUI the first time you run offlineimap
# It can choke on large attachments and GMail might reset the connection if you download too much