Skip to content

Instantly share code, notes, and snippets.

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/
@konradkonrad
konradkonrad / README.md
Last active October 27, 2015 16:34
How to run a private pyethapp testcluster with docker-compose

Sometimes you maybe want to run your own little ethereum network. This is how you do it:

PREREQUISITES

  • install docker
  • install docker-compose
  • download docker-compose.yml

WHAT'S IN THE BOX?

The docker-compose.yml defines four services, which can start 4 slightly different configurations of pyethapp.

@konradkonrad
konradkonrad / logstash.conf
Last active August 29, 2015 14:18
Setup plugin sketch
input {
setup {
ns => "connection"
params => {
host => "127.0.0.1"
port => 6666
username => "user"
password => "the pwd"
}
}
@konradkonrad
konradkonrad / bad-mapping.sh
Created April 7, 2015 11:30
Elasticsearch silently ignores mis-structured mapping
curl -XDELETE localhost:9200/mytest
curl -XPUT localhost:9200/mytest
curl -XPUT localhost:9200/mytest/t1/_mapping -d '{
"t1": {
"_source": {"enabled": false},
"properties": {
"_all": {"enabled": false},
"field1": {"type": "string"},
@konradkonrad
konradkonrad / es_features.py
Last active January 25, 2022 23:52
tfidf from elasticsearch
import elasticsearch
from math import log
def tfidf_matrix(es, index, doc_type, fields, size=10, bulk=500, query=dict(match_all=[])):
"""Generate tfidf for `size` documents of `index`/`doc_type`.
All `fields` need to have the mapping "term_vector": "yes".
This is the consuming version (i.e. get everything at once).
:param es: elasticsearch client
@konradkonrad
konradkonrad / template_test.sh
Last active August 29, 2015 14:05
multi-language index mappings via templates POC
#!/bin/sh
# This tries to use index templates and dynamic_templates in order to define a
# 'DRY' multi language index-mapping (index per language).
# The 'general' template defines all field mappings (mostly via dynamic_templates) and
# their analyzers (which are underspecified on this level).
# The language templates ('de') do instantiate the the language specific analyzers
# and match the language suffix.
if [ -z "$ES" ]; then