Skip to content

Instantly share code, notes, and snippets.

View matthewhughes's full-sized avatar

Matthew Hughes matthewhughes

View GitHub Profile
@matthewhughes
matthewhughes / gist:3334289
Created August 12, 2012 20:37
MeekroDB Configuration
public static $dbName = '';
public static $user = '';
public static $password = '';
public static $host = '';
public static $port = null;
public static $encoding = 'latin1';
$artist = "The Verve Pipe";
$query = DB::query("SELECT * FROM Albums WHERE artist=%s", $artist);
$artist = "Amber Rubarth";
$album = "A Common Case Of Disappearing";
DB::insert('Albums' array(
"Artist" => $artist,
"Album" => $album));
$artist = "Nickelback";
DB::delete('Albums', "Artist=%s", $artist);
@matthewhughes
matthewhughes / Iterate.java
Created April 9, 2013 17:21
GrotesqueMethod
public static void IterateThroughList(List<String> Items, String FileName){
String[] ByteCode = null;
String Value;
for(String S : Items){
ByteCode = S.split(":");
System.out.println(ByteCode[0]);
OpCodes OP = new OpCodes(); //pan gangnam style
FileWrite FW = new FileWrite();
if(ByteCode[0].equals("ADD")){
public static void IterateThroughList(List<String> Items, String FileName){
String[] ByteCode = null;
String Value;
for(String S : Items){
ByteCode = S.split(":");
ByteCode[0] = ByteCode[0].replace(":", "");
System.out.println("Length: " + ByteCode[0].length() + ":" + ByteCode[0] + ":");
OpCodes OP = new OpCodes(); //pan gangnam style
FileWrite FW = new FileWrite();
from flickrapi import FlickrAPI, shorturl
import scraperwiki
API_KEY = "REDACTED"
flickr = FlickrAPI(API_KEY)
if __name__ == '__main__':
main()
def main():
favs = flickr.walk(tags="kittens", extras="geo")
for photo in favs:
if photo.get('latitude') != '0':
title = photo.get('title')
latitude = float(photo.get('latitude'))
longitude = float(photo.get('longitude'))
url = shorturl.url(photo.get('id'))
identity = photo.get('id')
submit_to_scraperwiki(identity, title, latitude, longitude, url)
def submit_to_scraperwiki(identity, title, latitude, longitude, url):
result = {"id" : identity, "title" : title, "latitude" : latitude, "longitude" : longitude, "url" : url}
scraperwiki.sqlite.save(UNIQUE_KEYS, result, 'kittens')