Skip to content

Instantly share code, notes, and snippets.

View vagmi's full-sized avatar

Vagmi Mudumbai vagmi

View GitHub Profile
@vagmi
vagmi / hello.go
Created August 13, 2018 17:21
AS2 (RFC 4130) in Golang
package main
import (
"bytes"
"crypto"
_ "crypto/md5" // for crypto.MD5
_ "crypto/sha1" // for crypto.SHA1
_ "crypto/sha512" // for crypto.SHA384 & 512
"crypto/x509"
"encoding/asn1"

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

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

var enableMultipleViewFolders = function(express) {
var eView= express.get('view');
var lookupProxy = eView.prototype.lookup;
eView.prototype.lookup = function (view) {
if (this.root instanceof Array) {
var opts = {};
var matchedView = null,
roots = this.root;
@vagmi
vagmi / app.js
Created April 1, 2014 22:03 — forked from simme/app.js
// Load Ember into the global scope by requiring it
require('ember');
// Go have fun
var app = Ember.Application.create();
var lib = require("./manifest.js");
lib.mkmanifest({
filename : "cache"
,path : "../coffee"
,version : "02"
,exclude : ['/.DS_Store', '/.htaccess', '/cache.manifest']
/*
,network : ['/connect.php','/read.php']
,fallback : ['/offline.html']
@vagmi
vagmi / oracle.md
Created April 9, 2013 04:28 — forked from dlokesh/oracle.md

Oracle sqls

find all constraints of a table

select * from all_constraints where table_name='TABLE_NAME' and owner='OWNER_NAME';

find all primary keys of a table

SELECT cols.table_name, cols.column_name, cols.position, cons.status, cons.owner
@vagmi
vagmi / index.html
Last active October 11, 2015 19:58 — forked from AgalyaLoganathan/index.html
d3 segment chart
<!doctype html>
<html>
<head>
<title>Segment Graph</title>
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.1.1/css/bootstrap-combined.min.css" rel="stylesheet">
<style>
#segmentChart {
float: left;
width: 400px;
height: 100px;
@vagmi
vagmi / index.html
Created October 17, 2012 15:21 — forked from AgalyaLoganathan/index.html
d3 segment chart
<!doctype html>
<html>
<head>
<title>Segment Graph</title>
<style>
#segmentChart {
width: 400px;
height: 100px;
}
</style>
@vagmi
vagmi / server.rb
Created December 29, 2011 07:30 — forked from dhruvasagar/gist:1532564
Sinatra File Server for serving Videos & Images
$:.unshift File.expand_path("#{File.dirname(__FILE__)}")
APP_ROOT = File.expand_path(File.dirname(__FILE__))
puts APP_ROOT
require 'sinatra'
get '*' do
rpath=File.join(APP_ROOT,params[:splat][0][1..-1])
mimetype = `file -Ib #{rpath}`.gsub(/\n/,"")
puts "serving #{rpath} with mimetype #{mimetype}"
send_file rpath, :stream=>true, :type=>mimetype, :disposition=>:inline