Skip to content

Instantly share code, notes, and snippets.

@konradkonrad
konradkonrad / message_federation_penetrator.py
Last active November 18, 2020 15:40 — forked from fredo/gist:c8c242c2ca5ba3bba57dcd11d4e42f63
message_federation_penetrator.py
from gevent import monkey # isort:skip
monkey.patch_all() # isort:skip
from collections import defaultdict
from typing import List
import gevent
from gevent.event import Event
from matrix_client.errors import MatrixRequestError
"""Types used to represent transaction and its states.
Each state of a transaction is described by a different wrapper dataclass, this
is used to introduce new fields in a type safe manner, and to enforce correct
usage.
Transactions are by design immutable and don't have access in their field to
objects that do IO, that is why the RPC class is given as an argument to each
method, when necessary.
"""
from itertools import count
import gevent
from gevent.event import AsyncResult
def wait_twice(async_result):
print('wait_twice enter')
gevent.joinall(set([async_result, async_result]), raise_error=True)
print('wait_twice exit')
@konradkonrad
konradkonrad / .sh
Created January 31, 2019 11:30 — forked from schmir/.sh
show git status on tab key
# When Tab is pressed on an empty(!) command line, the contents of the
# directory are printed (`ls`) instead of a menu list of all
# executables:
function my-hg-report() {
tip=$(hg tip 2> /dev/null) || return
echo
hg --config pager.pager= status
echo
hg --config pager.pager= log --limit 5 --style compact
@konradkonrad
konradkonrad / docker-compose.yml
Last active October 27, 2017 09:18 — forked from ulope/docker-compose.yml
prometheus backfill test
version: "2.1"
services:
prom:
image: prom/prometheus
environment:
- TZ=$TZ
volumes:
- ./prom.yml:/etc/prometheus/prometheus.yml
ports:
var auction_abi = [{"constant":true,"inputs":[],"name":"num_tokens_auctioned","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"final_price","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"price_exponent","outputs":[{"name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"end_time","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"bid","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"token_multiplier","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"price_start","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutabi
@konradkonrad
konradkonrad / ecverify.sol
Last active March 14, 2017 12:15 — forked from axic/ecverify.sol
Ethereum ECVerify
//
// The new assembly support in Solidity makes writing helpers easy.
// Many have complained how complex it is to use `ecrecover`, especially in conjunction
// with the `eth_sign` RPC call. Here is a helper, which makes that a matter of a single call.
//
// Sample input parameters:
// (with v=0)
// "0x47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad",
// "0xaca7da997ad177f040240cdccf6905b71ab16b74434388c3a72f34fd25d6439346b2bac274ff29b48b3ea6e2d04c1336eaceafda3c53ab483fc3ff12fac3ebf200",
// "0x0e5cb767cce09a7f3ca594df118aa519be5e2b5a"
contract Faucet {
address owner;
uint256 sendAmount;
mapping (address => uint) lastSent;
uint blockLimit;
function Faucet(){
owner = msg.sender;
sendAmount = 1000000000000000000;
blockLimit = 5;
}
@konradkonrad
konradkonrad / .gitignore
Created October 23, 2015 11:25 — forked from karmi/.gitignore
Example Nginx configurations for Elasticsearch
nginx/
!nginx/.gitkeep
!nginx/logs/.gitkeep
src/
tmp/