Skip to content

Instantly share code, notes, and snippets.

{
"path":"/home/foo/icons/",
"domain":"example.com",
"icons":[
{"host":"aaa.example.com", "icon":"red.png"},
{"host":"bbb.example.com", "icon":"green.png"},
{"host":"ccc.example.com", "icon":"yellow.png"},
{"host":"ddd.example.com", "icon":"orange.png"},
{"host":"eee.example.com", "icon":"blue.png"},
{"host":"fff.example.com", "icon":"cyan.png"},
@laanwj
laanwj / hexstr_benchmarks.cpp
Created April 21, 2012 18:45
Bitcoin HexStr benchmarks
// g++ -O2 hexstr_benchmarks.cpp -o hexstr_benchmarks
#include <stdio.h>
#include <vector>
#include <string>
#include <stdarg.h>
#include <time.h>
#include <string.h>
using namespace std;
#define loop for (;;)
@laanwj
laanwj / bignum_setcompact.cpp
Created September 21, 2012 15:33
Checks for all 32 bit integers whether SetCompactNew(x) == SetCompactOld(x)
// g++ bignum_setcompact.cpp -o ./bignum_setcompact -lcrypto -O3
// Checks for all 32 bit integers whether SetCompactNew(x) == SetCompactOld(x)
#include <limits>
#include <stdexcept>
#include <vector>
#include <openssl/bn.h>
#include <algorithm>
#include <assert.h>
#include <sys/types.h>
@laanwj
laanwj / haskell-unicode.sublime-keymap
Created September 22, 2012 13:35
Haskell unicode syntax key bindings for Sublime Text 2
[
{ "keys": [":",":"], "command": "insert_snippet", "args": {"contents": "∷"}, "context":
[
{ "key": "selector", "operator": "equal", "operand": "source.haskell" }
]
},
{ "keys": ["-",">"], "command": "insert_snippet", "args": {"contents": "→"}, "context":
[
{ "key": "selector", "operator": "equal", "operand": "source.haskell" }
]
@laanwj
laanwj / gist:4464490
Last active December 10, 2015 16:58 — forked from anonymous/gist:4430497
[seq 0] [thread 0] in={
.command = gcvHAL_GET_BASE_ADDRESS,
.u = {
}
}
[seq 1] [thread 0] out={
.command = gcvHAL_GET_BASE_ADDRESS,
.status = gcvSTATUS_OK,
.u = {
.GetBaseAddress = {
@laanwj
laanwj / texinfo_kobo.tex
Created June 14, 2013 08:15
Texinfo.tex configuration for generating PDFs readable with Kobo Glo 6" screen size
\def\afivepaper{{\globaldefs = 1
\parskip = 2pt plus 1pt minus 0.1pt
\textleading = 12.5pt
%
\internalpagesizes{111mm}{94mm}%
{-.5in}{-.85in}%
{0pt}{8pt}%
{127mm}{100mm}%
\lispnarrowing = 0.2in
\tolerance = 800
MOV t0.x___, void, void, t0.xxxx
MOV t0._y__, void, void, t0.xxxx
BRANCH.GE void, t0.yyyy, u0.zzzz, label_20 ; !bit_1_21=1! !bit_2_30=2!
LSHIFT t0._y__, t0.xxxx, void, u0.wwww ; !bit_2_30=1!
LOAD t1._yzw, u0.xxxx, t0.yyyy, void
MOV t0._yzw, void, void, t1.yyzw
LSHIFT t2.x___, t0.xxxx, void, u0.wwww ; !bit_2_30=1!
LOAD t1.xyz_, u0.xxxx, t2.xxxx, void
MOV t2.xyz_, void, void, t1.xyzz
MUL t3.xyz_, t0.yzww, t2.xyzz, void
@laanwj
laanwj / bip0038bf.py
Last active July 27, 2020 20:17
Python based implementation for bruteforcing BIP0038 passphrase (see http://www.reddit.com/r/Bitcoin/comments/1q5wu7/this_paper_wallet_contains_01125_btc_and_is_bip/ )
# Copyright (c) 2013 W.J. van der Laan
# parts sourced from jackjack's pywallet.py (https://github.com/jackjack-jj/pywallet)
# Distributed under the MIT/X11 software license
from bitcoin.base58 import CBase58Data
from binascii import b2a_hex, a2b_hex
import struct
import hashlib
import scrypt, random
from Crypto.Cipher import AES
@laanwj
laanwj / gist:8580481
Created January 23, 2014 15:27
Windows Qt 5.2.0 Qt5Gui.pc
prefix=/home/ubuntu/staging64
exec_prefix=${prefix}
libdir=${prefix}/lib
includedir=${prefix}/include
Name: Qt5 Gui
Description: Qt Gui module
Version: 5.2.0
Libs: -L${libdir} -lQt5Gui
@laanwj
laanwj / sendalert.cpp
Last active July 9, 2018 13:06
Bitcoin send alert code
/*
So you need to broadcast an alert...
... here's what to do:
1. Copy sendalert.cpp into your bitcoind build directory
2. Decrypt the alert keys
copy the decrypted file as alertkeys.h into the src/ directory.
3. Modify the alert parameters in sendalert.cpp