Skip to content

Instantly share code, notes, and snippets.

View moretea's full-sized avatar

Maarten Hoogendoorn moretea

View GitHub Profile
#!/usr/bin/env python3
import click
import subprocess
import pathlib
from dataclasses import dataclass
import functools
import typing
import tabulate
import re
# https://github.com/winpython/winpython/releases/download/2.3.20200530/Winpython64-3.7.7.1.exe
import glob
import os
import os.path
to_process = ["."]
while len(to_process) > 0:
item = to_process[0]
Feature: Computing actions to take given a set of policies and a current state
Scenario: No policies exist
Given there are no policies
And there are no existing snapshots
And it is monday morning
When actions are computed
Then there are no actions to perform
Scenario: Execute first hourly policy
@moretea
moretea / curl.sh
Created October 15, 2018 06:22
SeMI tools
ROOTKEY="657a48b9-e000-4d9a-b51d-69a0b621c1b9"
ROOTTOKEN="57ac8392-1ecc-4e17-9350-c9c866ac832b"
curl -v -s -H"X-API-KEY: $ROOTKEY" -H"X-API-TOKEN: $ROOTTOKEN" -H "Content-Type: application/json" $@
#!/usr/bin/env nix-shell
#!nix-shell -p jq -i python3 -p python3Packages.requests -p graphviz
# NOTE: Edit the dict below to change custom highlight colors for the labels of the nodes/vertices.
bgcolors = { "_key": "pink", "thing": "yellow" , "action": "green"}
import requests
import json
import subprocess
@moretea
moretea / gremlin.py
Created August 6, 2018 16:26
Minimal tool to send gremlin query to JanusGraph over the HTTP channel.
#!/usr/bin/env nix-shell
#!nix-shell -p jq -i python3 -p python3Packages.requests
import requests
import json
import atexit
import os
import readline
@moretea
moretea / dump_graph.py
Last active August 6, 2018 11:47
Minimalistic visualisation of what is in a JanusGraph database, with Python & Graphviz.
#!/usr/bin/env nix-shell
#!nix-shell -p jq -i python3 -p python3Packages.requests -p graphviz
# NOTE: Edit the dict below to change custom highlight colors for the labels of the nodes/vertices.
bgcolors = { "_key": "pink", "thing": "yellow" , "action": "green"}
import requests
import json
import subprocess
@moretea
moretea / build.py
Created June 4, 2018 15:49
Memory mapped file example
from annoy import AnnoyIndex
import struct
VECTOR_LENGTH = 300
annoy_index = AnnoyIndex(VECTOR_LENGTH)
nr_lines = 0
words = []
print("Reading dataset")
@moretea
moretea / errors.txt
Last active July 14, 2017 10:46
portworx + kops
Executing with arguments: -k etcd://100.96.6.3:2380 -c mycluster -a -f -x kubernetes
Fri Jul 14 10:40:51 UTC 2017 : Running on Linux ip-172-20-58-196 4.4.65-k8s #1 SMP Tue May 2 15:48:24 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
size for /dev/shm is 67100672, less than required 293601280
PXD version: 33cafba6c39c862340a8c30b2677849f67bd2d6a
Key Value Store: etcd://100.96.6.3:2380
Using cluster: mycluster
Using scheduler: kubernetes
/docker-entry-point.sh: line 763: /sys/fs/cgroup/cpu/cpu.rt_runtime_us: Permission denied
Failed to enable rt scheduler
Checking sysfs mount...
with (import <nixpkgs> {});
let
buildGlideDeps = { name, glideYaml, glideLock, sha256 }:
stdenv.mkDerivation {
inherit name;
outputHashAlgo = "sha256";
outputHashMode = "recursive";
outputHash = sha256;