Skip to content

Instantly share code, notes, and snippets.

@shantanusingh
shantanusingh / cors.py
Created September 3, 2014 05:49
CORS enabled SimpleHTTPServer
#! /usr/bin/env python2
from SimpleHTTPServer import SimpleHTTPRequestHandler
import BaseHTTPServer
class CORSRequestHandler (SimpleHTTPRequestHandler):
def end_headers (self):
self.send_header('Access-Control-Allow-Origin', '*')
SimpleHTTPRequestHandler.end_headers(self)
if __name__ == '__main__':
@shantanusingh
shantanusingh / play
Created June 17, 2014 11:56
Play 2 init.d script
#!/bin/bash
# description: UAB Play App
# processname: uab
# chkconfig: 234 20 80
# User running the Play process
USER=ec2-user
USER_HOME=/home/ec2-user
# Java home, add java and play to path
@shantanusingh
shantanusingh / FindJNI.cmake
Last active August 29, 2015 13:57 — forked from emchristiansen/gist:6845954
Cmake FindJNI mod to detect Oracle JDK
# This is a modified version of FindJNI.cmake which lets it work with
# Oracle Java 7 in Ubuntu 13.04.
# The file at /usr/share/cmake-2.8/Modules/FindJNI.cmake should be
# overwritten with this file.
#See http://stackoverflow.com/questions/17636166/cmake-find-packagejni-not-work-in-ubuntu-12-04-amd64
# - Find JNI java libraries.
# This module finds if Java is installed and determines where the
# include files and libraries are. It also determines what the name of
# the library is. This code sets the following variables:
@shantanusingh
shantanusingh / jdk7-on-Amazon AMI
Last active August 29, 2015 13:57 — forked from tankchintan/gist:1335220
Instal JDK7 on Amazon AMI
# First verify the version of Java being used is not SunJSK.
java -version
# Get the latest Sun Java SDK from Oracle http://www.oracle.com/technetwork/java/javase/downloads/jdk-7u1-download-513651.html
wget --no-cookies --no-check-certificate --header "Cookie: oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/7u51-b13/jdk-7u51-linux-x64.tar.gz"
# Rename the file downloaded, just to be nice
mv jdk-7u1-linux-i586.rpm\?e\=1320265424\&h\=916f87354faed15fe652d9f76d64c844 jdk-7u1-linux-i586.rpm
#Untar and move to /usr/java
#!/bin/sh
##
# Install autoconf, automake and libtool smoothly on Mac OS X.
# Newer versions of these libraries are available and may work better on OS X
#
# This script is originally from http://jsdelfino.blogspot.com.au/2012/08/autoconf-and-automake-on-mac-os-x.html
#
export build=~/devtools # or wherever you'd like to build
@shantanusingh
shantanusingh / Tesseract-Amazon-AMI.md
Last active September 19, 2023 10:10
Tesseract on Amazon-AMI

sudo yum update

##Install Redis https://gist.github.com/dstroot/2776679

wget https://raw.github.com/gist/2776679/04ca3bbb9f085b192f6aca945120fe12d59f15f9/install-redis.sh
chmod 777 install-redis.sh
./install-redis.sh

-nosplash
--launcher.defaultAction
openFile
-vm
C:/JDK7/jre/bin/server/jvm.dll #Windows
#/Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/Contents/Home/bin/java #OS X
-vmargs
-Xincgc
-Xss1m
-Duser.name=FirstName LastName
#
# Run as root
# $ bash <(curl -s https://raw.github.com/gist/1631411)
#
# Update, upgrade and install development tools:
apt-get update
apt-get -y upgrade
apt-get -y install build-essential git-core curl \
libssl-dev \
@shantanusingh
shantanusingh / flex-interview-script.md
Created November 15, 2012 10:13
Flex Interview Script

Basic

  • How would you call a javascript method from a Flex App and vice-versa? ( By Using IExternalInterface)

  • Explain the UIComponent lifecycle, including important methods like initialize(), createChildren(), etc. (http://www.billdwhite.com/wordpress/?p=21)

  • Name three different ways to achieve data binding ({} brackets in MXML, BindingUtils, ChangeWatcher)

  • Explain the bubbling and capturing phases in event model in Flash. Explain what a weak-referenced event listener is and why you'd use it. (http://livedocs.adobe.com/flex/3/html/help.html?content=events_08.html)

@shantanusingh
shantanusingh / gist:3274335
Created August 6, 2012 13:06 — forked from rolo/gist:1481128
Install Postgres 9.1, PostGIS and create PostGIS template on Ubuntu 11.10 Oneiric Ocelot
#!/bin/bash
#
# Install Postgres 9.1, PostGIS and create PostGIS template on a clean Ubuntu 11.10 Oneiric Ocelot box
# http://wildfish.com
# add the ubuntu gis ppa
sudo apt-get -y install python-software-properties
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get update