Skip to content

Instantly share code, notes, and snippets.

@benjiqq
benjiqq / purity_walkthrough.md
Created June 4, 2018 11:50 — forked from paulhauner/purity_walkthrough.md
Casper LLL Purity Checker Walk-through

Casper Purity Checker LLL Walk-through

WARNING: These are notes and are not complete, they may contain errors. They certainly contain awkward language (sorry).

These are my notes from reading the Casper LLL Purity Checker currently being reviewed here: ethereum/casper#143

Specifically, the casper/contracts/purity_checker.py file.

Preamble

{
"config": {
"chainId": 89,
"homesteadBlock": 1,
"eip150Block": 2,
"eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"eip155Block": 3,
"eip158Block": 3,
"byzantiumBlock": 4,
"clique": {
@benjiqq
benjiqq / gist:1b95318b8e205d6e3dc372086c180156
Created September 5, 2018 09:49 — forked from jamesp/gist:1385745
A simple cache for keeping timeseries data in memory
from bisect import bisect_left, bisect_right
class TimeseriesCache(object):
"""Store a timeseries of data in memory for random access."""
def __init__(self, ttl=None):
self.timestamps = []
self.data = []
self.ttl = ttl
def add(self, timestamp, data):
@benjiqq
benjiqq / pyrx.py
Created October 6, 2018 14:32 — forked from mbillingr/pyrx.py
Implementation of a minimal Forth interpreter/compiler on top of Python 3.5.
""" pyrx
Implementation of a minimal Forth interpreter/compiler on top of Python 3.6.
It is based on Rx [1] and should eventually support Retro [2].
Facts & Features:
- New words are compiled to Python bytecode (subroutine threading model).
- Dynamically typed: the only data type is the Python object.
- Literals are evaluated as Python expressions.
- The data stack is a global Python list.
@benjiqq
benjiqq / socket_connection.py
Created March 5, 2019 06:41 — forked from marif4444/socket_connection.py
Delta websocket connection
import websocket
import hashlib
import hmac
import base64
import datetime
import json
import time
import signal
from threading import Thread
@benjiqq
benjiqq / supervisord.conf
Created March 7, 2019 10:57 — forked from jasonamyers/supervisord.conf
A sample supervisor config file
; Sample supervisor config file.
;
; For more information on the config file, please see:
; http://supervisord.org/configuration.html
;
; Note: shell expansion ("~" or "$HOME") is not supported. Environment
; variables can be expanded using this syntax: "%(ENV_HOME)s".
[unix_http_server]
file=/tmp/supervisor.sock ; (the path to the socket file)
@benjiqq
benjiqq / ecdsa_demo.py
Created April 24, 2019 07:56 — forked from nlitsme/ecdsa_demo.py
python implementation of ecdsa calculations, demonstrating how to recover a private key from two signatures with identical 'r', and demonstrating how to find the public key from a signature and message, or from two signatures.
"""
By Willem Hengeveld <[email protected]>
ecdsa implementation in python
demonstrating several 'unconventional' calculations,
like finding a public key from a signature,
and finding a private key from 2 signatures with identical 'r'
"""
# (gcd,c,d)= GCD(a, b) ===> a*c+b*d!=gcd:
@benjiqq
benjiqq / zeromq-vs-redis.md
Created November 2, 2019 04:46 — forked from hmartiro/zeromq-vs-redis.md
Comparison of ZeroMQ and Redis for a robot control platform

ZeroMQ vs Redis

This document is research for the selection of a communication platform for robot-net.

Goal

The purpose of this component is to enable rapid, reliable, and elegant communication between the various nodes of the network, including controllers, sensors, and actuators (robot drivers). It will act as the core of robot-net to create a standardized infrastructure for robot control.

Requirements:

@benjiqq
benjiqq / gob.go
Created February 7, 2020 22:03 — forked from udhos/gob.go
golang gob interface example
package main
import (
"bytes"
"encoding/gob"
"fmt"
)
type MyFace interface {
A()
@benjiqq
benjiqq / alexa.js
Created June 29, 2020 15:44 — forked from chilts/alexa.js
Getting the Alexa top 1 million sites directly from the server, unzipping it, parsing the csv and getting each line as an array.
var request = require('request');
var unzip = require('unzip');
var csv2 = require('csv2');
request.get('http://s3.amazonaws.com/alexa-static/top-1m.csv.zip')
.pipe(unzip.Parse())
.on('entry', function (entry) {
entry.pipe(csv2()).on('data', console.log);
})
;