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 / 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 / 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 / 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
{"foil":{"history":[],"layerCount":6,"outline":{"area":0.0075541228622360655,"height":0.1,"path":[["M",0,0],["C",32.1909839,-63.06534,140.7988859,-227.155744,269.500718,-228.968964],["C",296.158458,-229.344534,336.987478,-220.894644,340.609098,-194.481404],["C",342.964838,-177.300378,269.209258,-156.23082,247.101578,-124.0841],["C",199.7571979,-55.2408,226.879918,-13,232.879918,0]],"sweep":0.72123963587739,"uuid":"{332b1de1-40b7-4b62-8b62-f261459d3144}"},"profile":{"symmetry":"Symmetric","thicknessRatio":1,"topProfile":{"cont":[0,1,0],"path":[["M",0,0],["C",-0.7973325173393278,-38.44668892785932,127.23264139117433,-73.35296904484017,361.0792383645382,-73.93534393137202],["C",712.9901941467928,-74.81174797400323,1207.8759716711122,-6.185557024727501,1235.6814732167798,0]]},"uuid":"{dd88cfd2-805e-4f23-beeb-24a3bd219028}"},"thick":0.01,"thickness":{"topProfile":[["M",0,-30],["C",0,-30,300,-30,300,0]],"uuid":"{31f91e08-b353-4d72-ae76-f642dca24898}"},"uuid":"{b3ea71cf-9d29-4037-9dd0-c5ee3b8e9b3c}"}}
@hrobeers
hrobeers / gist:110db0a7d4e1a1c907c7
Created February 9, 2015 20:26
WriteStlToString
// Get the polyData object to write
vtkSmartPointer<vtkPolyData> polydata = polyData();
vtkSmartPointer<vtkSTLWriter> stlWriter =
vtkSmartPointer<vtkSTLWriter>::New();
#if VTK_MAJOR_VERSION <= 5
stlWriter->SetInput(polydata);
#else
stlWriter->SetInputData(polydata);