Skip to content

Instantly share code, notes, and snippets.

View bracki's full-sized avatar

Jan Brauer bracki

View GitHub Profile
@bracki
bracki / Makefile
Created January 31, 2014 20:43
Generic Makefile for PECL debian packages
TOP := $(CURDIR)
PKGDIR = $(TOP)/pkg
all: build
$(PKGDIR):
mkdir -p $(PKGDIR)
clean:
rm -rf $(PKGDIR)
@bracki
bracki / image.go
Created March 2, 2014 21:11
Simple image renderer with Go.
package main
import (
"bytes"
"github.com/quirkey/magick"
"io/ioutil"
"log"
"net/http"
"net/url"
"path/filepath"
#!/usr/bin/env python
# Quick and dirty demonstration of CVE-2014-0160 by
# Jared Stafford (jspenguin@jspenguin.org)
# Modified so that it finds cookies
import sys
import struct
import socket
import time
import select
If you want, I can try and help with pointers as to how to improve the indexing speed you get. Its quite easy to really increase it by using some simple guidelines, for example:
- Use create in the index API (assuming you can).
- Relax the real time aspect from 1 second to something a bit higher (index.engine.robin.refresh_interval).
- Increase the indexing buffer size (indices.memory.index_buffer_size), it defaults to the value 10% which is 10% of the heap.
- Increase the number of dirty operations that trigger automatic flush (so the translog won't get really big, even though its FS based) by setting index.translog.flush_threshold (defaults to 5000).
- Increase the memory allocated to elasticsearch node. By default its 1g.
- Start with a lower replica count (even 0), and then once the bulk loading is done, increate it to the value you want it to be using the update_settings API. This will improve things as possibly less shards will be allocated to each machine.
- Increase the number of machines you have so
@bracki
bracki / function1.clj
Created June 17, 2014 09:11
Clojure/Scala Interop
(defn scala-function1 [f]
"Convert a one-argument Clojure function to a scala.Function1."
(reify scala.Function1
(apply [_ x] (f x))))
@bracki
bracki / xconfhh.md
Last active August 29, 2015 14:06
A quick recap of XConf Hamburg

A quick recap of XConf Hamburg

Today I attended [XConf][XconfHH]. Here is a quick recap of the talks I visited.

Keynote by [@jezhumble][jezhumble]

This has been summarized in other posts far better than I can

@bracki
bracki / diesel.md
Last active August 29, 2015 14:09
pip install diesel
>>> urllib2.urlopen('http://jamwt.com/diesel/diesel-3.0.16.tar.gz')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 126, in urlopen
    return _opener.open(url, data, timeout)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 400, in open
    response = meth(req, response)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 513, in http_response
    'http', request, response, code, msg, hdrs)
(schnuffi)➜ ~ pip -vvvvv install diesel
Using PyPI mirrors:
Downloading/unpacking diesel
Getting page http://pypi.python.org/simple/diesel
URLs to search for versions for diesel:
* http://pypi.python.org/simple/diesel/
Getting page http://pypi.python.org/simple/diesel/
Analyzing links from page https://pypi.python.org/simple/diesel/
Found link https://pypi.python.org/packages/source/d/diesel/diesel-2.1.0.tar.gz#md5=bf52eb9c2d51fedc667348af613f3250 (from https://pypi.python.org/simple/diesel/), version: 2.1.0
Found link https://pypi.python.org/packages/source/d/diesel/diesel-2.1.1.tar.gz#md5=0184b336fea8f5d4482befde5716ce14 (from https://pypi.python.org/simple/diesel/), version: 2.1.1
@bracki
bracki / foo.go
Last active August 29, 2015 14:09
func restoreDump(conn mysqlConnection) {
log.Print("Restoring dump")
// Collect the output from the command(s)
var output bytes.Buffer
var stderr bytes.Buffer
bzcat := exec.Command("/bin/bzcat", "/tmp/location")
bzcat.Stderr = &stderr
cmdString := mysqlCommand(conn, []string{"cms"})
(use 'clojure.contrib.seq-utils)
(def graph {:a [:b], :b [:a :c], :c [:b :d], :d [:c]})
(defn find-path
"Find a path between a start and an end node."
([g start end]
(if (contains? g start)
(find-path g start end [])))
([g start end path]