Skip to content

Instantly share code, notes, and snippets.


Dhruv Mehta dhruv

  • San Francisco Bay Area
View GitHub Profile
kristovatlas /
Created Apr 16, 2018
How to verify Trezor Bridge on MacOS (and maybe other operating systems)

Background reading

Verification Steps

  1. Visit For MacOS, you download a .pkg file.
  2. From also download the PGP signature file.
  3. The Satoshi Labs CTO signs the Bridge releases. Download his PGP key from his Keybase signature: This means at least that someone created an account with his identity and bothered to link a specific PGP key. If you retain this key over time, you can be sure that it wasn't recently swapped out. You can find same PGP under his identity in various places on the web:
ryanxcharles /
Last active Dec 14, 2020
Stealth Addresses, Transactions and Messages

Stealth Addresses, Transactions and Messages

Normal bitcoin addresses cannot be published in public without losing all privacy, since all transactions to that address can be seen by anybody. Stealth addresses let us publish an address in public which can be used by payers to derive a new address that the payee has access to, but no one else knows is associated with the stealth address. The trick is that the payer must use a nonce to derive the address paid to, and this nonce must be delivered to the payee so they know how to recover the funds. This nonce can be delivered in the transaction, so that no separate channel is required to communicate the nonce.

The same technology can also be used to construct new public keys to send encrypted messages to.

We will discuss four methods:

  1. The simplest form of stealth addresses, which has some drawbacks that can improved upon.
inlineblock / Funnel.js
Last active Dec 17, 2015
Funnel.js - D3/Backbone Funnel Visualization in HTML
View Funnel.js
var Funnel = Backbone.View.extend({
className: 'funnel',
options: {
horizontalOrientation: true,
valueAttribute: 'value',
uniqueAttribute: 'id',
scale: 'linear', // d3 scales
gapBetweenSize: 20, // px
width: 'auto',
shrikeh / csrf-lua.conf
Created Feb 6, 2013
A simple nginx host file that, using the lua module, handles CSRF, rather than the backend having to (and thus generally breaking caching by having to use Set-Cookie). Here, the front end takes care of CSRF, and sends an X-CSRF-Valid header to the backend regarding the validity of the POST, so that it is advisory (the backend then choose whether…
View csrf-lua.conf
server {
listen 80;
root /root/to/your/docroot;
proxy_redirect off;
proxy_intercept_errors on;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
glamp / cows_and_wolves.txt
Last active Jul 3, 2017
plotting wolf/cow fence boundaries
View cows_and_wolves.txt
o o o
o x
o x x x
x o
x x x o
o o
glamp /
Last active Nov 22, 2020
Plotting SVM predictions using matplotlib and sklearn
import numpy as np
import pylab as pl
import pandas as pd
from sklearn import svm
from sklearn import linear_model
from sklearn import tree
from sklearn.metrics import confusion_matrix

Python Number Conversion Chart

From To Expression
piscisaureus /
Created Aug 13, 2012
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url =

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

sr75 / run-ie-7-8-9-virtualbox-on-osx.txt
Created Mar 15, 2012
Run IE 7, 8, and 9 in Mac OS X
View run-ie-7-8-9-virtualbox-on-osx.txt
# the admin password for all of the IE VMs is “Password1″ without the quotes, it's also used for the password hints
1) Install VirtuaBox on your mac
2) Decide which versions of Internet Explorer you want to download and install – each version of Internet Explorer is contained within a separate virtual machine that runs within VirtualBox. In other words, if you want to run Internet Explorer 7, 8, and 9, you will need to download three separate VM’s, which may take a while so keep that in mind. Select the text below and copy it:
# Install ALL versions of Internet Explorer: IE 7, IE 8, and IE 9 (for now this script will also pull down a IE 6 vm with windows xp)
mrowl /
Created Jan 19, 2011
This defines a new enum type using the sqlalchemy type decorator. Data is stored with the sqlalchemy SmallInteger type while strings are used with the model. Preferable to the varchar (too large) or native enum (pain on postgres).
import sqlalchemy as sa
class EnumIntType(sa.types.TypeDecorator):
impl = sa.types.SmallInteger
values = None
def __init__(self, values=None):
self.values = values
You can’t perform that action at this time.