Skip to content

Instantly share code, notes, and snippets.

View joshnabbott's full-sized avatar

Josh N. Abbott joshnabbott

  • Cloudflare Past:Area 1 Security, Big Cartel, Kajabi, Factory Design Labs, Oakley
  • Albuquerque, NM
View GitHub Profile
@joshnabbott
joshnabbott / restart-unicorn.rb
Created June 6, 2018 23:41 — forked from macks/restart-unicorn.rb
Graceful restart script for Unicorn
#!/usr/bin/ruby
# restart-unicorn: Graceful restart for Unicorn
# depends on Linux's proc(5)
#
# MIT License: Copyright(c)2011 MATSUYAMA Kengo
require 'scanf'
require 'timeout'
class ProcFS
@joshnabbott
joshnabbott / lua-resty-auto-ssl-perdomain.conf
Created May 30, 2018 03:07
openresty + lua-resty-auto-ssl config settings
#this file must be included in per domain settings (/etc/nginx/sites.available)
# Dynamic handler for issuing or returning certs for SNI domains.
ssl_certificate_by_lua_block {
auto_ssl:ssl_certificate()
}
ssl_certificate /etc/ssl/resty-auto-ssl-fallback.crt;
ssl_certificate_key /etc/ssl/resty-auto-ssl-fallback.key;
56k: "https://123.campfirenow.com/images/56k.gif"
bell: ":bell:"
bezos: ":laughing::thought_balloon:"
bueller: "anyone?"
clowntown: "https://123.campfirenow.com/images/clowntown.gif"
cottoneyejoe: ":notes::hear_no_evil::notes:"
crickets: "hears crickets chirping"
dadgummit: "dad gummit!! :fishing_pole_and_fish:"
dangerzone: "https://123.campfirenow.com/images/dangerzone.png"
danielsan: ":fireworks: :trophy: :fireworks:"
@joshnabbott
joshnabbott / gist:4035682
Created November 8, 2012 00:49 — forked from shripadk/gist:552554
Setting up Heroku Hostname SSL with GoDaddy SSL Cert
II. Creating a Certificate Signing Request (CSR)
Note: To create an SSL certificate, you must first generate and submit a Certificate Signing Request (CSR) to the Certification Authority (CA) (i.e. GoDaddy). The CSR contains your certificate-application information, including your public key. The CSR will also create your public/private key pair used for encrypting and decrypting secure transactions.
These instructions are based on my experience using a Mac OS X laptop. The following probably won't work if you are not working from a unix-based system (i.e. Mac OS X / Ubuntu Linux / etc.).
Steps to create a CSR:
1. Make a new directory to hold your project's SSL-related stuff. It doesn't really matter where you put this, but I recommend not putting it in your rails project (i.e. alongside app, config, db, etc.), as it will get included in your git repository if you do. Rather, I put it in a folder that is one level above my rails project.
@joshnabbott
joshnabbott / gist:2649072
Created May 9, 2012 21:35 — forked from mikeyk/gist:1329319
Testing storage of millions of keys in Redis
#! /usr/bin/env python
import redis
import random
import pylibmc
import sys
r = redis.Redis(host = 'localhost', port = 6389)
mc = pylibmc.Client(['localhost:11222'])
@joshnabbott
joshnabbott / gist:1936170
Created February 28, 2012 23:33 — forked from stephenmckinney/gist:1932021
Installing Ruby 1.8.7 on Lion with only Command Line Tools for Xcode non-llvm gcc 4.2

Installing older Rubies (e.g. Ruby 1.8.7) on a clean install of Lion and Xcode

The latest Xcode and Command Line Tools for Xcode changes the default compiler from gcc to the llvm compiler. Only ruby-1.9.3-p125+ is LLVM ready. So, you will have to install gcc-4.2 to compile older versions of Ruby. More detail here https://github.com/mxcl/homebrew/wiki/Custom-GCC-and-cross-compilers.

This worked for me. I hope it saves some people time:

brew install https://raw.github.com/adamv/homebrew-alt/master/duplicates/apple-gcc42.rb
CC=/usr/local/bin/gcc-4.2 rvm install 1.8.7
@joshnabbott
joshnabbott / gist:1514978
Created December 23, 2011 18:16 — forked from bemurphy/gist:1424311
run ctags in a post-checkout hook
#!/usr/bin/env ruby
require "shellwords"
def run_tags
`ctags -R . 2>/dev/null`
end
def project_dir
File.basename Dir.pwd
class Parent
belongs_to :child, :autosave => true, :polymorphic => true
end
class SomethingController
def create
@parent = Parent.new(params[:parent])
@parent.child = child
if @parent.save

New Machine

What I do after I do a fresh install. Things are sorta grouped by type.

General Config

  1. Start downloading Xcode
  2. Disable auto-bright and turn brightness all the way up
  3. Turn up trackpad tracking
  4. Disable trackpad pinch open & close
POST /book/:id/notes
note[content]
selection[spine_item_play_order]
selection[chunk_offset]
selection[character_offset]
selection[character_length]