Skip to content

Instantly share code, notes, and snippets.

View hrobeers's full-sized avatar

Hans Robeers hrobeers

View GitHub Profile
#include "wasm4.h"
const uint8_t smiley[] = {
0b11110000, 0b00001111,
0b11000000, 0b00000011,
0b00000100, 0b00010000,
0b00000100, 0b00010000,
0b00000000, 0b00000000,
0b00001100, 0b00110000,
0b11000011, 0b11000011,
@hrobeers
hrobeers / gist:214b2a7199875c477f13f48e5f675c4a
Last active February 3, 2021 10:39
Generate compressed and uncompressed bitcoin addresses from a private key with bitcore.
var bitcore = require("bitcore-lib");
var Buffer = require("buffer").Buffer;
var value = new Buffer.from("test", "utf8");
var hash = bitcore.crypto.Hash.sha256(value);
// Compressed Key (nu skool)
var bn = bitcore.crypto.BN.fromBuffer(hash);
var privateKey = new bitcore.PrivateKey(bn);
@hrobeers
hrobeers / followdiff.sh
Created July 17, 2019 12:20
Social media followers diff script
#! /bin/bash
# Built and tested for instagram
cat followers.txt | grep -E '^\s*\S+\s*$' | uniq | sort > followers.sorted
cat following.txt | grep -E '^\s*\S+\s*$' | uniq | sort > following.sorted
diff followers.sorted following.sorted | grep '>'
@hrobeers
hrobeers / fork-watch.py
Created July 14, 2017 07:34
Prints the percentage of version 2 blocks in last 100 blocks
#! /usr/bin/python3
from peercoin_rpc import Client
number_of_blocks = 100
ppcnode = Client(testnet=True, username="testnet", password="testnetpw", ip="localhost", port=8888)
last_block_hash = ppcnode.getblockhash(ppcnode.getblockcount())
block_versions = []
@hrobeers
hrobeers / bossSandboxMockDB.erl
Last active December 20, 2015 20:49
Code to fill the bossSandbox mock DB
Part1 = part:new(id, "Part 1", "{file: 1}", "6fd84g3zx", erlang:now(), erlang:now()).
Asm1 = assembly:new(id, "Assembly 1", erlang:now(), erlang:now()).
{ok, P1} = Part1:save().
{ok, A1} = Asm1:save().
timer:sleep(1000).
Part2 = part:new(id, "Part 2", "{file: 2}", "s6d8fg7gr", erlang:now(), erlang:now()).
Asm2 = assembly:new(id, "Assembly 2", erlang:now(), erlang:now()).
{ok, P2} = Part2:save().
{ok, A2} = Asm2:save().
@hrobeers
hrobeers / bossManyToMany.erl
Last active December 20, 2015 18:09
Code to try many-to-many mapping with boss_db
Part = bossSandbox_part:new(id, "Part 1", "File 1", "Guid 1").
Asm = bossSandbox_assembly:new(id, "Assembly 1").
Part:save().
Asm:save().
P = boss_db:find_first(bossSandbox_part).
A = boss_db:find_first(bossSandbox_assembly).
Link = bossSandbox_partassembly:new(id, P:id(), A:id()).
Link:save().
@hrobeers
hrobeers / json_float_precision.cpp
Last active November 15, 2015 10:02
reduce json floating point precision to reduce size
// reduce json floating point precision to reduce size
#include <iostream>
#include <string>
#include <regex>
#include <vector>
const std::string foil = "{\"foil\":{\"history\":[],\"layerCount\":6,\"outline\":{\"area\":0.0094394211977858536,\"height\":0.10000000000000001,\"path\":[[\"M\",0,0],[\"C\",-0.8090161000000009,-1.065339999999992,146.79888589999996,-14.155744000000027,159.50071800000001,-92.968964000000028],[\"C\",328.158458,-105.34453400000007,441.98747800000001,-231.89464399999997,445.60909800000002,-144.481404],[\"C\",340.96483799999999,-107.30037800000002,411.20925799999998,-72.230819999999994,411.10157800000002,-73.084100000000007],[\"C\",173.75719790000005,-73.240800000000007,353.8799179999998,-1,353.87991799999986,0]],\"sweep\":0.96055560932291262,\"uuid\":\"{76d2a5ae-8d14-4617-8b6a-122401df6f20}\"},\"profile\":{\"botProfile\":[[\"M\",0,0],[\"C\",0,0,-26,69,114,34],[\"C\",91,9,300,0,300,0]],\"symmetry\":\"Asymmetric\",\"thickness\":0.01,\"thicknessRatio\":1.0249374147947978,\"topProfile\":[[\"
//hexcut(5, 3, 10, 10);
module hexcut (radius, depth, height, width) {
for (i = [0:ceil(height/(radius*2))]) {
for (j = [0:ceil(width/(radius*2))]) {
x = i*radius*2;
y = j*radius*1.75;
translate([x+(j%2*radius),y,0])
rotate([0,0,30])
@hrobeers
hrobeers / board.scad
Created October 22, 2015 07:42
Second attempt at using Malaroo's techique in OpenSCAD
// Parameters
length = 10;
rocker_curve = 3;
thick_rot = 7;
$fn = 100;
include<rocker.scad>
include<outline.scad>
// Parameters
length = 10;
rocker_curve = 3;
$fn = 100;
dia=length/PI;
include<rocker.scad>
// pic 11: intersect