Skip to content

Instantly share code, notes, and snippets.

View jonathanbp's full-sized avatar

Jonathan Bunde-Pedersen jonathanbp

View GitHub Profile
@jonathanbp
jonathanbp / relations.sh
Last active February 9, 2024 09:55
Bash script to try and figure out relations between collections in a mongodb dump.
#!/usr/bin/env bash
# This script will try to detect relations between collections in a mongodb database.
function spinner() {
local info="$1"
local pid=$!
local delay=0.75
local spinstr='|/-\'
while kill -0 $pid 2>/dev/null; do
@jonathanbp
jonathanbp / PerSubscriberStreams
Last active March 4, 2020 10:11
PerSubscriberStreams
curl http://regionsyd.sirenia.io:8081/debug/vars | jq '.PerSubscriberStreams | to_entries | sort_by(.value) | reverse | .[] | "\(.key),\(.value)"' -r | csvlook -H | less
-- Create a table with a JSONB column.
CREATE TABLE items (
id SERIAL PRIMARY KEY,
attrs JSONB
);
-- You can insert any well-formed json input into the column. Note that only
-- lowercase `true` and `false` spellings are accepted.
INSERT INTO items (attrs) VALUES ('{
"name": "Pasta",
// Ad-hoc minions
var controlConn = new WebSocket('wss://emet.cc.au.dk/golem/v1/connect/'+webstrate.webstrateId);
controlConn.addEventListener("open", function(msg) {
console.log("connection to chief-minion established");
});
controlConn.addEventListener("message", function(msg) {
console.log("got message on controlConn", msg);
var minionMsg = JSON.parse(msg.data);
if (minionMsg.Event === "minion-connected" && minionMsg.Type === "minion-debug") {
// establish a connection to the minion
@jonathanbp
jonathanbp / gulpfile.js
Last active August 29, 2015 14:19 — forked from lishiyo/gulpfile.js
// Paths
var paths = {
sources: "./src/**/*.js",
sourceMain: "./src/index.js",
tests: "./test/*.js",
styles: "./styles",
target: "./dist",
targetMain: "bundle.js",
targetMainMin: "bundle.min.js"
}

Keybase proof

I hereby claim:

  • I am jonathanbp on github.
  • I am jonathanbp (https://keybase.io/jonathanbp) on keybase.
  • I have a public key whose fingerprint is 2614 FF4E 6A52 A0F9 1F86 0E97 15E3 81E3 F5B2 BFAE

To claim this, I am signing this object:

(function () {
d3.analog= function() {
var height = 100, gap=10,
xValue = function(d) { return d[0]; },
xScale = null,
color = d3.scale.category10();
function chart(selection) {
selection.each(function(d) {
var g = d3.select(this);
@jonathanbp
jonathanbp / mapicopy.sh
Created October 12, 2012 08:14
Copying entities from one server to another.
curl "$1/$3?depth=0" | xmllint --format - | grep Id | sed 's/<Id>\(.*\)<\/Id>/\1/' | sort | uniq | tr -s ' ' | sed 's/^ *//g' | while read img_id ; do
curl "$1/$3/$img_id" | xmllint --format - | egrep -v "(Lamport|LastModified)" > tmpimg.xml
curl -X PUT -d @tmpimg.xml "$2/$3/$img_id"
done