Skip to content

Instantly share code, notes, and snippets.

@lordnynex
lordnynex / Docker Compose + NATS example
Created August 13, 2016 22:25 — forked from wallyqs/Docker Compose + NATS example
NATS Docker blog post/HTTP Server
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"]
@lordnynex
lordnynex / jdk-deb-build.sh
Created October 15, 2016 20:46 — forked from iwinux/jdk-deb-build.sh
build Oracle JDK deb package with fpm
#!/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"
@lordnynex
lordnynex / find_it.sh
Created November 1, 2016 18:28 — forked from bitops/find_it.sh
GUID regex
#!/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" {
@lordnynex
lordnynex / pearson-hashing.c
Created December 30, 2016 02:26 — forked from darccio/pearson-hashing.c
Pearson hashing (just for fun). Includes Ruby and Golang versions for RFC 3074 and original variants.
#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
@lordnynex
lordnynex / elasticsearch.md
Created February 10, 2017 02:24 — forked from kkc/elasticsearch.md
Elasticsearch performance tuning

##TUNING##

Configuration

System: set file descriptors to 32K or 64K

vim /etc/security/limit.conf

@lordnynex
lordnynex / app.go
Created September 22, 2016 22:18 — forked from Bochenski/app.go
Negroni golang mgo middleware example
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"
@lordnynex
lordnynex / tar-gz-reader.go
Created May 11, 2017 01:27 — forked from indraniel/tar-gz-reader.go
Reading through a tar.gz file in Go / golang
package main
import (
"archive/tar"
"compress/gzip"
"flag"
"fmt"
"io"
"os"
)
@lordnynex
lordnynex / API.md
Created February 3, 2018 22:19 — 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: