Skip to content

Instantly share code, notes, and snippets.

View dvberkel's full-sized avatar
💭
Enjoying life, the universe and everything

Daan van Berkel dvberkel

💭
Enjoying life, the universe and everything
View GitHub Profile
@dvberkel
dvberkel / bertrands_corollary.magma
Created December 24, 2012 21:01
Magma code to tabulate a corollary to Bertrand's postulate
// return list of pairs of [1 .. 2*n] where every pair sums to a prime.
function prime_pairs(n)
if n eq 0 then
return [];
else
N := 2 * n;
p := NextPrime(N);
m := p - N;
result := [ <m + i, N - i> : i in [0 .. ((N - m) div 2)]];
return prime_pairs(m div 2) cat result;
@dvberkel
dvberkel / buttons_schematics.png
Last active December 10, 2015 01:48
A sumo wrestling inspired, arduino based, reflex test party game
buttons_schematics.png
@dvberkel
dvberkel / demo.js
Created November 23, 2012 07:54
WebSQL demonstration
"use strict";
(function(){
var db = openDatabase("demo", "1.0", "demonstration of webSQL", 2 * 1024 * 1024);
db.transaction(function(tx){
tx.executeSql("create table if not exists entries (timestamp, description, value)");
});
db.transaction(function(tx){
@dvberkel
dvberkel / contributions.md
Created November 16, 2012 11:25
Open Source Ideas

Contributions

I have the following ideas about contributing to an open source project.

  • hg [scm provider][3] for [Chef][2].
  • [peg][4] task for [grunt][5] is done. Go check out [grunt-peg][6].
  • [Chrome extension][7] to throw dice is done. Go check out [GURPS dice][8]
@dvberkel
dvberkel / links.md
Created November 14, 2012 09:33
Links for Datomic
@dvberkel
dvberkel / dabblet.css
Created October 22, 2012 19:03
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height: 100%;
font-size: 200%;
font-family: sans-serif;
@dvberkel
dvberkel / random.ps
Created October 15, 2012 04:47
Random nmber between 0 and 1
/rrand { rand 16#7FFFFFFF div } def
@dvberkel
dvberkel / RegisterDisplay.cpp
Created May 11, 2012 20:10
Arduino controlled 7-segment clock
/*
RegisterDisplay.cpp - Library for 74HC545 controlled 7-segment display
Created by Daan van Berkel, May 30, 2012.
Released into the public domain.
*/
#include "Arduino.h"
#include "RegisterDisplay.h"
RegisterDisplay::RegisterDisplay(int numberOfSegments, int clockPin, int latchPin, int dataPin) {
@dvberkel
dvberkel / Reflector.java
Created May 8, 2012 18:18
Enigma Code Kata
package nl.tdd.enigma;
import java.util.HashMap;
import java.util.Map;
public class Reflector {
private final Map<String, String> reflections = new HashMap<String, String>();
{
@dvberkel
dvberkel / install-android-sdk.sh
Created April 29, 2012 18:12
Bash script to automatically install and update the Android SDK
#! /usr/bin/env bash
# This script downloads the Android SDK.
# It depends on the following
#
# * curl
# * tar
BASE_DIR=`pwd`