Skip to content

Instantly share code, notes, and snippets.

@qingfeng
qingfeng / gist:874415
Created March 17, 2011 14:31
Processing Bubble Game
import hypermedia.video.*; // Imports the OpenCV library
OpenCV opencv; // Creates a new OpenCV object
PImage movementImg; // Creates a new PImage to hold the movement image
int poppedBubbles; // Creates a variable to hold the total number of popped bubbles
ArrayList bubbles; // Creates an ArrayList to hold the Bubble objects
PImage bubblePNG; // Creates a PImage that will hold the image of the bubble
PFont font; // Creates a new font object
void setup()
@vickychijwani
vickychijwani / ai-class.py
Created November 12, 2011 10:37 — forked from sumodx/ai-class.py
Download lecture videos of ai-class, with HTTP proxy and basic resume support
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = "Deepak.G.R."
__credits__ = "Sumod Hajela"
__license__ = 'Public Domain'
"""
usage:
Go to command line and type
@pala
pala / navigation.js
Created January 16, 2012 08:10
jquery keyboard navigation
$(function(){
$(document).keydown(function(e) {
var url = false;
if (e.which == 37 || e.which == 74) { // Left arrow and J
{% if page.previous %}
url = '{{page.previous.url}}';
{% endif %}
}
else if (e.which == 39 || e.which == 75) { // Right arrow and K
{% if page.next %}
@yoggy
yoggy / find_large_contour_center_of_gravity.cpp
Created February 6, 2012 08:32
find large contour & calculate center of gravity sample code using OpenCV2
bool find_large_contour_center_of_gravity(cv::Mat &src_img, cv::Point &result)
{
cv::Mat gray_img, bin_img, erode_img, dilate_img;
std::vector<std::vector<cv::Point> > contours;
int max_area = 0;
std::vector<cv::Point> large_contour;
std::vector<cv::Point> convex_hull;
// convert to grayscale
cv::cvtColor(src_img, gray_img, CV_BGR2GRAY);
@hrldcpr
hrldcpr / tree.md
Last active January 6, 2025 22:43
one-line tree in python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

@erikreagan
erikreagan / mac-apps.md
Created August 4, 2012 19:18
Mac developer must-haves

Mac web developer apps

This gist's comment stream is a collection of webdev apps for OS X. Feel free to add links to apps you like, just make sure you add some context to what it does — either from the creator's website or your own thoughts.

— Erik

@ninehills
ninehills / check_google_ip.py
Created August 25, 2012 10:37
check_google_ip
#!/usr/bin/env python
# coding:utf-8
import sys
import os
import re
import gevent
import gevent.monkey
import gevent.timeout
gevent.monkey.patch_all()
`
// vim: nowrap
// Copyright (c) 2013, smilekzs. (MIT Licensed)
// ==UserScript==
// @name renren-markdown
// @namespace http://github.com/smilekzs
// @version 0.4.15
// @description write well-formatted blogs on renren.com with markdown
// @include *blog.renren.com/blog/*Blog*
// @include *blog.renren.com/*Entry*
@tonyseek
tonyseek / deliver-solidot.sh
Last active December 19, 2015 14:58
Solidot 日报
#!/usr/bin/env bash
deliver_target=([email protected] [email protected])
smtp_account="[email protected]"
smpt_password="******"
issue_archive_dir="/srv/ebook-deliver/archives"
issue_name="solidot-$(date +%Y%m%d)"
@justjavac
justjavac / getAddressList_QQ.js
Last active October 18, 2020 07:27
获取QQ群通讯录
var ids = document.querySelectorAll(".member_id");
var names = document.querySelectorAll(".member_name");
var output = "", length = ids.length;
for(var i=0; i<length; i++){
output += ids[i].innerHTML.slice(1,-1) + ":" + names[i].innerHTML + "\n";
}
console.log(output);