Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
# Prevent a commit when no ticket reference is in the message.
# By hooking in just before an actual commit
# To install:
# cd path/to/repo/
# wget --no-clobber https://gist.githubusercontent.com/EmileSonneveld/787b8b51e55027cf848223bc30546dd8/raw -O .git/hooks/commit-msg && chmod +x .git/hooks/commit-msg
check=$(grep -E 'Merge (branch|remote-tracking branch|pull request|tag) ' "$1")
import json
import os
import datetime
import openeo
connection = openeo.connect("openeo.cloud").authenticate_oidc()
now = datetime.datetime.now()
print(connection.root_url + " time: " + str(now))
precipitation_dc = connection.load_collection(
@EmileSonneveld
EmileSonneveld / mediapipe_draw_collada_utils.py
Last active May 18, 2022 14:21
Takes mediapipe results and converts them to a collada file.
import collada
import numpy as np
class DrawCollada:
def __init__(self):
self.mesh = collada.Collada()
self.scene_nodes = []
self.counter = 0
@EmileSonneveld
EmileSonneveld / serialise-to-js.js
Last active February 23, 2021 09:42
no references in JSON
// This illustrates that serialising to JSON loses information.
var obj = {
ref1: {foo:"bar"},
}
obj.ref2 = obj.ref1
console.log(obj)
obj.ref2.foo = "changed"
console.log(obj) // both changed
obj2 = JSON.parse(JSON.stringify(obj))
@EmileSonneveld
EmileSonneveld / url-encode.rkt
Created August 1, 2018 13:29
url-encode implemented in scheme, r6rs. Behaves more-or-less the same as the JavaScript equivalent decodeURIComponent()
#!r6rs
(import (rnrs arithmetic bitwise (6))
(rnrs base (6))
(rnrs control)
(rnrs io simple (6))
)
; url-encode implemented in scheme, r6rs
; Behaves more-or-less the same as the JavaScript equivalent decodeURIComponent()
using System;
using System.Security;
using System.Security.AccessControl;
namespace GCAWeb.Utils
{
/// <span class="code-SummaryComment"><summary>
/// Configuring a Web site through a Web interface can be tricky.
@EmileSonneveld
EmileSonneveld / sound_hash.py
Last active March 4, 2020 17:47
Make a sound representation of the last commit hash
#!/usr/bin/python
# -*- coding: UTF-8 -*-
# python sound_hash.py c6951a1048d39d28610d491cb10f2b12d4169c02
import wave, base64, struct, random, sys, os, math;
import subprocess, re