Skip to content

Instantly share code, notes, and snippets.


Ryan Castellucci ryancdotorg

View GitHub Profile
View lz77c.js
// a toy lz77 compressor that outputs printable ascii, by @ryancdotorg
var compress = function(I) {
var p = 0, // position in input
o = "", // compressed output string
D, D_MAX = 479, // distance
L, L_MAX = 19, // length
match; // best match for current position
// encode a (distance,length) tuple
ryancdotorg /
Created Dec 23, 2018
Twisted protocol for Exim's `readsocket` function
#!/usr/bin/env python
from zope.interface import implementer
from twisted.internet.interfaces import IHalfCloseableProtocol
from twisted.internet.protocol import Protocol
class EximSocketProtocol(Protocol):
# buffer received data
def dataReceived(self, data):
ryancdotorg /
Last active Sep 15, 2018
Python script to output Bitfi key material compatible with `brainflayer -x -t priv`.
#!/usr/bin/env python
# This script accepts salt,passphrases pairs on STDIN seperated by a tab.
# Specify the coin symbol and indexes to generate via command line args.
# Appears to work fine with Bitcoin, Litecoin and Ethereum, probably works
# with many other coins as well.
# Don't participate in Bitfi's pay-to-play Bounty - it's a sham.
# by @ryancdotorg
pngcrush -q -force -m 1 -l 0 "$1" ".$1.tmp" && \
brotli -fj ".$1.tmp" -o "$"
ryancdotorg /
Created Jul 25, 2018
incomplete attempt to implement bitfi's key derivation algorithm
#!/usr/bin/env python
import sys
import hmac
import hashlib
import binascii
import scrypt
import pycoin
from pybitcointools import *
ryancdotorg /
Last active Mar 19, 2018
earnings report for task completion
// paste to console on after scrolling down until no more entries appear
var yearStr = " "+(new Date()).getFullYear();
var dateStr = e.getElementsByClassName("task-results-response-status")[0]
dateStr += dateStr.indexOf(yearStr) > -1 ? "" : yearStr;
View bloom_chk_hash160.nasm
%macro check_bit 0 ; check whether bit rax
; of the bloom filter is set
mov rdx, rax ; copy hash
shr rax, byte 3 ; byte to check in rax
movzx rax, byte [rdi+rax] ; load byte to check from memory
and rdx, byte 7 ; mask off bit to check
bt rax, rdx ; bit test against bloom filter
jnc bloom_miss ; jump to return a 'miss' if bit isn't set
ryancdotorg /
Last active Jul 1, 2018
Experimental DKIM rotate/revoke/repudiate script for Exim+Route53. I take no responsibility for its use.
#!/usr/bin/env python
import os
import grp
import sys
import stat
import time
import hmac
import boto3
import tempfile
#!/usr/bin/env python
import re
import os
import sys
import glob
import signal
import socket
import subprocess
#!/usr/bin/env python
from PIL import Image
INFILE = 'place.csv' # expects ts (seconds), x, y, hex color (without #) sorted by timestamp
OUTDIR = 'place_frames' # a directory, expected to exist
def hex2rgb(h):
return (int(h[0:2], 16), int(h[2:4], 16), int(h[4:6], 16))
You can’t perform that action at this time.