Skip to content

Instantly share code, notes, and snippets.

Coding away...

Sander Tolsma stolsma

Coding away...
View GitHub Profile
View 1 Instructions for compiling node0.8.8 with

These instructions work for the Raspberry Pi running Raspbian (hard float) and create a hardware optimized version of NodeJS for the Raspberry PI, (and include a working install and NPM!!!):

  1. Install Raspbian -

  2. Install the necessary dependecies:

sudo apt-get install git-core build-essential

(If you just installed git then you need to administer your git identity first, else adding the patches below will fail!!!)

stolsma /
Last active Jan 16, 2020 — forked from ubergesundheit/
systemd traefik.service

systemd Service Unit for Traefik

Adapted from the forked gist and this blog. Adjusted to our own implementation.

The provided file should work with systemd version 219 or later. It might work with earlier versions. The easiest way to check your systemd version is to run systemctl --version.


stolsma /
Last active Oct 24, 2018
Centos repo files for installing KVM, docker, kubernetes, Helm and Tiller

Installing KVM, libvirt, Docker-CE and Kubernetes on Centos 7.x

First of all be root while doing this... sudo su

Set hostname

Set the hostname:

hostnamectl set-hostname 'k8s-master'

stolsma / consul.service
Created Jul 24, 2017 — forked from rossedman/consul.service
Consul Installation
View consul.service
# This needs to be installed here:
# /etc/systemd/system/consul.service
stolsma /
Last active Oct 11, 2015
Compile and install receipe for ubuntu

Install first for ubuntu:

sudo apt-get install build-essential libssl-dev curl git-core

Compile the required node version and put in global reach:

# install nodejs from Github (replace 0.8.9 with required version)
git clone git:// node0.8.9
stolsma / test.js
Created Aug 25, 2012
Lower worker privilege with cluster or fork when run as root and still able to use unprivilaged ports
View test.js
var cluster = require('cluster');
var util = require('util');
var http = require('http');
var numCPUs = 2; //require('os').cpus().length;
// general functions
function isRoot() {
return process.getuid() == 0;
stolsma / getPeerCertificate.js
Created Oct 1, 2011
getPeerCertificate example
View getPeerCertificate.js
var https = require('https'),
fs = require('fs');
var options = {
key: fs.readFileSync('./ssl/privatekey.pem'),
cert: fs.readFileSync('./ssl/certificate.pem'),
requestCert: true
https.createServer(options, function (req, res) {
stolsma /
Created Sep 27, 2011 — forked from jamiew/
Put this in your ~/.bash_profile or ~/.bashrc file. Then type source ~/.bashrc or source ~/.bash_profile to reload.
parse_git_branch() {
ref=$(git symbolic-ref -q HEAD 2> /dev/null) || return
printf "${1:-(%s)}" "${ref#refs/heads/}"
pimp_prompt() {
local BLUE="\[\033[0;34m\]"
local BLUE_BOLD="\[\033[1;34m\]"
local RED="\[\033[0;31m\]"
local LIGHT_RED="\[\033[1;31m\]"
stolsma /
Created Sep 26, 2011
Why only IPv6 will also listen for IPv4 on most Linux systems...

The best approach is to create an IPv6 server socket that can also accept IPv4 connections. To do so, create a regular IPv6 socket, turn off the socket option IPV6_V6ONLY, bind it to the "any" address, and start receiving. IPv4 addresses will be presented as IPv6 addresses, in the IPv4-mapped format.

The major difference across systems is whether IPV6_V6ONLY is a) available, and b) turned on or off by default. It is turned off by default on Linux (i.e. allowing dual-stack sockets without setsockopt), and is turned on on most other systems.

In addition, the IPv6 stack on Windows XP doesn't support that option. In these cases, you will need to create two separate server sockets, and place them into select or into multiple threads.

Found on:

stolsma / clone.js
Created Sep 25, 2011 — forked from polotek/clone.js
Real, deep copied objects.
View clone.js
function hasOwnProperty(key) {
if(this[key]) {
var proto = this.prototype;
if(proto) {
return ((key in this.prototype) && (this[key] === this.prototype[key]));
return true;
} else {
return false;
You can’t perform that action at this time.