Skip to content

Instantly share code, notes, and snippets.

@whichlight
whichlight / found_recorder.py
Created June 18, 2011 15:58
Pulling images from an RSS feed
'''
a simple script to pull some inspiring images
test
kawandeep virdee
@kawantum
'''
import xml.dom.minidom as XML
import urllib2 as URL
@whichlight
whichlight / ami_scraper.py
Created June 25, 2011 01:03
scraper wiki scraper for the access to medicine index
import scraperwiki
import lxml.html
import re
html = scraperwiki.scrape("http://www.accesstomedicineindex.org/content/index-2010-0")
root = lxml.html.fromstring(html)
data = {}
table = root.cssselect("tbody")[0]
for tr in table.cssselect("tr"):
@whichlight
whichlight / mobile_movie_convert.sh
Created October 1, 2011 05:32
convert all .3gp to .mp4 in a directory
#!/bin/bash
#the video recordings in my phone are in .3gp
#so i wrote this to convert .3GP to .mp4
#
#http://whichlight.com/blog/mobile-video-recording-convert-from-3gp-to-mp4/
LIST=`ls *.3gp`
for i in $LIST;
do ffmpeg -i $i -sameq -ab 64k -ar 44100 ${i%3gp}mp4
done
@whichlight
whichlight / gridvector.pde
Created January 4, 2012 06:51
Basic processing sketch to simulate a 3D environment, simple interactivity with mouse
//grid of arrows directed by mouse
//Kawandeep Virdee
//interesting things happen when you change the direction of the
// vector that is the difference between the mouse and the point.
PVector[][] grid;
int width=400;
int height=500;
@whichlight
whichlight / flask-tweepy-server.py
Created June 6, 2012 03:50
gist of the server script with tweepy oauth
'''
flask-tweepy-oauth
an example showing how to authorize a twitter application
in python with flask and tweepy.
find the rest of the app here: https://github.com/whichlight/flask-tweepy-oauth
'''
@whichlight
whichlight / node-scraper-example.js
Created June 17, 2012 02:20
example code for a blog post on scraping with ndoe
//see whichlight.com/blog/writing-a-web-scraper-over-http-with-nodejs for details
app.get('/pullstagram/:link?', function(req,res){
url = req.params.link;
console.log(url);
request(url,function(err,response,body){
if (!err && response.statusCode == 200) {
var window = jsdom(body).createWindow(),
$ = require('jquery').create(window);
var val = $('.photo').attr('src');
@whichlight
whichlight / firebase-accelerometer
Created June 24, 2012 02:55
playing around with accelerometer stuff in firebase
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<script type='text/javascript' src='http://static.firebase.com/demo/firebase.js'></script>
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js'></script>
@whichlight
whichlight / like-bomb.js
Created July 13, 2012 04:27
client side programmatic "liking" on facebook
/*
This code will click like's currently loaded
on a facebook page. It's likely in the future
the name of the classes may change.
Be careful though, if you do too many at once
you'll get a warning.
To use this copy and paste it to your browser's
javascript console, or add javascript: to the
@whichlight
whichlight / twilio-snippet.py
Created August 7, 2012 03:51
twilio snippet, using get and post
from flask import Flask
import flask
from twilio.rest import TwilioRestClient
import re
import random
import twilio.twiml
import os
'''
A snippet of a twilio app, using GET and POST
@whichlight
whichlight / rangefinder_hcsr04.ino
Created September 23, 2012 15:49
rangefinder code hc-sr04
int pingPin = 13;
int inPin = 12;
void setup() {
Serial.begin(9600);
}
void loop()
{
// establish variables for duration of the ping,