Skip to content

Instantly share code, notes, and snippets.

View fluency03's full-sized avatar

Chang Liu fluency03

  • London
View GitHub Profile
@fluency03
fluency03 / logstash-template.json
Created December 9, 2016 10:39 — forked from deverton/logstash-template.json
Logstash Elasticsearch Template
{
"template": "logstash-*",
"settings" : {
"number_of_shards" : 1,
"number_of_replicas" : 0,
"index" : {
"query" : { "default_field" : "@message" },
"store" : { "compress" : { "stored" : true, "tv": true } }
}
},
{
"template" : "logstash-*",
"settings" : {
"index.refresh_interval" : "15s"
},
"mappings" : {
"_default_" : {
"_all" : {"enabled" : true},
"dynamic_templates" : [ {
"string_fields" : {
input {
beats {
port => "5044"
}
}
filter {
json {
source => "message"
}
ruby {
{
"template" : "sttx-*",
"settings" : {
"index" : {
"refresh_interval" : "5s"
}
},
"mappings" : {
"_default_" : {
"dynamic_templates" : [
require 'json'
def parse_array obj, top, event
if obj.is_a? Array
obj.each_with_index {|oo, ii|
parse_json_array(oo, ii, top, event)
}
end
end
@fluency03
fluency03 / nginx-elasticsearch-proxy.conf
Created December 13, 2016 09:58 — forked from karmi/nginx-elasticsearch-proxy.conf
Route requests to ElasticSearch to authenticated user's own index with an Nginx reverse-proxy
# Run me with:
#
# $ nginx -p /path/to/this/file/ -c nginx.conf
#
# All requests are then routed to authenticated user's index, so
#
# GET http://user:password@localhost:8080/_search?q=*
#
# is rewritten to:
#
A
ABORT
ABS
ABSOLUTE
ACCESS
ACTION
ADA
ADD
ADMIN
AFTER

title: 'Leetcode Solution in Java' layout: post date: '2017-01-20 20:25' tag:

  • Leetcode
  • Java
  • Algorithms
  • Data Structure
  • Question
@fluency03
fluency03 / API.md
Created March 11, 2017 20:36 — forked from iros/API.md
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

@fluency03
fluency03 / 0.md
Created March 13, 2017 15:15 — forked from max-mapper/0.md
JS hoisting by example

JavaScript function hoisting by example

Below are many examples of function hoisting behavior in JavaScript. Ones marked as works successfuly print 'hi!' without errors.

To play around with these examples (recommended) clone them with git and execute them with e.g. node a.js

Notes on hoisting

(I may be using incorrect terms below, please forgive me)