Skip to content

Instantly share code, notes, and snippets.

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 / 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
### 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 / 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}' *
@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 / 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 / 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 / 1_Dockerised_JMeter.md
Created August 11, 2016 07:43 — forked from hhcordero/1_Dockerised_JMeter.md
Dockerized JMeter - A Distributed Load Testing Workflow
@lordnynex
lordnynex / packer-config
Created August 10, 2016 20:08 — forked from jjongsma/packer-config
Process YAML and write Packer JSON to STDOUT
#!/usr/bin/python
#
# Usage: packer-config my-template.yaml | packer build -
#
# Constructs a Packer JSON configuration file from the specified YAML
# template file and writes it to STDOUT.
#
# The YAML template format adds some flexibility and readability by
# adding comments and an !include directive, allowing for the
# following template syntax:
@lordnynex
lordnynex / negroniGorillaMux.go
Created August 9, 2016 08:50 — forked from pagreczner/negroniGorillaMux.go
Negroni and Gorilla Mux with Middleware example - golang
package main
import (
"github.com/codegangsta/negroni"
"github.com/gorilla/mux"
)
func main() {
router := mux.NewRouter()
apiV1 := router.PathPrefix("/api/v1").Subrouter()