Skip to content

Instantly share code, notes, and snippets.

View metacritical's full-sized avatar
Creating Black holes.

Pankaj Doharey metacritical

Creating Black holes.
View GitHub Profile
require 'delegate'
class Base
def foo
"foo"
end
def bar
"bar"
end
end

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

@metacritical
metacritical / batman.py
Last active August 29, 2015 14:16 — forked from traeblain/batman.py
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 16 09:30:30 2011
Python Batman Equation
@author: Trae Blain
"""
from __future__ import division
import matplotlib.pyplot as plt
@metacritical
metacritical / batman.py
Last active August 29, 2015 14:16 — forked from traeblain/batman.py
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 16 09:30:30 2011
Python Batman Equation
@author: Trae Blain
"""
from __future__ import division
import matplotlib.pyplot as plt
@metacritical
metacritical / LICENSE.txt
Last active August 29, 2015 14:26 — forked from aemkei/LICENSE.txt
Binary Tetris - 140byt.es
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@metacritical
metacritical / hash.c
Last active August 29, 2015 14:27 — forked from tonious/hash.c
A quick hashtable implementation in c.
#define _XOPEN_SOURCE 500 /* Enable certain library functions (strdup) on linux. See feature_test_macros(7) */
#include <stdlib.h>
#include <stdio.h>
#include <limits.h>
#include <string.h>
struct entry_s {
char *key;
char *value;
@metacritical
metacritical / Gemfile
Last active September 10, 2015 06:31 — forked from dalibor/Gemfile
Github flavored markdown to HTML
source 'https://rubygems.org'
gem 'github-markup'
gem 'github-markdown'
gem 'github-linguist'
gem 'html-pipeline'
@metacritical
metacritical / play.rb
Created November 28, 2011 20:06
Ruby video player implemented using HornetsEye
require 'rubygems'
require 'hornetseye_ffmpeg'
require 'hornetseye_xorg'
require 'hornetseye_alsa'
include Hornetseye
input = AVInput.new 'sintel.mp4'
alsa = AlsaOutput.new 'default:0', input.sample_rate, input.channels
audio_frame = input.read_audio
X11Display.show 600, :output => XVideoOutput do |display|
img = input.read
@metacritical
metacritical / gist:1404985
Created November 29, 2011 14:30 — forked from seanlilmateus/gist:1386468
Macruby Face Detection in Mac OS X Lion
framework 'Cocoa'
framework 'QuartzCore'
class NSColor
def toCGColor
colorRGB = self.colorUsingColorSpaceName NSCalibratedRGBColorSpace
components = Array.new(4){Pointer.new(:double)}
colorRGB.getRed components[0], green:components[1], blue:components[2], alpha:components[3]
@metacritical
metacritical / csv_parser_csv_gem_benchmark.rb
Created November 29, 2011 15:39 — forked from bytesource/csv_parser_csv_gem_benchmark.rb
Simple CSV Parser vs. CSV Gem Benchmark
require 'open-uri'
require 'nokogiri'
require 'parslet'
require 'csv'
# --------------------------------------------------
# Auxiliary code
class String