Skip to content

Instantly share code, notes, and snippets.

View gabmontes's full-sized avatar

Gabriel Montes gabmontes

View GitHub Profile

A description of known problems in Satoshi Nakamoto's paper, "Bitcoin: A Peer-to-Peer Electronic Cash System", as well as notes on terminology changes and how Bitcoin's implementation differs from that described in the paper.

Abstract

The longest chain not only serves as proof of the sequence of events witnessed, but proof that it came from the largest pool of CPU power.

@ishu3101
ishu3101 / read_arguments.js
Last active March 12, 2024 18:10
Accept input via stdin and arguments in a command line application in node.js
#!/usr/bin/env node
var args = process.argv.slice(2);
var input = args[0];
var isTTY = process.stdin.isTTY;
var stdin = process.stdin;
var stdout = process.stdout;
// If no STDIN and no arguments, display usage message
@TOMOAKI12345
TOMOAKI12345 / bitcoin_spv_wallet_overview.md
Created August 31, 2015 11:37
Bitcoin SPV Wallet Flow Overview

@skeggse
skeggse / crypto-pbkdf2-example.js
Last active April 17, 2024 21:04
Example of using crypto.pbkdf2 to hash and verify passwords asynchronously, while storing the hash and salt in a single combined buffer along with the original hash settings
var crypto = require('crypto');
// larger numbers mean better security, less
var config = {
// size of the generated hash
hashBytes: 32,
// larger salt means hashed passwords are more resistant to rainbow table, but
// you get diminishing returns pretty fast
saltBytes: 16,
// more iterations means an attacker has to take longer to brute force an
@grugq
grugq / gist:03167bed45e774551155
Last active April 6, 2024 10:12
operational pgp - draft

Operational PGP

This is a guide on how to email securely.

There are many guides on how to install and use PGP to encrypt email. This is not one of them. This is a guide on secure communication using email with PGP encryption. If you are not familiar with PGP, please read another guide first. If you are comfortable using PGP to encrypt and decrypt emails, this guide will raise your security to the next level.

@kristopherjohnson
kristopherjohnson / formatjson.js
Last active November 29, 2023 02:47
Read JSON from standard input and writes formatted JSON to standard output. Requires Node.js.
#!/usr/bin/env node
// Reads JSON from stdin and writes equivalent
// nicely-formatted JSON to stdout.
var stdin = process.stdin,
stdout = process.stdout,
inputChunks = [];
stdin.resume();
@tblobaum
tblobaum / rename-redis-keys.js
Created July 22, 2012 13:19
script to rename lots of redis keys
var Redis = require('redis-stream')
, client = new Redis(6379, 'localhost', process.argv[2] || 0)
, stream = client.stream()
var keys = client.stream('keys')
process.stdin
.pipe(Redis.es.split())
.pipe(keys)
.pipe(Redis.es.mapSync(function (key) {
@trey
trey / happy_git_on_osx.md
Last active February 18, 2024 10:46
Creating a Happy Git Environment on OS X

Creating a Happy Git Environment on OS X

Step 1: Install Git

brew install git bash-completion

Configure things:

git config --global user.name "Your Name"

git config --global user.email "you@example.com"

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@zeuxisoo
zeuxisoo / gist:980174
Created May 19, 2011 04:15
How to use git diff to patch file

Create patch file

git diff --no-prefix > [path file name]

Apply path file

patch -p0 < [path file name]