Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# if we are testing a PR, merge it with the latest master branch before testing
# this ensures that all tests pass with the latest changes in master.
set -eu -o pipefail
PR_NUMBER=${CI_PULL_REQUEST//*pull\//}
err=0
if [ -z "$PR_NUMBER" ]; then
@Georgi87
Georgi87 / StateChannel.sol
Last active February 2, 2018 20:49
Generalized settlement for state channels using proxy contracts.
pragma solidity ^0.4.0;
contract Token {
function transfer(address to, uint256 value) returns (bool);
function transferFrom(address from, address to, uint256 value) returns (bool);
}
/// @title State Channel contract - Allows multiple parties to settle off-chain transactions.
/// @author Stefan George - <stefan.george@consensys.net>
contract StateChannelProxy {
@ianpreston
ianpreston / kernel.json
Created September 19, 2015 21:39
Jupyter configuration for gevent
{
"display_name": "IPython 2 w/gevent",
"language": "python",
"argv": [
"python",
"-c", "from gevent.monkey import patch_all; patch_all(thread=False); from IPython.kernel.zmq.kernelapp import main; main()",
"-f",
"{connection_file}"
]
}
contract Faucet {
address owner;
uint256 sendAmount;
mapping (address => uint) lastSent;
uint blockLimit;
function Faucet(){
owner = msg.sender;
sendAmount = 1000000000000000000;
blockLimit = 5;
}
@karmi
karmi / .gitignore
Last active September 7, 2024 20:44
Example Nginx configurations for Elasticsearch (https://www.elastic.co/blog/playing-http-tricks-nginx)
nginx/
!nginx/.gitkeep
!nginx/logs/.gitkeep
src/
tmp/
@markharwood
markharwood / ExampleQueryFileGenerator.py
Last active August 29, 2015 14:05
Timeout benchmarks
import gzip
import csv
import time
import datetime
import json
# This script reads a data file (car test results) and uses it to create a CSV file of query clauses for benchmarking.
# It creates mostly well-behaved queries and randomly throws in "problem" queries of various forms
# Each CSV row in the output is a set of clauses (query/agg/filter) and some metadata for reporting purposes.
@tfg13
tfg13 / touchpadconf.sh
Created November 24, 2013 15:50
script to set synaptics configuration for Thinkpad T440p
#!/bin/sh
# this script sets some parameters to get a useable configuration
# these changes are not persistent, you may want to include this in your autostart
# 1 finger = left click, 2 finger = right click, 3 finger = middle click
synclient TapButton2=3
synclient TapButton3=2
synclient ClickFinger2=3
synclient ClickFinger3=2
import sys
import os
from pdb import Pdb
banner = """Usage:
%(command)s @<module>:<linenumber> ... <filename> <args>
Use @<module>:<linenumber> to set one or multiple breakpoints.
<module> may be an absolute path to a module file, or relative to sys.path.
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
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 = git@github.com:joyent/node.git

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:

@hrldcpr
hrldcpr / tree.md
Last active September 1, 2024 07:04
one-line tree in python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!