Skip to content

Instantly share code, notes, and snippets.

View omundy's full-sized avatar

Owen Mundy omundy

View GitHub Profile
/**
* Simple animation to illustrate Processing.org HD video export using FFmpeg
* See this post for complete details
* http://owenmundy.com/blog/2013/01/use-processing-and-ffmpeg-to-export-hd-video/
* 2013 Owen Mundy owenmundy.com
*/
float xtheta = 0.0;
float ytheta = 0.0;
@omundy
omundy / scraper_weather_regex.php
Created May 16, 2011 12:01
Advanced scraping demo with "regex" parsing
<?php
/* Advanced scraping demo with "regex" parsing. Retrieves current
* weather in any city and colors the background accordingly.
* The math below for normalization could use some work.
* Owen Mundy Copyright 2011 GNU/GPL */
?>
<html>
@omundy
omundy / scraper_bbc_regex_title.php
Created May 16, 2011 11:45
Basic scraping demo with "regex" parsing
<?php
/* Basic scraping demo with "regex" parsing
* Owen Mundy Copyright 2011 GNU/GPL */
$url = "http://www.bbc.co.uk/news/"; // 0. url to start with
$contents = file_get_contents($url); // 1. get contents of url in a string
// 2. match title
@omundy
omundy / scraper_bbc_find-replace.php
Created May 16, 2011 11:20
Basic scraping demo with "find-replace" parsing
<?php
/* Basic scraping demo with "find-replace" parsing
* Owen Mundy Copyright 2011 GNU/GPL */
$url = "http://www.bbc.co.uk/news/"; // 0. url to start with
$contents = file_get_contents($url); // 1. get contents of page in a string
// 2. search and replace contents
@omundy
omundy / scraper_bbc_foreach.php
Created May 16, 2011 11:41
Basic scraping demo with "foreach" parsing
<?php
/* Basic scraping demo with "foreach" parsing
* Owen Mundy Copyright 2011 GNU/GPL */
$url = "http://www.bbc.co.uk/news/"; // 0. url to start with
$lines = file($url); // 1. get contents of url in an array
foreach ($lines as $line_num => $line) // 2. loop through each line in page
@omundy
omundy / scraper_bbc_regex.php
Created May 16, 2011 11:54
Basic scraping demo with "foreach" and "regex" parsing
<?php
/* Basic scraping demo with "foreach" and "regex" parsing
* Owen Mundy Copyright 2011 GNU/GPL */
// url to start
$url = "http://www.bbc.co.uk/news/";
// get contents of url in an array
$lines = file($url);
@omundy
omundy / hello.pde
Created September 11, 2011 02:52
Hello World file for Processing or Processing.js
// Hello World file for Processing or Processing.js
void setup(){
size(1000,700);
background(255);
}
void draw(){
stroke(random(255),random(255), random(255));
line(random(width),random(height), random(width),random(height));
println("Hello World!");
}
@omundy
omundy / analog-test-all-pins.py
Created May 17, 2012 12:46
BeagleBone test and print all analog-in pins
# analog-test-all-pins.py - Owen Mundy
# Print reading from each analog-in pin on a BeagleBone
# with a short delay between each
# This example is in the public domain
import os,time
i = 1
while(True):
os.system("cat /sys/bus/platform/devices/tsc/ain" + str(i))
@omundy
omundy / analog-test-all-pins.py
Created May 17, 2012 15:10
Print reading from each analog-in pin on a BeagleBone using mrBBIO
# analog-test-all-pins.py - Owen Mundy
# Print reading from each analog-in pin on a BeagleBone
# with a short delay between each
# using mrBBIO by Matt Richardson:
# https://github.com/mrichardson23/mrBBIO
# This example is in the public domain
from mrbbio import *
def setup():
@omundy
omundy / fb_rank_bookmarklet
Last active December 28, 2015 03:39
How Facebook ranks all your friends bookmarklet (modified from Arjun Sreedharan's)
javascript: (function () {
function creator(e, t, n) {
var r = document.createElement(n);
var att = document.createAttribute("style");
att.value = "max-width:120px";
r.setAttributeNode(att);
var i = document.createTextNode(t);
r.appendChild(i);
e.appendChild(r);
}