This is the reference point. All the other options are based off this.
|-- app
| |-- controllers
| | |-- admin
| import java.util.Collection; | |
| import java.util.SortedMap; | |
| import java.util.TreeMap; | |
| public class ConsistentHash<T> { | |
| private final HashFunction hashFunction; | |
| private final int numberOfReplicas; | |
| private final SortedMap<Integer, T> circle = new TreeMap<Integer, T>(); | |
| From: https://raw.github.com/gist/933cc4f7df97d553ed89/24386c6a79bb4b31fb818b70b34c5eab7f12e1ff/gistfile1.txt | |
| Stevey's Google Platforms Rant | |
| I was at Amazon for about six and a half years, and now I've been at Google for that long. One thing that struck me immediately about the two companies -- an impression that has been reinforced almost daily -- is that Amazon does everything wrong, and Google does everything right. Sure, it's a sweeping generalization, but a surprisingly accurate one. It's pretty crazy. There are probably a hundred or even two hundred different ways you can compare the two companies, and Google is superior in all but three of them, if I recall correctly. I actually did a spreadsheet at one point but Legal wouldn't let me show it to anyone, even though recruiting loved it. | |
| I mean, just to give you a very brief taste: Amazon's recruiting process is fundamentally flawed by having teams hire for themselves, so their hiring bar is incredibly inconsistent across teams, despite various effort |
| server { | |
| index index.php; | |
| set $basepath "/var/www"; | |
| set $domain $host; | |
| # check one name domain for simple application | |
| if ($domain ~ "^(.[^.]*)\.dev$") { | |
| set $domain $1; | |
| set $rootpath "${domain}"; |
Steps to install PIL
$ sudo apt-get install python-imaging
$ sudo apt-get install libjpeg-dev libfreetype6 libfreetype6-dev zlib1g-dev
$ sudo ln -s /usr/lib/`uname -i`-linux-gnu/libfreetype.so /usr/lib/
$ sudo ln -s /usr/lib/`uname -i`-linux-gnu/libjpeg.so /usr/lib/
$ sudo ln -s /usr/lib/`uname -i`-linux-gnu/libz.so /usr/lib/
$ pip install PIL
| %% Description: A simple FSM for a code lock with three states | |
| %% based on an example from the OTP system documentation | |
| -module(code_lock_fsm). | |
| -behaviour(gen_fsm). | |
| %% public API functions | |
| -export([start_link/1, stop/0, button/1, reset/0, get_state/0]). | |
| %% state names | |
| -export([locked/2, locked/3, open/2, open/3]). |
| # set up flags for Numpy C extentions compiling | |
| export CFLAGS="-arch i386 -arch x86_64" | |
| export FFLAGS="-m32 -m64" | |
| export LDFLAGS="-Wall -undefined dynamic_lookup -bundle -arch i386 -arch x86_64" | |
| export CC=gcc-4.2 | |
| export CXX="g++ -arch i386 -arch x86_64" | |
| pip install numpy | |
| # success! |
| #!/bin/sh | |
| # | |
| # Usage: ./redis-delkeys.sh [-h host] [-p port] [-n db] pattern | |
| # | |
| # Matches keys with the KEYS command matching pattern | |
| # and deletes them from the specified Redis DB. | |
| set -e | |
| HOST="localhost" |
| 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 |
| curl -XDELETE http://localhost:9200/ac-test | |
| curl -XPUT http://localhost:9200/ac-test | |
| curl -XPUT http://localhost:9200/ac-test/people/1 -d ' | |
| { | |
| "firstNames" : "James Earl", | |
| "lastName" : "Jones", | |
| "location" : "Hollywood, CA" | |
| }' | |
| curl -XPUT http://localhost:9200/ac-test/people/2 -d ' |