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 / grab_days.ini.example
Last active April 18, 2021 08:17 — forked from tvdsluijs/slimmemeterportal.nl.py
Small script to get your energy data from the slimmemeterportal.nl
[DEFAULT]
login = [YOUR LOGIN]
password = [YOUR PASSWORD]
START_URL = https://slimmemeterportal.nl/login
LOGIN_URL = https://slimmemeterportal.nl/user_session
DOWNLOAD = [LOCATION TO STORE THE FILES]
@jvhaarst
jvhaarst / analyse.ipynb
Last active February 5, 2020 23:09
solar panel scrape and plot
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jvhaarst
jvhaarst / eta.ipynb
Last active January 17, 2020 16:47
A couple of analyses on sacct output (ETA and CPU usage)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jvhaarst
jvhaarst / split_subreads2dir.py
Created May 8, 2019 12:48
Simple script to split PacBio BAM file into subread files.
import os
import sys
import gzip
filetype="txt"
for line in sys.stdin:
# {movieName}/{holeNumber}/{qStart}_{qEnd} according to https://pacbiofileformats.readthedocs.io/en/3.0/BAM.html
(movieName,holeNumber,subread)=(line.split()[0].split('/'))
directory = movieName+'/'+holeNumber[:3]
@jvhaarst
jvhaarst / solar graph.ipynb
Created January 9, 2018 07:48
Use pysolar to create a solar graph.
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 July 11, 2017 14:51
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
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 November 14, 2016 20:06
BASH 4 script to convert m4a files into mp3 files
#!/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 April 6, 2022 02:55
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.
#!/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 April 6, 2022 02:55
Script to create bash aliases for hostnames in ssh config and known_hosts files
#!/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 October 9, 2022 09:32
Github mirror script, including organisation repos and gist mirror script.
#!/bin/bash
# Gist mirror script
# Jan van Haarst jan@vanhaarst.net
# 20150115
# Debug
#set -o xtrace
#set -o verbose
# Stop on error