This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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!"); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# analog_test_simple.py by Owen Mundy | |
# modified from: | |
# analog_test.py - Alexander Hiam | |
# Testing analogRead() | |
# | |
# *** NOTICE *** | |
# The maximum ADC input voltage is 1.8v, | |
# applying greater voltages will likely cause | |
# permanent damage to the ADC module! | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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(): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* analog-read-all.js | |
* Use bonescript and node.js to read from all analog pins on a BeagleBone | |
* Found in the wild: | |
* https://groups.google.com/forum/#!msg/beagleboard/rftH6aqyR5k/n7jQbCNAL3YJ | |
*/ | |
var bb = require('./bonescript'); | |
var sys = require('util'); | |
var fs = require('fs'); |
OlderNewer