Skip to content

Instantly share code, notes, and snippets.

Avatar

Ryan Castellucci ryancdotorg

View GitHub Profile
@ryancdotorg
ryancdotorg / bitfi_to_brainflayer.py
Last active Feb 5, 2020
Python script to output Bitfi key material compatible with `brainflayer -x -t priv`.
View bitfi_to_brainflayer.py
#!/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.
View brotlipng.sh
#!/bin/sh
# brotlipng.sh by @ryancdotorg
pngcrush -q -force -m 1 -l 0 "$1" ".$1.tmp" && \
brotli -fj ".$1.tmp" -o "$1.br"
@ryancdotorg
ryancdotorg / bitfi.py
Created Jul 25, 2018
incomplete attempt to implement bitfi's key derivation algorithm
View bitfi.py
#!/usr/bin/env python
import sys
import hmac
import hashlib
import binascii
import scrypt
import pycoin
from pybitcointools import *
@ryancdotorg
ryancdotorg / export-earn.com-earnings.js
Last active Mar 19, 2018
earnings report for earn.com task completion
View export-earn.com-earnings.js
// paste to console on https://earn.com/history/ after scrolling down until no more entries appear
hist=[];
document.querySelectorAll(".tasks-results-card-content").forEach(function(e){
var yearStr = " "+(new Date()).getFullYear();
var dateStr = e.getElementsByClassName("task-results-response-status")[0]
.getElementsByTagName("div")[6].innerText.split(',')[0];
dateStr += dateStr.indexOf(yearStr) > -1 ? "" : yearStr;
hist.push(
e.getElementsByClassName("head-stat")[0]
View bloom_chk_hash160.nasm
CPU X64
%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
ryancdotorg / rotate_dkim.py
Last active Jul 1, 2018
Experimental DKIM rotate/revoke/repudiate script for Exim+Route53. I take no responsibility for its use.
View rotate_dkim.py
#!/usr/bin/env python
import os
import grp
import sys
import stat
import time
import hmac
import boto3
import tempfile
View clean-dnsmasq-ipset.py
#!/usr/bin/env python
import re
import os
import sys
import glob
import signal
import socket
import subprocess
View place_frames.py
#!/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))
@ryancdotorg
ryancdotorg / idleshutdown.sh
Created Feb 28, 2017
shut down a system when it becomes idle - for aws spot instances
View idleshutdown.sh
#!/bin/bash
IDLES=0
while sleep 30
do
PCT=`top -bn 2 -d 0.1 | grep '^%Cpu' | tail -n 1 | tr :. ' ' | awk '{print$2}'`
if [ $PCT -lt 10 ]
then
IDLES=$[$IDLES+1]
#echo $IDLES $PCT
View keychain_format.sh
#!/bin/sh
umask 077
TMPDIR=`mktemp -d /dev/shm/luks.XXXXXXXX`
if [ -d $TMPDIR ]
then
openssl rand -engine rdrand -base64 64 | tr -d '\n' > $TMPDIR/key
cryptsetup -i 10 -s 128 -d $TMPDIR/key luksFormat $1
if [ $? -eq 0 ]
then
UUID=`cryptsetup luksUUID $1`
You can’t perform that action at this time.