Skip to content

Instantly share code, notes, and snippets.

View v9n's full-sized avatar
🛫
forward email at mailwip.com

Vinh v9n

🛫
forward email at mailwip.com
View GitHub Profile
@v9n
v9n / 20130416-todo.md
Created May 10, 2016 07:08 — forked from mrflip/20130416-todo.md
Elasticsearch Tuning Plan

Next Steps

  • Measure time spend on index, flush, refresh, merge, query, etc. (TD - done)
  • Take hot threads snapshots under read+write, read-only, write-only (TD - done)
  • Adjust refresh time to 10s (from 1s) and see how load changes (TD)
  • Measure time of a rolling restart doing disable_flush and disable_recovery (TD)
  • Specify routing on query -- make it choose same node for each shard each time (MD)
  • GC new generation size (TD)
  • Warmers
  • measure before/after of client query time with and without warmers (MD)
@v9n
v9n / setup.js
Last active May 3, 2016 07:23 — forked from nishitaniyuki/setup.js
import r from 'rethinkdb';
import config from '../config';
const createDatabase = (conn, name) =>
r.dbList().contains(name)
.do(containsDb =>
r.branch(
containsDb,
{ created: 0 },
r.dbCreate(name)
@v9n
v9n / System Design.md
Last active April 18, 2016 05:19 — forked from vasanthk/System Design.md
System Design Cheatsheet

#System Design Interview Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

##Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@v9n
v9n / concurrency-in-go.md
Created March 15, 2016 20:33 — forked from kachayev/concurrency-in-go.md
Channels Are Not Enough or Why Pipelining Is Not That Easy
@v9n
v9n / benchmark+go+nginx.md
Created January 17, 2016 06:57
Benchmarking Nginx with Go

Benchmarking Nginx with Go

There are a lot of ways to serve a Go HTTP application. The best choices depend on each use case. Currently nginx looks to be the standard web server for every new project even though there are other great web servers as well. However, how much is the overhead of serving a Go application behind an nginx server? Do we need some nginx features (vhosts, load balancing, cache, etc) or can you serve directly from Go? If you need nginx, what is the fastest connection mechanism? This are the kind of questions I'm intended to answer here. The purpose of this benchmark is not to tell that Go is faster or slower than nginx. That would be stupid.

So, these are the different settings we are going to compare:

  • Go HTTP standalone (as the control group)
  • Nginx proxy to Go HTTP
  • Nginx fastcgi to Go TCP FastCGI
  • Nginx fastcgi to Go Unix Socket FastCGI
@v9n
v9n / mini.elm
Created December 4, 2015 05:40 — forked from dpwiz/mini.elm
A minimal Elm application with AJAX and Virtual DOM.
import Debug
import Graphics.Input as Input
import Html
import Html (..)
import Html.Attributes (..)
import Html.Events (..)
import Html.Tags (..)
import Http
import Window
@v9n
v9n / 1-react-websockets-reflux.md
Last active September 18, 2015 17:50 — forked from danawoodman/1-react-websockets-reflux.md
Using WebSockets with Reflux and React

WebSockets + Reflux + React

Using WebSockets, React and Reflux together can be a beautiful thing, but the intial setup can be a bit of a pain. The below examples attempt to offer one (arguably enjoyable) way to use these tools together.

Overview

This trifect works well if you think of things like so:

  1. Reflux Store: The store fetches, updates and persists data. A store can be a list of items or a single item. Most of the times you reach for this.state in react should instead live within stores. Stores can listen to other stores as well as to events being fired.
  2. Reflux Actions: Actions are triggered by components when the component wants to change the state of the store. A store listens to actions and can listen to more than one set of actions.
@v9n
v9n / serve.sh
Last active September 7, 2015 08:13 — forked from alganet/serve.sh
Serve any folder as a web server with $ curl -L http://tinyurl.com/servesh1 | sh
#!/usr/bin/env sh
# serve.sh
# Modular version: https://gist.github.com/alganet/a22a1373dcee7c175d1e
# Expansion on zsh
command -v setopt 2>&1 >/dev/null && setopt SH_WORD_SPLIT
# POSIX on bash
export POSIXLY_CORRECT=1
# Lists files and folders as HTML
@v9n
v9n / tsws
Last active September 6, 2015 18:34 — forked from dfletcher/tsws
Totally simple web server using Bash and netcat (nc)
#!/bin/bash
# --------------------------------
# Totally Simple Web Server (TSWS)
# --------------------------------
#
# (c) 2015 Dave Fletcher
# All Rights Reserved
#
# This is free and unencumbered software released into the public domain.
@v9n
v9n / services.md
Last active August 29, 2015 14:28 — forked from bf4/services.md
Analytics, Metrics and Error monitoring services (and roll your own via logging, etc)