Skip to content

Instantly share code, notes, and snippets.

@nick-desteffen
nick-desteffen / Procfile
Created Oct 23, 2018 — forked from andrius/Procfile
How to dockerize #rails app with #puma. Edit config/application.rb and config/puma.rb #docker #ruby
View Procfile
api: bundle exec puma -C config/puma.rb
@nick-desteffen
nick-desteffen / ppurlcat.py
Created Mar 20, 2018
A crude proxy protocol v1 test client
View ppurlcat.py
#!/usr/bin/env python
import socket
import ssl
import sys
from urlparse import urlparse
'''Crude test client to a HTTP(S) server listening for proxy protocol
connections. Takes a HTTP(S) url as an argument and prints out the raw
response.
@nick-desteffen
nick-desteffen / explain_explained_notes.md
Created Apr 20, 2017 — forked from just3ws/explain_explained_notes.md
Postgres EXPLAIN Lunch & Learn @ BenchPrep
View explain_explained_notes.md

Postgres EXPLAIN Lunch & Learn @ BenchPrep

EXPLAIN Explained video on YouTube

What EXPLAIN doesn't do

  • Tell you why a particular index isn't used
  • Explain how to rewrite your queries
  • Show what other factors make the DB slow
  • Tell you how much time the request took outside the DB
@nick-desteffen
nick-desteffen / install-comodo-ssl-cert-for-nginx.rst
Created Nov 11, 2015 — forked from bradmontgomery/install-comodo-ssl-cert-for-nginx.rst
Steps to install a Comodo PositiveSSL certificate with Nginx.
View install-comodo-ssl-cert-for-nginx.rst

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

View installation.sh
# NOTICE: to get Nginx+Unicorn best-practices configuration see the gist https://gist.github.com/3052776
$ cd /usr/src
$ wget http://nginx.org/download/nginx-1.2.1.tar.gz
$ tar xzvf ./nginx-1.2.1.tar.gz && rm -f ./nginx-1.2.1.tar.gz
$ wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.30.tar.gz
$ tar xzvf pcre-8.30.tar.gz && rm -f ./pcre-8.30.tar.gz
$ wget http://www.openssl.org/source/openssl-1.0.1c.tar.gz
View osx-for-hackers.sh
#!/bin/sh
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
green='\033[0;32m'
@nick-desteffen
nick-desteffen / schedule
Created Apr 21, 2014
RailsConf 2014 Schedule
View schedule
Tuesday
8:00 - Convention Registration - Registration
9:15-10:30 - Sheraton Ballroom - Keynote
10:30-11:00 - Exhibit Hall - Break
11:00-11:40 - Ballroom 5 - Saving the World (literally) with Ruby on Rails
11:50-12:30 - Michigan AB - Rack::Attack: Protect your app with this one weird gem!
12:30-1:40 - Exhibit Hall - Lunch
1:40-12:30 - Ballroom 5 - Distributed Request Tracing
2:30-3:10 - Ballroom 5 - Rack-AMQP: Ditch HTTP inside SOA!
3:20-4:00 - Ballroom 1-3 - Advanced aRel: When ActiveRecord Just Isn't Enough
View README.md

Benchmark Bundler

Because loading gems can take longer than you think

$ curl -fsSL https://gist.github.com/raw/5022636/benchmark.rb | ruby
............................................................[DONE]

Gem                            Time(sec)     Pct %
--------------------------------------------------
View redis-server-for-init.d-startup
#! /bin/sh
### BEGIN INIT INFO
# Provides: redis-server
# Required-Start: $syslog
# Required-Stop: $syslog
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: redis-server - Persistent key-value db
@nick-desteffen
nick-desteffen / Javascript RandomDate
Created Dec 14, 2012
Function to generate a random date between 2 dates
View Javascript RandomDate
start = new Date(2001, 0, 1)
end = new Date()
function randomDate(start, end) {
return new Date(start.getTime() + Math.random() * (end.getTime() - start.getTime()))
}
//http://apod.nasa.gov/apod/ap950616.html