Skip to content

Instantly share code, notes, and snippets.

View ryancdotorg's full-sized avatar

Ryan Castellucci ryancdotorg

View GitHub Profile
@ryancdotorg
ryancdotorg / dnaas.c
Created October 30, 2013 23:20
Wrapper library to use /dev/null as a service on Linux via LD_PRELOAD
/* This is a wrapper library that will give your server the power of
* /dev/null as a service, as seen at http://devnull-as-a-service.com/
*
* Compile:
* gcc -ggdb -shared -fPIC dnaas.c -ldl -lcurl -o libdnaas.so
*
* Try:
* LD_PRELOAD=./libdnaas.so dd if=/dev/sda of=/dev/null bs=8192 count=16
*
* Install:
@ryancdotorg
ryancdotorg / uap_pass.sh
Created December 19, 2013 06:37
My guest wifi password rotation script, including qr code generator.
#!/bin/bash
TEMP_DIR="/run/shm"
FONT_DIR="/usr/local/share/fonts"
# generate a 12 character password comprised of lower case letters
NEW_PASS=`\
dd if=/dev/urandom bs=1 count=32 2>/dev/null | \
tr '\200-\377' '\0-\177' | \
tr '\0-\77' '\100-\177' | \
from bitcoinrpc.authproxy import AuthServiceProxy
def asp_from_config(filename):
rpcport = '8332'
rpcconn = '127.0.0.1'
rpcuser = None
rpcpass = None
with open(filename, 'r') as f:
for line in f:
(key, val) = line.rstrip().replace(' ', '').split('=')
# This allows SSH to share a session - opening a second SSH connection to the same user@host:port will open a new shell channel in that session.
ControlMaster auto
ControlPersist 60
ControlPath ~/.ssh/master/%h|%p|%r
# use a different username for this one
Host htpc.local
User r
# a simple alias
@ryancdotorg
ryancdotorg / exim-rebuild.sh
Last active August 17, 2023 00:28
produce debian exim packages linked against OpenSSL instead of GnuTLS
#!/bin/sh
set -ex
sudo apt-get update
sudo apt-get upgrade
sudo apt-get build-dep exim4
sudo apt-get install --no-install-recommends devscripts fakeroot
apt-get source exim4
perl -i -pe 's/^\s*#\s*OPENSSL\s*:=\s*1/OPENSSL:=1/' exim4-*/debian/rules
cd exim4-*
dch -l +openssl 'rebuild with openssl'
$ wget -qO bitcoinjs-min-0cbd0d52.js https://raw.githubusercontent.com/jsdelivr/jsdelivr/1b4b4781ffd72ee5fd7cbe15e0ed9116c11beddf/files/bitcoinjs/0.2.0/bitcoinjs-min.js
$ wget -qO bitcoinjs-min-162941e6.js https://raw.githubusercontent.com/ryancdotorg/cdnjs/feature/bitcoinjs-lib/ajax/libs/bitcoinjs-lib/0.2.0/bitcoinjs-min.js
$ sha256sum bitcoinjs-min-*.js
0cbd0d527360bc7fb8c38c7efd2b25c7acaa8ffa93b2e646e983eb760e6b496a bitcoinjs-min-0cbd0d52.js
162941e62af7dada11e1cf341f87b7d56ce1ecc6c0d2439dfcbcef4718257ad0 bitcoinjs-min-162941e6.js
$ perl -pe 's!/BUILDROOT/bitcoinjs-lib/node_modules/!!g' bitcoinjs-min-0cbd0d52.js | uglifyjs | sha256sum

Keybase proof

I hereby claim:

  • I am ryancdotorg on github.
  • I am ryanc (https://keybase.io/ryanc) on keybase.
  • I have a public key whose fingerprint is 876E 072E B9E4 82C9 44F0 0E53 8A04 C906 6DE6 C523

To claim this, I am signing this object:

@ryancdotorg
ryancdotorg / networks-namecoin.js
Created May 24, 2014 19:53
basic namecoin network support for bitcore
// add to networks.js in bitcore for namecoin livenet support
exports.namecoin = {
name: 'namecoin',
magic: hex('f9beb4fe'),
addressVersion: 0x34,
privKeyVersion: 128,
genesisBlock: {
hash: hex('70C7A9F0A2FB3D48E635A70D5B157C807E58C8FB45EB2C5E2CB7620000000000'),
merkle_root: hex('0DCBD3E6F061215BF3B3383C8CE2EC201BC65ACDE32595449AC86890BD2DC641'),
@ryancdotorg
ryancdotorg / getblock.diff
Created May 28, 2014 03:01
patch to add height, confirmations and nextblockhash to namecoin's getblock rpc call
diff --git a/src/bitcoinrpc.cpp b/src/bitcoinrpc.cpp
index d0a0d1d..94b4305 100644
--- a/src/bitcoinrpc.cpp
+++ b/src/bitcoinrpc.cpp
@@ -278,25 +278,33 @@ Value getblocknumber(const Array& params, bool fHelp)
}
-Value BlockToValue(CBlock &block)
+Value BlockToValue(CBlock &block, CBlockIndex* blockindex)
diff --git a/src/bitcoinrpc.cpp b/src/bitcoinrpc.cpp
index 94b4305..ed25ba8 100644
--- a/src/bitcoinrpc.cpp
+++ b/src/bitcoinrpc.cpp
@@ -2458,6 +2458,29 @@ Value verifymessage(const Array& params, bool fHelp)
return Hash160(key.GetPubKey()) == hash160;
}
+Value addnode(const Array& params, bool fHelp)
+{