Skip to content

Instantly share code, notes, and snippets.

@nick-desteffen
nick-desteffen / OSX UTC Time Zone
Created August 5, 2011 01:50
Set Time zone in OSX to UTC
sudo ln -sf /usr/share/zoneinfo/UTC /etc/localtime
@nick-desteffen
nick-desteffen / install-comodo-ssl-cert-for-nginx.rst
Created November 11, 2015 03:03 — forked from bradmontgomery/install-comodo-ssl-cert-for-nginx.rst
Steps to install a Comodo PositiveSSL certificate with Nginx.

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

@nick-desteffen
nick-desteffen / Javascript RandomDate
Created December 14, 2012 15:27
Function to generate a random date between 2 dates
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
@nick-desteffen
nick-desteffen / Procfile
Created October 23, 2018 20:19 — forked from andrius/Procfile
How to dockerize #rails app with #puma. Edit config/application.rb and config/puma.rb #docker #ruby
api: bundle exec puma -C config/puma.rb
@nick-desteffen
nick-desteffen / ppurlcat.py
Created March 20, 2018 22:22
A crude proxy protocol v1 test client
#!/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 April 20, 2017 20:41 — forked from just3ws/explain_explained_notes.md
Postgres EXPLAIN Lunch & Learn @ BenchPrep

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

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 %
--------------------------------------------------
#! /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 / .gitignore
Created November 13, 2012 04:36 — forked from pcdinh/.gitignore
fabfile to deploy flask app to nginx/supervisor/uwsgi stack
.idea/*
*.pyc
@nick-desteffen
nick-desteffen / nginx.conf
Created September 23, 2012 15:42
Nginx Upstart script
# nginx
description "nginx http daemon"
author "George Shammas <georgyo@gmail.com>"
start on (filesystem and net-device-up IFACE=lo)
stop on runlevel [!2345]
env DAEMON=/opt/nginx/sbin/nginx
env PID=/var/run/nginx.pid