Skip to content

Instantly share code, notes, and snippets.

@sujithrs
sujithrs / face_detect.py
Created December 28, 2015 02:04 — forked from 46bit/face_detect.py
Face detection using OpenCV. Refactored from https://realpython.com/blog/python/face-recognition-with-python/.
import sys, cv2
# Refactored https://realpython.com/blog/python/face-recognition-with-python/
def cascade_detect(cascade, image):
gray_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
return cascade.detectMultiScale(
gray_image,
scaleFactor = 1.15,
minNeighbors = 5,
@sujithrs
sujithrs / How_to_use.html
Created October 13, 2015 16:55 — forked from jcgregorio/How_to_use.html
HTML Templating using the HTML <template> element and exactly 100 lines of JS.
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="utf-8" />
<script src="templating.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<template id=t>
@sujithrs
sujithrs / events.js
Last active August 29, 2015 14:27 — forked from findjashua/events.js
Get streams for interaction & mutation events
import {Observable} from 'rx';
import {DOM} from 'rx-dom';
import {toArray, getNodesFromSelector} from './utils';
let interactions_ = {
'click': Observable.fromEvent(document.body, 'click')
}
let mutations_ = DOM
#! /usr/bin/env python
from boto.ses.connection import SESConnection
import os
import sys
import subprocess
import socket
TMPFILE = '/var/run/postgresql/last-wal-archive-error-file.tmp'
if __name__ == '__main__':
#! /usr/bin/env python
import redis
import random
import pylibmc
import sys
r = redis.Redis(host = 'localhost', port = 6389)
mc = pylibmc.Client(['localhost:11222'])
# pryrc helper for http
def http_get(url)
Net::HTTP.get URI.parse(url)
end
def http_headers(url)
uri = URI.parse(url)
Net::HTTP.get_response(uri).each_header {|x| x}
end
#!/bin/bash
####################################
# BASIC REQUIREMENTS
# http://graphite.wikidot.com/installation
# Forked from: http://geek.michaelgrace.org/2011/09/how-to-install-graphite-on-ubuntu/
# Ubuntu 11.10 Oneiric Ocelot
# Forked from https://gist.github.com/1287170
# Modified to use NGinx + uwsgi instead of Apache, as well as memcached and supervisord, incorporating ideas from
# http://blog.adku.com/2011/10/scalable-realtime-stats-with-graphite.html
@sujithrs
sujithrs / gist:3098028
Created July 12, 2012 13:14 — forked from mikeyk/gist:1329319
Testing storage of millions of keys in Redis
#! /usr/bin/env python
import redis
import random
import pylibmc
import sys
r = redis.Redis(host = 'localhost', port = 6389)
mc = pylibmc.Client(['localhost:11222'])
#! /usr/bin/env python
import fileinput
import argparse
from operator import itemgetter
parser = argparse.ArgumentParser()
parser.add_argument('--target-mb', action = 'store', dest = 'target_mb', default = 61000, type = int)
parser.add_argument('vmtouch_output_file', action = 'store', nargs = '+')
args = parser.parse_args()
@sujithrs
sujithrs / app.rb
Created March 24, 2012 03:22 — 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")