Skip to content

Instantly share code, notes, and snippets.

View spllr's full-sized avatar

Klaas Speller spllr

View GitHub Profile
@spllr
spllr / privacy_preserving_contact_tracing_test.rb
Last active April 20, 2020 07:22
Demo implementation of "Privacy-Preserving Contact Tracing" introduced by Apple and Google during the COVID‑19 pandemic.
#!/usr/bin/env ruby
# Usage: privacy_preserving_contact_tracing_test.rb [options]
#
# Specific options:
# -K, --tracing-key=TRACING_KEY Tracing key, 32 bytes, HEX encoded
# -DDAILY_TRACING_KEY, Daily tracing key, 16 bytes, HEX encoded
# --daily-tracing-key When provided TRACING_KEY is ignored
# -t, --time=TIME Date and/ or time to use start
# -d, --days=NUM_DAYS Number of days to generate identifiers for
@spllr
spllr / feistel_cipher_test.c
Last active February 21, 2020 22:18
Feistel Cipher test implementation inspired by the "Feistel Cipher - Computerphile" Youtube video
/**
* build:
* gcc feistel_cipher_test.c -o feistel_cipher_test
*
* run:
* ./feistel_cipher_test
*
* Feistel Cipher test implementation inspired by the "Feistel Cipher - Computerphile"
* Youtube video: https://youtu.be/FGhj3CGxl8I
*
@spllr
spllr / simple-tic-tac-toe.swift
Last active November 12, 2017 15:18
A simple game of Tic Tac Toe in swift
// Playground by @spllr. Use as you like.
import Foundation
/// A Game of Tic Tac Toe
public struct Game: CustomStringConvertible, Codable
{
/// Game Errors
///
/// - gameFinished: The game has finished and no plays are possible
@spllr
spllr / cloudkit-request.js
Last active August 28, 2023 12:04
Setting up an authenticated CloudKit server-to-server request
/**
* Demonstrates how to use Apple's CloudKit server-to-server authentication
*
* Create private key with: `openssl ecparam -name prime256v1 -genkey -noout -out eckey.pem`
* Generate the public key to register at the CloudKit dashboard: `openssl ec -in eckey.pem -pubout`
*
* @see https://developer.apple.com/library/prerelease/ios/documentation/DataManagement/Conceptual/CloutKitWebServicesReference/SettingUpWebServices/SettingUpWebServices.html#//apple_ref/doc/uid/TP40015240-CH24-SW6
*
* @author @spllr
*/
@spllr
spllr / String+Hex.swift
Created June 13, 2014 13:57
Convert a hex string to SKColor
import UIKit
import SpriteKit
extension String {
func hexComponents() -> String?[] {
let code = self
let offset = code.hasPrefix("#") ? 1 : 0
let start: String.Index = code.startIndex
return [
@spllr
spllr / appsterdam-hq.geojson
Last active December 21, 2015 03:09
Location of Appsterdam HQ
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@spllr
spllr / Appsterdam.geojson
Created August 13, 2013 09:41
The City Of Appsterdam
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@spllr
spllr / innoviz_resource.rb
Created October 26, 2012 17:40
InnoViz SF Database mapper
#!/usr/bin/env ruby -wKU
##
# Runtime options
#
require "optparse"
options = { :spec => false }
ARGV.options do |opts|
@spllr
spllr / padrino-sprockets.rb
Created October 15, 2012 10:14
Padrino Sprockets Plugin
module SprocketsInitializer
def self.registered(app)
require "sprockets"
app.controllers :assets do
helpers do
def sprockets_env
return @sprockets_environment if @sprockets_environment
@sprockets_environment = Sprockets::Environment.new(Padrino.root)
@sprockets_environment.append_path 'app/assets/javascripts'
@sprockets_environment.append_path 'app/assets/stylesheets'
@spllr
spllr / bmf_dialog
Created September 27, 2012 10:07
bmf_dialog
#!/usr/bin/env ruby
#
# Usage:
# make_story dialog_text_file.txt [output.plist]
#
# Make sure you install the plist gem:
# [sudo] gem install plist
#
require "parser"