Skip to content

Instantly share code, notes, and snippets.

@michiel
michiel / example.sql
Created August 17, 2019 12:17 — forked from jcushman/example.sql
Store JSON history with the fast-json-patch library and Postgresql triggers
-- Enable pl/v8:
CREATE EXTENSION plv8;
-- Create json history table:
CREATE TABLE json_history (id BIGSERIAL PRIMARY KEY, tstamp timestamp DEFAULT now(), table_name text, column_name text, target_id bigint, transform json);
-- Create test table:
CREATE TABLE test_json (id BIGSERIAL PRIMARY KEY, data JSON);
-- Enable history tracking on test_json.data:
@michiel
michiel / generate.sh
Last active November 28, 2018 03:17
PlantUML kubernetes sprites
#!/bin/bash
git clone https://github.com/octo-technology/kubernetes-icons.git
cd kubernetes-icons/png
rm -rf tmp
rm *iuml
rm *uml
mkdir tmp
@michiel
michiel / clock.sh
Created June 6, 2018 05:47
terminal world clock
#!/bin/bash
function clock() {
clear
TZ=US/Pacific date "+LA : %Y/%m/%d %a — %I:%M %p"
TZ=US/Eastern date "+New York : %Y/%m/%d %a — %I:%M %p"
TZ=Europe/Amsterdam date "+Amsterdam : %Y/%m/%d %a — %I:%M %p"
TZ=Asia/Bangkok date "+Bangkok : %Y/%m/%d %a — %I:%M %p"
TZ=Japan date "+Tokyo : %Y/%m/%d %a — %I:%M %p"
TZ=Australia/Melbourne date "+Melbourne : %Y/%m/%d %a — %I:%M %p"
@michiel
michiel / fluent-bit-modify-test-gen.js
Created May 14, 2018 11:16
fluent-bit modify test data
function genId(len) {
var text = "";
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
for (var i = 0; i < len + 1; i++)
text += possible.charAt(Math.floor(Math.random() * possible.length));
return text;
@michiel
michiel / fluent-bit-nest.md
Last active November 9, 2022 16:03
fluent-bit example config/output for https://github.com/fluent/fluent-bit/pull/531

Nest/Lift

Nest 1

[INPUT]
    Name mem
    Tag  mem.local

[OUTPUT]

Name stdout

@michiel
michiel / pagination_example.sql
Created April 8, 2018 12:48 — forked from ssokolow/pagination_example.sql
Reasonably efficient pagination without OFFSET (SQLite version)
-- Reasonably efficient pagination without OFFSET
-- SQLite version (Adapted from MS SQL syntax)
-- Source: http://www.phpbuilder.com/board/showpost.php?p=10376515&postcount=6
SELECT foo, bar, baz, quux FROM table
WHERE oid NOT IN ( SELECT oid FROM table
ORDER BY title ASC LIMIT 50 )
ORDER BY title ASC LIMIT 10
@michiel
michiel / schema-introspection.graphql
Last active April 7, 2018 03:28
graphql schema introspection query
query IntrospectionQuery {
__schema {
queryType { name }
mutationType { name }
types {
...FullType
}
directives {
name
description
@michiel
michiel / commands-fluent-bit-dev.md
Last active February 6, 2018 02:45
fluent-bit dev

Manage and update remote branches

git remote add upstream https://github.com/fluent/fluent-bit.git
git checkout -b ffscl-master
git remote add ffscl https://github.com/ffscl/fluent-bit.git
git fetch -v ffscl master
git branch --set-upstream-to=ffscl/master
git remote -v

Dev

@michiel
michiel / .block
Last active November 16, 2017 02:11 — forked from mbostock/.block
Minimap Demo
license: gpl-3.0
@michiel
michiel / rust-update-docs-hook
Created September 21, 2017 22:34 — forked from Stebalien/rust-update-docs-hook
A post-commit hook to update a rust project's gh-pages.
#!/bin/bash
set -e
[[ "$(git symbolic-ref --short HEAD)" == "master" ]] || exit 0
msg() {
echo "> $@"
}
dir="$(pwd)"
tmp="$(mktemp -d)"