Skip to content

Instantly share code, notes, and snippets.

View ashee's full-sized avatar

Amitava Shee ashee

View GitHub Profile
@ashee
ashee / _notes.md
Created February 17, 2012 20:36 — forked from mislav/_notes.md
Install MongoDB using Homebrew and set it up for your user on OS X

This gist is outdated

Homebrew people have since included this in a recipe.

$ brew update
$ brew install mongodb

( follow the instructions given )

@ashee
ashee / install-pygtk.sh
Created February 29, 2012 14:45 — forked from ches/install-pygtk.sh
Install PyGTK via Homebrew and virtualenv
# This LOOKS pretty straightforward, but it took awhile to sort out issues with
# py2cairo and pygobject, so I hope I've saved you some time :-)
#
# This assumes you already subscribe to a nice clean virtualenvwrapper workflow
# -- see https://gist.github.com/771394 if you need advice on getting there.
# There are some optional dependencies omitted, so if you're going to be doing
# heavy development with these libs, you may want to look into them.
#
# We go to some configure option pains to avoid polluting the system-level
# Python, and `brew link`ing Cairo which is keg-only by default.
@ashee
ashee / minscalaactors.scala
Created April 12, 2012 12:53 — forked from viktorklang/minscalaactors.scala
Minimalist Scala Actors
©2012 Viktor Klang
object Actor {
object Ops { // Actor Behavior results
sealed trait Op
case object Stay extends Op
case class Become(b: Any => Op) extends Op
case object Die extends Become( // Mandatory for this all to work, but it's convenient
msg => { println("Dropping msg [" + msg + "]for " + this + " due to severe case of death."); Stay } // Stay Dead plz
@ashee
ashee / app.rb
Created May 2, 2012 06:58 — forked from cpatni/app.rb
unique calculation using redis
require 'sinatra'
require 'redis'
require 'json'
require 'date'
class String
def &(str)
result = ''
result.force_encoding("BINARY")
@ashee
ashee / .gitconfig
Created July 20, 2012 11:10 — forked from orj/.gitconfig
Using p4merge as Git mergetool on Mac OS X.
[merge]
keepBackup = false
tool = custom
[mergetool "custom"]
cmd = /Applications/p4merge.app/Contents/Resources/launchp4merge "$PWD/$BASE" "$PWD/$REMOTE" "$PWD/$LOCAL" "$PWD/$MERGED"
keepTemporaries = false
trustExitCode = false
keepBackup = false
@ashee
ashee / javascript_background_thread.js
Created September 18, 2012 20:04 — forked from jameswomack/javascript_background_thread.js
Extend function prototype to run a function as a WebWorker
Function.prototype.runOnBackgroundThread = function (aCallback) {
var _blob = new Blob(['onmessage = '+this.toString()],{"type":"text/javascript"});
var _worker = new Worker((webkitURL.createObjectURL || URL.createObjectURL)(_blob));
_worker.onmessage = aCallback;
_worker.postMessage();
}
var _test = function () {
postMessage((1+1).toString());
}
@ashee
ashee / gist:4207897
Created December 4, 2012 19:41 — forked from ae6rt/gist:3697746
The four ways to deploy a webapp to Tomcat
There are four different ways one can deploy a webapp to Tomcat. If TCHOME is the Tomcat top-level directory:
* Copy the war file foo.war or exploded war directory to TCHOME/webapps
* Create a context file context.xml in the webapp’s META-INF/ directory that contains a <Context> fragment that describes the webapp deployment
* Add a <Context> element to the <Host> element in Tomcat’s server.xml that describes the webapp deployment, including docBase. docBase is a <Context> attribute that locates the war file or exploded war directory in the filesystem.
* Create a context file foo.xml in TCHOME/conf/Catalina/localhost/foo.xml that contains a <Context> fragment that describes the webapp deployment, including docBase.
The first two methods do not provide the freedom to name the servlet context independent of file system names for the war file or exploded war directory, whereas the last two do. Of the two methods that provide control over context naming, the most appealing is the use of a context file foo.xml p
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Starter Template</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<!-- styles -->
@ashee
ashee / git-send-email.md
Last active December 20, 2015 14:39 — forked from jasonkarns/readme.md
  1. Configure Gmail in you gitconfig:
[sendemail]
  smtpserver = smtp.gmail.com
  smtpserverport = 587
  smtpencryption = tls
  smtpuser = <gmail email address>
  from = <email address for From: field>
@ashee
ashee / libreswan_setup.sh
Last active August 29, 2015 14:25 — forked from rosstimson/libreswan_setup.sh
Libreswan VPN setup script.
#!/bin/bash -ex
# Set some local variables
PRIVATE_IP=`curl -s http://169.254.169.254/latest/meta-data/local-ipv4`
PUBLIC_IP=`curl -s http://169.254.169.254/latest/meta-data/public-ipv4`
VPN_DNSHOST=`grep -o "nameserver.*" /etc/resolv.conf | awk '{print $2}'`
yum install -y libreswan ppp xl2tpd
# Setup IPSEC Tunnel