Skip to content

Instantly share code, notes, and snippets.

View bobvanderlinden's full-sized avatar

Bob van der Linden bobvanderlinden

  • The Netherlands
View GitHub Profile
@bobvanderlinden
bobvanderlinden / allpins.bbio
Last active August 29, 2015 14:15
A config-pin file that configures all available pins to GPIO output
overlay cape-universal
overlay cape-univ-emmc
overlay cape-univ-hdmi
P8.3 low
P8.4 low
P8.5 low
P8.6 low
P8.7 low
P8.8 low
P8.9 low
// This code illustrates the setup of a WebRTC call using WSP
// This code is only intended for illustration purposes
// It lacks details like exception and error handling
// In practice this code should run partly on the server and partly on the client.
// The WSP protocol must be used between the servers of the caller and the server of the callee
// For the communication between the server and the client any protocol could be used.
// If none has been established yet, ik makes sense of course to use the same WSP mechanism here as well.
// This sample code does not show this communication between the server and the client though
var invitation = {
@bobvanderlinden
bobvanderlinden / README.md
Created June 26, 2015 11:09
NixOS npm install experiment

Usage

nix-build -E 'with import <nixpkgs> { }; callPackage ./default.nix { }'
@bobvanderlinden
bobvanderlinden / setup.py
Last active August 29, 2015 14:27
machinetalk-protobuf setup.py
#!/usr/bin/env python
from distutils.core import setup
setup(name="machinetalk-protobuf",
version="1.0",
description="Protobuf Python modules for Machinetalk",
url="https://github.com/machinekit/machinetalk-protobuf",
# TODO: Get this into a named package (machinetalk_protobuf)
# so that the modules (like message_pb2) aren't installed as global modules.
@bobvanderlinden
bobvanderlinden / default.nix
Last active November 16, 2015 21:39
Nix file for building Machinekit (cmake version)
with import <nixpkgs> { };
#pkgs.clangStdenv.mkDerivation rec {
pkgs.stdenv.mkDerivation rec {
name = "machinekit";
src = ./.;
nativeBuildInputs = [
cmake
pkgconfig
];
@bobvanderlinden
bobvanderlinden / getdownloadurl.js
Created March 26, 2016 14:26
A PhantomJS script that gets a download url for the Windows 10 ISO from Microsoft.com
var system = require('system');
var edition = system.args[1] || 'windows10';
var language = system.args[2] || 'english';
var architecture = system.args[3] || '64';
var page = require('webpage').create();
/* Global helper functions */
@bobvanderlinden
bobvanderlinden / acme.nix
Created May 31, 2016 12:39
Test whether nginx runs when configured to use ACME
# Test whether `nginx` can start when configured to use `acme`.
import ./make-test.nix ({ pkgs, ... } : {
name = "acme";
meta = with pkgs.stdenv.lib.maintainers; {
maintainers = [ bobvanderlinden ];
};
nodes = {
server = { config, pkgs, ... }: {
services.nginx.enable = true;
@bobvanderlinden
bobvanderlinden / builder.sh
Created June 3, 2016 18:12
Nix and npm-shrinkwrap
source $stdenv/setup
# Place npm-shrinkwrap.json alongside package.json
ln -s $NPM_SHRINKWRAP ./npm-shrinkwrap.json
# Create fake package.json. This is not used by npm when npm-shrinkwrap.json is available, but npm does parse this as json
echo "{}" > package.json
# Create fake HOME directory for npm
export HOME=$PWD/home
@bobvanderlinden
bobvanderlinden / gist:106687d41c8ca315972362fbdc4c12b1
Created January 11, 2017 22:27
Specific nixUnstable package
nix.package = (import (pkgs.fetchFromGitHub {
owner = "nixos";
repo = "nixpkgs";
rev = "6da8b0d49de784c72a3411b86656fa62656ea98e";
sha256 = "0rmmq67apl28kyl0dspgb4yrc5cq8q9mdcqk4gigmyirji96k4nx";
}) {}).pkgs.nixUnstable;
@bobvanderlinden
bobvanderlinden / test.nix
Created January 16, 2017 15:56
VM definition to test nginx virtualHost.<name>.serverName
{ nixpkgs ? ./default.nix,
nixos ? ./nixos/release.nix,
system ? "x86_64-linux"
}:
{
vm = (import ./nixos/lib/eval-config.nix {
inherit system;
modules = [
{
services.nginx = {