Skip to content

Instantly share code, notes, and snippets.


Miel Donkers mdonkers

View GitHub Profile
mdonkers / sed-replace-markdown-links
Created Jul 28, 2017
sed command to replace Markdown style links with HTML links, opening in separate tab
View sed-replace-markdown-links
mdonkers /
Created Mar 29, 2017
Simple Python 3 HTTP server for logging all GET and POST requests
#!/usr/bin/env python3
Very simple HTTP server in python for logging requests
./ [<port>]
from http.server import BaseHTTPRequestHandler, HTTPServer
import logging
class S(BaseHTTPRequestHandler):
mdonkers /
Created Jan 6, 2017
Run as root user. Needs openconnect installed. Connect to Juniper / Pulse VPN automatically, parsing password from a GPG encrypted file so it doen't have to be entered manually. Note this will have security implications!
# encrypt (leave one empty line after password)
#gpg -e -a -r <user-id> your_password_file
set -e
# Must be a valid filename

Keybase proof

I hereby claim:

  • I am mdonkers on github.
  • I am mdonkers ( on keybase.
  • I have a public key whose fingerprint is 9AEF 5150 9C3C F6F5 5970 3C24 A957 88A1 2404 6A96

To claim this, I am signing this object:

mdonkers /
Last active Mar 2, 2016
Meteor setup for TypeScript and Angular 2


This document and related files show how a basic working setup for Meteor is created with TypeScript and Angular 2.

The following preconditions apply:

  • Meteor 1.2 installed
  • NodeJS installed (I used 5.7)


  1. Create a new Meteor project
  2. Install / remove the following packages for Meteor:
mdonkers /
Created Jan 8, 2016
Activates Python virtualenv. Use as "$ source <virtualenv_directory>". Will also update the prompt, to show which virtualenv environment is active, and reset the prompt when no longer active. Assumes command-prompt is already created with git-prompt;
## Call with 'source <env>'
function check_sourced {
local last_elem=${#FUNCNAME[@]}-1
if [[ "main" == ${FUNCNAME[$last_elem]} ]] ; then
echo "Being executed from a sub-shell, which won't set the environment correctly"
echo "Execute as 'source activate_environment <env>' or '. activate_environment <env>'"
mdonkers /
Created Nov 11, 2015
Extreme Startup Game implementation in Python, up and until round 3
from flask import Flask, session, redirect, url_for, escape, request
import math
import re
app = Flask(__name__)
def get_name(question): return "Miel"
mdonkers / directive.js
Created Jan 5, 2014
AngularJS Directives - Using value in HTML attribute directly instead of needing to store on $scope.
View directive.js
myApp.directive('statsList', function () {
return {
restrict: 'E',
scope: {
items: '=listType',
orderBy: '@'
templateUrl: 'partials/partial1.html'
mdonkers / service.js
Created Jan 5, 2014
Extending one AngularJS service by another service, modifying input parameters and response.
View service.js
myApp.factory('couchService', function (basicCouchService) {
return {
get: function(listType, response) {
// Convert the input parameters to the schema-names used inside CouchDB
var couchSchema = (listType.listType === 'latest') ? 'by_submit' : 'by_duration';
basicCouchService.get({listType: couchSchema}, function (localResponse) {
// Get the top-10, assume the array is already ordered wrong way around.
var rowList = localResponse.rows;
rowList = rowList.slice(rowList.length - 10, rowList.length);
localResponse.rows = rowList;
mdonkers / Application.scala
Last active Dec 17, 2015
Provided combination of 'routes' and Application does not seem to work. Problem loading Angular JavaScript, the commented line (fetching from googleapis) works, but the routes.Assets include does not work. Results in syntax error on '<'
View Application.scala
object Application extends Controller {
def index(path: String) = Action {