##TUNING##
System: set file descriptors to 32K or 64K
vim /etc/security/limit.conf
| FROM golang:1.6.2 | |
| COPY . /go | |
| RUN go get github.com/nats-io/nats | |
| RUN go build api-server.go | |
| EXPOSE 8080 | |
| ENTRYPOINT ["/go/api-server"] |
| package main | |
| import ( | |
| "github.com/codegangsta/negroni" | |
| "github.com/gorilla/context" | |
| "github.com/unrolled/render" | |
| "labix.org/v2/mgo" | |
| "labix.org/v2/mgo/bson" | |
| "log" | |
| "net/http" |
| #!/bin/bash | |
| PACKAGE=oracle-jdk-7 | |
| PACKAGE_VIRTUAL=oracle-jdk | |
| VERSION_MAJOR=7 | |
| VERSION_MINOR=60 | |
| VERSION="${VERSION_MAJOR}u${VERSION_MINOR}" | |
| BUILD=b19 | |
| PKG_BASENAME="jdk-$VERSION-linux-x64.tar.gz" |
| #!/bin/bash | |
| grep -r -E '[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}' * |
| ### autoscale.tf | |
| data "template_file" "userdata" { | |
| template = "${file("templates/userdata.tpl")}" | |
| vars { | |
| region = "${var.region}" | |
| file_system_id = "${aws_efs_file_system.prod-efs.id}" | |
| } | |
| } | |
| resource "aws_launch_configuration" "mig5-prod-lc" { |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <strings.h> | |
| /* | |
| * Pearson hashing (from Wikipedia) | |
| * | |
| * Pearson hashing is a hash function designed for fast execution on processors with 8-bit registers. | |
| * Given an input consisting of any number of bytes, it produces as output a single byte that is strongly | |
| * dependent on every byte of the input. Its implementation requires only a few instructions, plus a |
| http { | |
| lua_shared_dict healthchecks 1m; | |
| upstream YOURAPP { | |
| server 0.0.0.1; # just an invalid address as a place holder | |
| balancer_by_lua_block { | |
| local balancer = require "ngx.balancer" | |
| -- well, usually we calculate the peer's host and port |
| package main | |
| import ( | |
| "fmt" | |
| "io" | |
| "io/ioutil" | |
| "net" | |
| "os" | |
| "strings" |
| package main | |
| import ( | |
| "archive/tar" | |
| "compress/gzip" | |
| "flag" | |
| "fmt" | |
| "io" | |
| "os" | |
| ) |