Skip to content

Instantly share code, notes, and snippets.

View mdonkers's full-sized avatar

Miel Donkers mdonkers

View GitHub Profile
mdonkers / sed-replace-markdown-links
Created July 28, 2017 19:28
sed command to replace Markdown style links with HTML links, opening in separate tab
mdonkers /
Last active June 10, 2024 18:44
Simple Python 3 HTTP server for logging all GET and POST requests
#!/usr/bin/env python3
License: MIT License
Copyright (c) 2023 Miel Donkers
Very simple HTTP server in python for logging requests
./ [<port>]
from http.server import BaseHTTPRequestHandler, HTTPServer
mdonkers /
Created January 6, 2017 07:34
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
mdonkers /
Created July 21, 2016 11:28

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 March 2, 2016 20:17
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 January 8, 2016 13:34
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 November 11, 2015 22:28
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 January 5, 2014 16:45
AngularJS Directives - Using value in HTML attribute directly instead of needing to store on $scope.
myApp.directive('statsList', function () {
return {
restrict: 'E',
scope: {
items: '=listType',
orderBy: '@'
templateUrl: 'partials/partial1.html'
mdonkers / service.js
Created January 5, 2014 16:08
Extending one AngularJS service by another service, modifying input parameters and response.
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 December 17, 2015 20:29
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 '<'
object Application extends Controller {
def index(path: String) = Action {