Skip to content

Instantly share code, notes, and snippets.

View hammertoe's full-sized avatar

Matt Hamilton hammertoe

View GitHub Profile
input output
16 1
17 1
18 1
19 1
20 1
21 0
22 0
23 0
@hammertoe
hammertoe / heater_control.py
Last active January 5, 2020 14:49
Simple temperate control function
def heater_control(temperature):
if temperature > 20:
return 0
else:
return 1
def fft(inp):
inp = tuple(inp)
total = ""
for i, c in enumerate(inp, 1):
pat = [ [item] * i for item in base_pat ]
pat = [item for sublist in pat for item in sublist]
l1 = len(pat)
l2 = len(inp)
pat = pat * math.ceil((l2+1)/l1)
pat = pat[1:l2+1]
@hammertoe
hammertoe / gist:47d46d92bcc0eb408eb9b3d06fd59a23
Created February 24, 2019 19:58
Output of some balancing runs
### I have just deposited some more XRP to what was a balanced portfolio, not is it is unbalanced
(crypto_balancer) Matts-iMac:crypto_balancer matt$ crypto_balancer binance
Connected to exchange: Binance
Balances:
XRP 4468.878282
BTC 0.01609
ETH 0.42
BNB 3.04830514
USDT 33.602051
@hammertoe
hammertoe / valstream.js
Last active September 23, 2018 17:47
A script to view the validation message stream on the XRP Ledger
// npm i ripple-lib
// node valstream.js
const RippleAPI = require("ripple-lib").RippleAPI;
var api = new RippleAPI({ server: "wss://s1.ripple.com" });
api.connect().then(() => {
api.connection.on('validationReceived', (event) => {
console.log(JSON.stringify(event, null, 2))
try:
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
except:
from http.server import BaseHTTPRequestHandler, HTTPServer
import socket
class NumberServer(BaseHTTPRequestHandler):
def _set_headers(self):
self.send_response(200)
self.send_header('Content-type', 'text/plain')