Skip to content

Instantly share code, notes, and snippets.

@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
@willurd
willurd / web-servers.md
Last active May 14, 2025 19:48
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
# coding=UTF-8
import nltk
from nltk.corpus import brown
# This is a fast and simple noun phrase extractor (based on NLTK)
# Feel free to use it, just keep a link back to this post
# http://thetokenizer.com/2013/05/09/efficient-way-to-extract-the-main-topics-of-a-sentence/
# Create by Shlomi Babluki
# May, 2013
@gnarf
gnarf / ..git-pr.md
Last active January 27, 2025 01:56
git pr - Global .gitconfig aliases for Pull Request Managment

Install

Either copy the aliases from the .gitconfig or run the commands in add-pr-alias.sh

Usage

Easily checkout local copies of pull requests from remotes:

  • git pr 4 - creates local branch pr/4 from the github upstream(if it exists) or origin remote and checks it out
  • git pr 4 someremote - creates local branch pr/4 from someremote remote and checks it out
@ricardoalcocer
ricardoalcocer / app.js
Last active September 3, 2021 14:43
Appcelerator Titanium Android Background Service
// start service
var SECONDS = 20; // every 10 seconds
var intent = Titanium.Android.createServiceIntent({
url: 'logservice.js'
});
intent.putExtra('interval', SECONDS * 1000); // Needs to be milliseconds
Titanium.Android.startService(intent);
@davej
davej / basecamp-todos-to-blimp-goals.py
Created January 22, 2013 20:17
A simple script to copy a Basecamp classic todo list over to Blimp as a goal with tasks
"""
A simple script to copy a Basecamp classic todo list
over to Blimp as a goal with tasks
@author: Dave Jeffery
@requirements:
pip install git+git://github.com/nowherefarm/basecamp.git
pip install blimp
"""
@ricardoalcocer
ricardoalcocer / blimp_test.js
Last active December 11, 2015 05:29
Usage of the Blimp Client Library for Titanium
//
var apiAccessData={
user_name:'your_user_name_here',
api_key:'your_api_key_here',
base_url:'https://app.getblimp.com/api/v2',
app_id:'815e71539d113d681e3a365b96ddd1984ca8955a'
}
//
//
@Bpless
Bpless / shell_plus_reloader.py
Last active June 5, 2018 11:40
Shell_Plus reloader thread
class ReloaderEventHandler(FileSystemEventHandler):
"""
Listen for changes to modules within the Django project
On change, reload the module in the Python Shell
Custom logic required to reload django models.py modules
Due to the singleton AppCache, which caches model references.
For those models files, we must clear and repopulate the AppCache
"""
def __init__(self, *args, **kwargs):
@brentjanderson
brentjanderson / adapter.js
Last active October 23, 2019 19:12
NOTE: Not updated since early 2013 - likely will not work with modern EmberData. Ember.JS, ember-data, and socket.io adapter. Not as primitive as the initial version and it supports object creation/deletion/etc. Does not support bulk updates like the first one just to keep it simple. Does support ember-data revision 11 and does support queries/f…
/*jshint browser:true */
/*global DS:true, io:true, App:true */
(function() {
'use strict';
// Initializer for Models
window.Models = {};
console.warn("Don't pollute the global namespace with Models!");
@ndarville
ndarville / business-models.md
Last active February 27, 2025 10:00
Business models based on the compiled list at http://news.ycombinator.com/item?id=4924647. I find the link very hard to browse, so I made a simple version in Markdown instead.

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google