Skip to content

Instantly share code, notes, and snippets.

View mhermans's full-sized avatar

Maarten Hermans mhermans

View GitHub Profile
@mhermans
mhermans / OpenCPU_mds.md
Created June 3, 2012 23:00
OpenCPU example

OpenCPU: pushing R for webbased, collaborative data analysis

Introduction

OpenCPU is the early stages PhD-project of Jeroen Ooms under supervision of Jan de Leeuw at the UCLA. Its buzzwordy tagline "Scientific computing in the cloud" captures it partially, but does not do it justice.

Most notable is that the entire architecture is truly open, not only the software level but also on the API and practical level. I.e. you can download the AGPL-licensed server as a Debian/Ubuntu-package and run your own instance. In addition to that, all interactions with the server take place through a cleanly designed REST-interface and you can execute all standard R-code, including your own.

This level of practical openness is very relevant, as a FOSS-licenced product can still generate a stale software ecosystem around it and practical lock-in due to specific protocols, customized commands, etc.

@mhermans
mhermans / rstudio_crash
Created July 19, 2012 14:55
Rstudio crash
library(sp)
library(plyr)
library(spdep)
library(igraph)
#load(url("http://www.filefactory.com/file/778ibc72fct3/n/BEL_adm3_RData"))
load(url("http://www.filefactory.com/file/4gkfr4n087l1/n/BEL_adm4_RData"))
area <- function(polygon) {
polygon[1]@area
* http://www.jstor.org/stable/10.1086/231292
* http://www.mhermans.net/blog/2010/12/freebase-bel20-directorates
* http://www.nbb.be/pub/03_00_00_00_00/03_02_00_00_00/03_02_01_00_00.htm?l=nl
* Neo4j, mongoDB
* http://www.mhermans.net/files/tmp/export/seadragon.html
#!/bin/bash
FROM=$1 #/cygdrive/c/temp/oldrepo
TO=$2 #/cygdrive/c/temp/newrepo
echo "Spliting '$TO' from '$FROM'"
git clone --no-hardlinks $FROM $TO
cd $TO
git filter-branch --subdirectory-filter $TO HEAD -- --all
git reset --hard
@mhermans
mhermans / pvr_poweron.py
Last active April 17, 2016 14:00
Script: write upcoming Tvheadend recording start dates to Synology power scheduler
#!/usr/bin/env python
import datetime, os, json
# Write upcoming Tvheadend recording start dates to Synology power scheduler
# i.e. turn on your Synology so Tvheadend can record.
# Usage: ./pvr_poweron.py > /etc/power_sched.conf (or use cron)
# location of Tvheadend PVR-schedule files:
PVR_DIR="/usr/local/tvheadend/var/dvr/log"
# Day-code constants for power scheduler Monday-Sunday:
@mhermans
mhermans / python_tricks
Created February 6, 2013 00:11
Notebook of Alexis Metaireau Python Tricks presentation
{
"metadata": {
"name": "Python Tricks"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@mhermans
mhermans / gist:4959057
Last active September 5, 2018 19:49
schema -> turtle, Edamam recipe
# Source: getschema.org/microdataextractor?url=http://www.edamam.com/recipe/twentieth-century-cocktail-d0ecdc3a25d659e50177c42b3a3bc150&out=n3
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix schema: <http://schema.org/>.
<_:gs0>
rdf:type <http://schema.org/Recipe>;
schema:name "Twentieth Century Cocktail";
schema:url <http://www.saveur.com/article/Recipes/Classic-20th-Century-Cocktail>;
@mhermans
mhermans / dwm-filter.js
Last active December 17, 2015 04:09
Greasemonkey script demonstrating hiding comments by user on dewereldmorgen.be
// ==UserScript==
// @name dwm-filter
// @include http://www.dewereldmorgen.be/artikels/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js
// @description example script demonstrating how to automagically hide DWM comments of certain users,
// ==/UserScript==
// select all comments based on author href attribute
var comments = $('a[href$="/people/mohamed-talhaoui"]');
@mhermans
mhermans / recorder.py
Created July 22, 2013 20:20
Recorder debugging voor jekke
#!/var/packages/python/target/bin/python
import cgitb, os, time, urllib2, datetime
cgitb.enable()
TIME_WAIT = 10 # neem aan dat dit seconden zijn?
STAT_FILE = "RECORDING"
class Recorder(object):
[mhermans@web314 ~]$ cat setvar.sh
#!/bin/bash
export CUSTOMVAR=test_env_var
[mhermans@web314 ~]$ cat readvar.py
#!/usr/bin/env python
import os
print os.environ['CUSTOMVAR']
[mhermans@web314 ~]$ env | grep CUSTOMVAR
[mhermans@web314 ~]$ source setvar.sh
[mhermans@web314 ~]$ env | grep CUSTOMVAR