Skip to content

Instantly share code, notes, and snippets.

Nest/Lift

Nest 1

[INPUT]
    Name mem
    Tag  mem.local

[OUTPUT]

Name stdout

@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 / 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 / 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 / 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 / How I Do PlantUML.md
Created November 18, 2019 23:28 — forked from jerieljan/How I Do PlantUML.md
PlantUML with Style -- How I do PlantUML

I use PlantUML a lot. It's what I use for drawing all sorts of diagrams and it's handy because of its easy markup (once you get used to it) while making things easy to maintain as projects grow (thanks to version control)

This gist details how I do my PlantUML workspace in a project.

  • The idea is to keep a globals directory for all diagrams to follow (like the "stylesheet" below) to keep things consistent.
  • The stylesheet.iuml file keeps the use of colors consistent through use of basic FOREGROUND, BACKGROUND and ACCENT colors.
  • The style-presets.iuml file defines these colors so you can make "presets" or "themes" out of them.
  • As stated in the stylesheet.iuml, you'll need the Roboto Condensed and Inconsolata fonts for these to work properly.
@michiel
michiel / run-gource.sh
Created February 5, 2020 05:14
Decent HD gource settings
#!/bin/bash
# Using ffmpeg 2.8
SIZE=1920x1080
SPEED=.5
CAMERA_MODE=track
FRAMERATE=30
gource \
-r $FRAMERATE \
@michiel
michiel / transport-dynamodb-data.sh
Created March 26, 2020 00:13
Export and import DynamoDB data across environments
#!/bin/sh
SOURCE_TABLE=xxx-mydata-accp
TARGET_TABLE=xxx-mydata-prod
AWS_PROFILE=default
AWS_REGION=ap-southeast-2
# Step 1 - export and transform
aws --profile=$AWS_PROFILE \
@michiel
michiel / list-active-cloudfront-deployments.sh
Created April 8, 2020 03:27
List active cloudfront deployments with AWS CLI and jq
#!/bin/sh
AWS_PROFILE=my-profile
AWS_REGION=ap-southeast-2
aws --profile=$AWS_PROFILE \
--region=$AWS_REGION \
cloudfront list-distributions \
| jq '.DistributionList.Items[].Origins.Items[] | {Id: .Id, OriginPath: .OriginPath}'
import svgwrite
import math
import json
class Pyramid:
def __init__(self, data, filename, height=500):
self.data = data
self.filename = filename
self.height = height
self.width = 2 * height