Skip to content

Instantly share code, notes, and snippets.

Jan van Haarst jvhaarst

  • Plant Research, Wageningen University and Research
  • Wageningen, Netherlands
View GitHub Profile
@jvhaarst
jvhaarst / solar graph.ipynb
Created Jan 9, 2018
Use pysolar to create a solar graph.
View solar graph.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jvhaarst
jvhaarst / Largest+contigs+clean.ipynb
Last active Jul 11, 2017
Create 500 FASTA sequences, by combining the shortest ones into a bigger ones that are smaller than the maximum size as given by 10x genomics
View Largest+contigs+clean.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jvhaarst
jvhaarst / m4a2mp3.bash
Created Nov 14, 2016
BASH 4 script to convert m4a files into mp3 files
View m4a2mp3.bash
#!/usr/local/bin/bash
# Error handling
set -o nounset
set -o errexit
set -o pipefail
# BASH 4 script to convert m4a files into mp3 files
# Needed programs : faad and lame
OIFS="$IFS"
IFS=$'\n'
@jvhaarst
jvhaarst / get_tree_size.py
Last active Feb 29, 2016
Simple script to print: human size of a directory tree, number of files in that tree, number of hard links in that tree, number of softlinks in that tree and number of directories.
View get_tree_size.py
#!/usr/bin/env python3
# Simple script to print:
# Size of a directory tree
# Number of files in that tree
# Number of hard links in that tree
# Number of softlinks in that tree
import os
import sys
import datetime
@jvhaarst
jvhaarst / ssh_alias.sh
Last active Jan 9, 2016
Script to create bash aliases for hostnames in ssh config and known_hosts files
View ssh_alias.sh
#!/bin/bash
# Script to create bash aliases for hostnames in ssh config and known_hosts files
# Original fom http://samrowe.com/wordpress/2008/07/29/bash-ssh-happiness/
# Updated by ja@vanhaarst.net
# Example usage:
# ALIAS_TEMP=$(mktemp);bash ssh_alias.sh | sort -r > $ALIAS_TEMP;source $ALIAS_TEMP;rm $ALIAS_TEMP;alias
set -o errexit # Exit on error
set -o nounset # Exit on use of unset variable
#set -o verbose # Prints shell input lines as they are read.
@jvhaarst
jvhaarst / gistmirror.sh
Last active Aug 29, 2015
Github mirror script, including organisation repos and gist mirror script.
View gistmirror.sh
#!/bin/bash
# Gist mirror script
# Jan van Haarst jan@vanhaarst.net
# 20150115
# Debug
#set -o xtrace
#set -o verbose
# Stop on error
View filehash.py
__author__ = 'danlmarmot'
"""
This Python script measures hash performance, and attempts to answer this question:
'Given a hash function and a block size for reading, which is the fastest hash function and block size?'
There's no warm up, there's no cache/memory/whatever filling, just a simple way to explore performance for
commonly used functions with the timeit library
"""
View gist:11378466
# bootstrap.yml
---
- hosts: newservers
vars:
- ubuntu_release: raring
- logwatch_email: <your email addy>
# crypted passwords, generated on a Linux box using:
# echo 'import crypt,getpass; print crypt.crypt(getpass.getpass(), "$6$YOURSALT")' | python -
- root_password: ''
View getinsertsize.py
#!/usr/bin/env python
'''
Automatically estimate insert size of the paired-end reads for a given SAM/BAM file.
Usage: getinsertsize.py <SAM file> or samtools view <BAM file> | getinsertsize.py -
Author: Wei Li
'''
from __future__ import print_function
import sys;
@jvhaarst
jvhaarst / sym2hard.py
Created Jan 21, 2014
Python script to convert symbolic links to hard links, if possible.
View sym2hard.py
#!/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)
You can’t perform that action at this time.