Skip to content

Instantly share code, notes, and snippets.

# A basic re-implementation of gron in JQ
# Operates in a streaming manner, without having to read the entire input first or hold it in memory
# Try: cat big.json | while read; do printf '%s\n' "$REPLY"; sleep 0.1; done | jqgron
# Most operations are slower than gron, but `jqgron -u -j` is actually faster!
def topath:
map(if (tostring|test("\\A[[:alpha:]$_][[:alnum:]$_]*\\z")|not)
then "[\(tojson)]" else ".\(.)" end) | join("");
def tojqpath:
topath | if .[0:1] == "[" then "." + . else . end;

How much is the AWS Free Tier worth?

Service Offer Value/Month Expires
Data Transfer 15 GB of data transfer out $1.35 Yes
EC2 750 hours Linux t2.micro instance $8.35 Yes
EC2 750 hours Windows t2.micro instance $11.66 Yes
EC2 Container Registry 500 MB-month of Storage $50 Yes
EBS 30 GB $3.00 Yes
ELB 750 Hours $16.20 Yes
@mkfmnn
mkfmnn / bubblegum.py
Created October 7, 2017 06:45
Bubblegum compiler
#!/usr/bin/env python3
# Script for turning ascii input into valid Bubblegum programs
# https://esolangs.org/wiki/Bubblegum
import hashlib, lzma, sys, zlib
def bb96encode(code):
buf = []
a = 0
@mkfmnn
mkfmnn / MIDI JavaScript resources.md
Last active January 3, 2017 00:12
MIDI JavaScript resources
@mkfmnn
mkfmnn / callback-bench.lua
Created September 15, 2012 06:45
Benchmark of LuaJIT FFI callbacks from C into Lua
local ffi = require("ffi")
ffi.cdef[[
typedef void (*cb)(void);
void call(int n, void (*)(void));
void loop(int n);
void func(void);
]]
local callback = ffi.load("./callback.so")
local timeit = require("timeit")