Skip to content

Instantly share code, notes, and snippets.

@johnnyt
johnnyt / nginx.conf
Created September 20, 2013 18:57
Image resizer in NGINX
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
@johnnyt
johnnyt / nginx-install.sh
Last active December 24, 2015 12:09
NGINX try_files Apache
# Install NGINX
sudo apt-get install nginx
# Rename github repository to ads_archive
# Create new github repository named ads
REPO_URL="https://github.com/mediaFORGE/ads.git"
ADS_DIR=/mnt/tmp # ??
ADS_ARCHIVE_DIR=/mnt/ads_archive
@johnnyt
johnnyt / maglev_proposal.md
Last active January 2, 2016 12:29
Talk proposal for MountainWest Ruby Conf

MagLev - From Download To Deploy

MagLev is a Ruby implementation built on top of a mature VM which offers native object persistence. Working with these live objects is awesome - but this image-based development is very different than traditional file-based development. MagLev uses both which has broad reaching effects - from design to deployment.

In traditional applications, data and code are separate. Deployments involve pulling new code, updating or migrating the data-store, and restarting or reloading the application which creates a new runtime with this new code.

MagLev's transient objects behave in this same manner, but committed objects are always there. Migrating these live, persistent objects is quite different. Your ‘data’ migrations involve things like instance variables, method definitions and class hierarchies, rather than creating tables or updating column definitions.

In this talk we will walk through how to:

@johnnyt
johnnyt / generator.rb
Created June 24, 2015 16:47
URUG 2015-06-23 Trigram Kata - check out: github.com/urug/trigram_kata
module Generator
def self.generate(trigram, prompt, size)
content = prompt.split(' ')
while content.length < size
new_word = trigram.get content[-2..-1].join(' ')
content << new_word
end
content.join(' ')
@johnnyt
johnnyt / nsq_example.rb
Last active October 31, 2019 19:13
Ruby NSQ Avro example
require "avro"
require "nsq"
SCHEMA = <<-JSON
{ "type": "record",
"name": "User",
"fields" : [
{"name": "username", "type": "string"},
{"name": "age", "type": "int"},
{"name": "verified", "type": "boolean", "default": "false"}
@johnnyt
johnnyt / keybase.md
Created July 10, 2016 02:37
Keybase proof

Keybase proof

I hereby claim:

  • I am johnnyt on github.
  • I am johnnyt (https://keybase.io/johnnyt) on keybase.
  • I have a public key ASC_wuMrm5gUcRYGCTjKUwWDiuX1PbqKqkJQkvYEZ3aWcAo

To claim this, I am signing this object: