Skip to content

Instantly share code, notes, and snippets.

Avatar

Jeff Garzik jgarzik

View GitHub Profile
@jgarzik
jgarzik / zcat.cc
Created Feb 28, 2018
Decompress gzip files to stdout
View zcat.cc
#include <stdio.h>
#include <stdexcept>
#include <unistd.h>
#include <fcntl.h>
#include <string>
#include <vector>
#include <string.h>
#include <assert.h>
#include <zlib.h>
@jgarzik
jgarzik / zcat.cc
Created Feb 28, 2018
Decompress gzip file to stdout
View zcat.cc
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <string>
#include <vector>
#include <assert.h>
#include <zlib.h>
using namespace std;
@jgarzik
jgarzik / BidiPipe.h
Created Feb 15, 2018
Bi-directional pipe as thread queue
View BidiPipe.h
#ifndef __SRV_BIDIPIPE_H__
#define __SRV_BIDIPIPE_H__
#include "Util.h"
#ifndef ARRAYLEN
#define ARRAYLEN(array) (sizeof(array)/sizeof((array)[0]))
#endif // ARRAYLEN
class BidiPipe {
@jgarzik
jgarzik / eth-tx-prefix.cc
Created Feb 11, 2018
Reverse iterated index for latest per-account activity
View eth-tx-prefix.cc
/*
Build:
g++ -std=c++11 -O -Wall -g -o eth-tx-prefix eth-tx-prefix.cc -lrocksdb
Run:
./eth-tx-prefix
Clean:
@jgarzik
jgarzik / patch
Created Jun 16, 2017
Version patch
View patch
diff --git a/configure.ac b/configure.ac
index a9156c3..50509d6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,6 @@
dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N)
AC_PREREQ([2.60])
-define(_CLIENT_VERSION_MAJOR, 0)
+define(_CLIENT_VERSION_MAJOR, 1)
define(_CLIENT_VERSION_MINOR, 14)
View keybase.md

Keybase proof

I hereby claim:

  • I am jgarzik on github.
  • I am jgarzik (https://keybase.io/jgarzik) on keybase.
  • I have a public key whose fingerprint is AF8B E07C 7049 F3A2 6B23 9D53 25B3 0832 0178 2B2F

To claim this, I am signing this object:

View gist:2342b15c5186e579f5dc
Verifying that +jgarzik is my openname (Bitcoin username). https://onename.io/jgarzik
@jgarzik
jgarzik / mmx-test.c
Created Aug 14, 2014
storing data in registers
View mmx-test.c
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <time.h>
#include <stdint.h>
#include <stdbool.h>
#include <unistd.h>
@jgarzik
jgarzik / paychanproto.md
Last active Aug 29, 2015
Payment channel JSON-RPC protocol
View paychanproto.md

This protocol describes a simple payment channel protocol, such as the one presented in https://en.bitcoin.it/wiki/Contracts#Example_7:_Rapidly-adjusted_.28micro.29payments_to_a_pre-determined_party

JSON-RPC methods shown here may be sent via HTTPS or stratum protocol. It is easily adaptable to protocol buffers or another favored marshalling method.

Open channel

Client requests a public key. Server responds with a public key (K2). K2, converted to a bitcoin address, forms the unique identifier for this payment channel. Each public key returned must be unique.

@jgarzik
jgarzik / protocol.txt
Last active Dec 22, 2015
Decentralied auction protocol (JSON-RPC)
View protocol.txt
(1) request payment information, required for auction creation. for zero
creation fees, price is 0, and "txout" is not required.
{
id: 1,
method: "auction.prepare",
params: [
{
// auction creator's address/identity
userid: "mkzfa27nZdHvwTZ6CitKmxroHrPbuvQQ4y",
You can’t perform that action at this time.