Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
#
# Copyright 2013 Joseph Bowman
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@joerussbowman
joerussbowman / gist:3886640
Created October 13, 2012 23:50
working on a motion detection script for my camera
import os
import sys
import time
import Image
import base64
import urllib
import urllib2
import datetime
import cStringIO
import ImageChops
@joerussbowman
joerussbowman / gist:3639754
Created September 5, 2012 16:48
apache parsing script
package main
import (
"bufio"
"bytes"
"compress/gzip"
"flag"
"fmt"
"io"
"log"
@joerussbowman
joerussbowman / gist:1586593
Created January 10, 2012 02:56
direction I am thinking for auth.py in tornado
import binascii
import hashlib
import hmac
import logging
import time
import urllib
import urlparse
import uuid
from tornado import httpclient
@joerussbowman
joerussbowman / gist:1295709
Created October 18, 2011 15:28
YoutubeMixin
class YoutubeMixin(OAuth10aMixin):
""" To authenticate with Youtube, register your application with Google.
See http://code.google.com/apis/accounts/docs/RegistrationForWebAppsAuto.html
Then copy your Consumer Key and Consumer Secret to the application settings
'google_consumer_key' and 'google_consumer_secret'. Use this Mixin on the
handler for the URL you registered as your application's Callback URL.
When your application is set up, you can use this Mixin like this
to authenticate the user with Twitter and get access to their stream:
@joerussbowman
joerussbowman / gist:1295578
Created October 18, 2011 14:35
modified authdemo using Google oauth
#!/usr/bin/env python
#
# Copyright 2009 Facebook
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@joerussbowman
joerussbowman / gist:1176002
Created August 27, 2011 23:29
Tornado Twitter Stream
# not pretty, I quickly moved to another idea
# not involving the Twitter stream. Good starting
# point.
import re
import base64
import socket
import asyncmongo
from tornado import ioloop
from tornado import iostream
@joerussbowman
joerussbowman / urltester.rb
Created May 3, 2011 19:42
My first ruby script, checks vanity url redirects
require 'net/http'
require 'uri'
if ARGV.length < 2
puts "Syntax: urltest.rb [ redirects file ] [host ] (optional 1 for external redirects)"
puts "example for local redirects: urltest.rb vanity_urls.txt www.example.com"
exit
end
if File.exists?(ARGV[0])
@joerussbowman
joerussbowman / gist:781383
Created January 15, 2011 23:54
Example yui3 autocomplete using yql
<input type="text" name="q" id="q" />
<script type="text/javascript">
YUI().use("autocomplete", "autocomplete-highlighters", "datasource-get", function (Y) {
var acDS = new Y.DataSource.Get({
source: "http://sugg.search.yahoo.com/gossip-us-fp/?nresults=10&queryfirst=2&output=json&version=&command=",
});
Y.one('#q').plug(Y.Plugin.AutoComplete, {
maxResults: 10,
resultHighlighter: 'phraseMatch',
@joerussbowman
joerussbowman / gist:739514
Created December 13, 2010 20:02
YQL console output
--- local.search results
<?xml version="1.0" encoding="UTF-8"?>
<query xmlns:yahoo="http://www.yahooapis.com/v1/base.rng"
yahoo:count="0" yahoo:created="2010-12-13T20:02:06Z" yahoo:lang="en-US">
<diagnostics>
<publiclyCallable>true</publiclyCallable>
<url execution-time="40" http-status-code="503" http-status-message="Service Unavailable"><![CDATA[http://local.yahooapis.com/LocalSearchService/V3/localSearch?zip=94085&query=pizza&start=1&results=10]]></url>
<user-time>62</user-time>
<service-time>40</service-time>