Note: This was written using elasticsearch 0.9.
Elasticsearch will automatically create an index (with basic settings and mappings) for you if you post a first document:
$ curl -X POST 'http://localhost:9200/thegame/weapons/1' -d \
'{
"_id": 1,
Note: This was written using elasticsearch 0.9.
Elasticsearch will automatically create an index (with basic settings and mappings) for you if you post a first document:
$ curl -X POST 'http://localhost:9200/thegame/weapons/1' -d \
'{
"_id": 1,
import java.io.UnsupportedEncodingException; | |
import java.util.Scanner; | |
import org.apache.commons.lang.StringUtils; | |
/** | |
* @author: Henry Yan | |
*/ | |
public class Convert16UnicodeToUTF8 { | |
public static void main(String[] args) throws UnsupportedEncodingException { |
import com.google.auto.value.AutoValue; | |
import java.lang.annotation.Retention; | |
import java.lang.annotation.Target; | |
import static java.lang.annotation.ElementType.TYPE; | |
import static java.lang.annotation.RetentionPolicy.RUNTIME; | |
/** | |
* Marks an {@link AutoValue @AutoValue}-annotated type for proper Gson serialization. | |
* <p> |
#Android and CI and Gradle (A How-To) | |
There are tech stacks in this world that make it dead simple to integrate a <abbr title="Continuous Integration">CI</abbr> build system. <br> | |
The Android platform is not one of them. | |
Although Gradle is getting better, it's still a bit non-deterministic, and some of the fixes you'll need will start to feel more like black magic than any sort of programming. | |
But fear not! It can be done! | |
Before we embark on our journey, you'll need a few things to run locally: |
# Set inotify watch limit high enough for IntelliJ IDEA (PhpStorm, PyCharm, RubyMine, WebStorm). | |
# Create this file as /etc/sysctl.d/60-jetbrains.conf (Debian, Ubuntu), and | |
# run `sudo service procps start` or reboot. | |
# Source: https://confluence.jetbrains.com/display/IDEADEV/Inotify+Watches+Limit | |
# | |
# More information resources: | |
# -$ man inotify # manpage | |
# -$ man sysctl.conf # manpage | |
# -$ cat /proc/sys/fs/inotify/max_user_watches # print current value in use |
#!/bin/bash | |
sudo apt-get install -y \ | |
apt-transport-https \ | |
ca-certificates \ | |
curl \ | |
software-properties-common | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - | |
sudo apt-key fingerprint 0EBFCD88 | |
sudo add-apt-repository \ | |
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \ |
import random | |
import secrets | |
import hashlib | |
import hmac | |
class ProvablyFair(random.Random): | |
"""An object that represents a provably fair algorithm""" | |
def __init__(self, client_seed:str=None, *, server_seed:str=None): |
// from the game instance | |
const master = new TLSClient({ | |
options: { | |
ca: fs.readFileSync(config.API_CERT), | |
}, | |
reconnectInterval: 2000, | |
host: config.MASTER_API_HOST, | |
port: config.MASTER_API_PORT, | |
password: config.API_PASSWORD |