Skip to content

Instantly share code, notes, and snippets.

View vagmi's full-sized avatar

Vagmi Mudumbai vagmi

View GitHub Profile
# Increase system IP port limits to allow for more connections
net.ipv4.ip_local_port_range = 2000 65000
net.ipv4.tcp_window_scaling = 1
# number of packets to keep in backlog before the kernel starts dropping them
net.ipv4.tcp_max_syn_backlog = 3240000
# increase socket listen backlog
net.core.somaxconn = 65536
net.ipv4.tcp_max_tw_buckets = 1440000
@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();
@vagmi
vagmi / .vimrc
Created July 23, 2014 08:52
My latest lean vimrc config
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
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;

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 guid = (function() {
function s4() {
return Math.floor((1 + Math.random()) * 0x10000)
.toString(16)
.substring(1);
}
return function() {
return s4() + s4() + '-' + s4() + '-' + s4() + '-' +
s4() + '-' + s4() + s4() + s4();
};
@vagmi
vagmi / clickndraw.elm
Created October 23, 2014 17:10
First Elm experiment
import Mouse
import Window
relativeMouse : (Int, Int) -> (Int, Int) -> (Int, Int)
relativeMouse (dimx, dimy) (x, y) = let (cx, cy) = center (dimx, dimy)
in (x - cx, cy - y)
center : (Int, Int) -> (Int, Int)
center (x, y) = ( x//2, y//2)
import Window
logoBlue:Color
logoBlue=rgb 96 181 204
logoGrey:Color
logoGrey=rgb 90 99 120
logoYellow:Color
logoYellow=rgb 239 165 0
import Window
import Mouse
relativem : (Int,Int) -> (Int,Int) -> (Float,Float)
relativem (w,h) (x,y) = (toFloat (x-(w//2)), toFloat ((h//2)-y))
type Bullet = {posX: Float, posY: Float, vel: Float}
defaultBullet = {posX=0, posY=-180.0, vel=5}
type GameState = {bullets: [Bullet]}