Skip to content

Instantly share code, notes, and snippets.

How to set up stress-free SSL on an OS X development machine

One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.

Most workflows make the following compromises:

  • Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.

  • Use production SSL certificates locally. This is annoying

@pswaminathan
pswaminathan / osx_developer_installation.rst
Created November 12, 2012 00:34 — forked from stefanfoulis/osx_developer_installation.rst
Instructions on how to setup an OSX developer machine for (python/django) development

OSX Developer System installation

This guide assumes a fresh install of Mac OSX 10.7 Lion.

Homebrew

@pswaminathan
pswaminathan / gist:4056993
Last active October 12, 2015 16:47 — forked from saetia/gist:1623487
Clean Install – Mountain Lion OS X 10.8
@pswaminathan
pswaminathan / python27_on_debian.sh
Last active December 16, 2015 17:38 — forked from willfill/python27_on_debian.sh
Only needed for debian<=6
sudo apt-get install build-essential libsqlite3-dev zlib1g-dev libncurses5-dev libgdbm-dev libbz2-dev libreadline5-dev libssl-dev libdb-dev
#for lxml
sudo apt-get install libxml2-dev
sudo apt-get install libxslt1-dev
#for mysql client
sudo apt-get install libmysqlclient-dev
# On OS X instead (assuming brew installed...)
brew install mysql
@pswaminathan
pswaminathan / extract_function.sh
Created August 6, 2013 19:51
Function to extract most typical kinds of files, without needing to remember all the damn flags.
# Extract Files
extract() {
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xvjf $1 ;;
*.tar.gz) tar xvzf $1 ;;
*.tar.xz) tar xvJf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar x $1 ;;
*.gz) gunzip $1 ;;
@pswaminathan
pswaminathan / email_address_regex.txt
Created October 3, 2013 21:43
Regex for matching email addresses
^[\w.%+-]+@(?:[\w-]+\.)+[A-Za-z]{2,4}$
Explanation:
^ # Start of string. If searching in-line replace with \b
[\w.%+-]+ # Matches alphanumeric, _, ., %, +, or - repeatedly
@ # name-domain separator
(?:
[\w-]+ # Matches alphanumeric or - repeatedly
\. # Matches dot in domain separator
)+ # Matches for one domain or for multiple subdomains
@pswaminathan
pswaminathan / int_conv_test.go
Created August 28, 2016 20:50
Int Conversion Benchmarks
package main
import (
"fmt"
"strconv"
"testing"
)
var (
n = 12345
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
</head>
<body>
<h1>Choose a Service:</h1>
<select id="service-selector">
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
</head>
<body>
<h1>Choose a Service:</h1>
<select id="service-selector">