Skip to content

Instantly share code, notes, and snippets.

@hfeeki
hfeeki / install_oracle_jdk.sh
Last active January 1, 2016 04:49
Install oracle jdk6/7
#!/bin/bash
# installing oracle jdk6/7 on ubuntu's
sudo apt-get install -y python-software-properties
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install -y oracle-java6-installer
sudo apt-get install -y oracle-java7-installer
import cv2
import cv2.cv as cv
def detect(img, cascade_fn='haarcascades/haarcascade_frontalface_alt.xml',
scaleFactor=1.3, minNeighbors=4, minSize=(20, 20),
flags=cv.CV_HAAR_SCALE_IMAGE):
cascade = cv2.CascadeClassifier(cascade_fn)
rects = cascade.detectMultiScale(img, scaleFactor=scaleFactor,
# Installing OpenCV python libs on mac to work with virtualenv
# OpenCV 2.4.3
# Python 2.7.3 installed with brew
# assuming you have virtualenv, pip, and python installed via brew
# assuming $WORKON_HOME is set to something like ~/.virtualenvs
# using homebrew - make sure we're current
brew update
@philipcristiano
philipcristiano / faces_example.py
Created June 18, 2013 14:10
Resize and crop an image based on OpenCV detected faces
import sys
from PIL import Image, ImageDraw
try:
import cv
except ImportError:
print 'Could not import cv, trying opencv'
import opencv.cv as cv
@mike-zhang
mike-zhang / udpProxyServer.cpp
Created October 14, 2012 15:32
a simple udp proxy server (cpp code)
/*
File : udpProxyServer.cpp
Author : Mike
E-Mail : Mike_Zhang@live.com
*/
#include <cstdlib>
#include <cstddef>
#include <iostream>
#include <string>
#include <boost/shared_ptr.hpp>
@minikomi
minikomi / server.go
Created June 13, 2012 08:33
random go from golang
package main
import (
"fmt"
"net/http"
)
func broadcaster(in chan chan string, out chan chan string, listen chan string) {
chans := map[chan string]bool{}
for {
@koostudios
koostudios / main.coffee
Created May 5, 2012 08:32
BrowserID: Logging in with BrowserID, Passport and NodeJS
# Variables
exp = require 'express'
app = exp.createServer()
pass = require 'passport'
BrowserID = require('passport-browserid').Strategy
# Passport Serialize and Deserialize Functions
pass.serializeUser (user, done) ->
done null, user.email
@codysoyland
codysoyland / virtualenv-auto-activate.sh
Created March 25, 2012 18:34
virtualenv-auto-activate
#!/bin/bash
# virtualenv-auto-activate.sh
#
# Installation:
# Add this line to your .bashrc or .bash-profile:
#
# source /path/to/virtualenv-auto-activate.sh
#
# Go to your project folder, run "virtualenv .venv", so your project folder
# has a .venv folder at the top level, next to your version control directory.
@klange
klange / image-to-ansi.py
Created January 27, 2012 06:29 — forked from MicahElliott/colortrans.py
Convert images to ANSI escape sequences
#! /usr/bin/env python
""" Convert an image (argv[1]) to an ANSI text string (xterm-256color)
Original readme from colortrans.py follows:
Nice long listing of all 256 colors and their codes. Useful for
developing console color themes, or even script output schemes.
Resources:
@wardbekker
wardbekker / .erlang
Created August 8, 2011 06:41
Autoloading of modules
%% autoload all modules that are in the code:path() and reside in the user directory
%% put in ~/.erlang
[code:ensure_loaded(list_to_atom(filename:rootname(filename:basename(F))))
|| P <- lists:filter(fun(Path) -> string:str(Path, os:getenv("USER")) > 0 end, code:get_path()), F <- filelib:wildcard(P ++ "/*.beam")].