Skip to content

Instantly share code, notes, and snippets.

View JT5D's full-sized avatar
💭
Multiversing...

JT5D JT5D

💭
Multiversing...
View GitHub Profile
@kellishaver
kellishaver / slideshow
Created February 17, 2009 06:45
A very simple jQuery slideshow.
// -----------------------------------------------------------------
// A very simple jQuery slideshow. It requires a little more work
// on the part of the user, but this keeps the transition code tiny.
// -----------------------------------------------------------------
// CSS
// -----------------------------------------------------------------
#slideshow { width:200px; height:200px; }
.hidden { display:none; }
// -----------------------------------------------------------------
@blech
blech / fetch_tumblr.py
Last active August 30, 2015 00:25
A hackish Tumblr backup tool
#!/usr/bin/python
# this script will fetch all your Tumblr posts into a single big JSON file
# TODO- authenticate (fetch private posts)
# TODO- fetch referenced media?
import urllib2
import simplejson as json
start = 0
@blech
blech / fetch_twitter.py
Last active August 30, 2015 00:25
See /blech/mytweets
#!/usr/bin/python
# Incredibly cackhanded Twitter backup. Needs *lots* of work.
import urllib2
import simplejson as json
import base64
page = 1
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE grammar PUBLIC "-//W3C//DTD GRAMMAR 1.0//EN" "http://www.w3.org/TR/speech-grammar/grammar.dtd">
<grammar xmlns="http://www.w3.org/2001/06/grammar"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/2001/06/grammar
http://www.w3.org/TR/speech-grammar/grammar.xsd"
xml:lang="en-US"
version="1.0"
root="command"
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<script id="shader-fs" type="x-shader/x-fragment">
void main() {
gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
}
</script>
@blech
blech / flickr-download-set.py
Last active August 30, 2015 01:54
download a set from Flickr
<<<<<<< Updated upstream
#!/usr/bin/python
import flickrapi # http://stuvel.eu/projects/flickrapi
import json as simplejson
import urllib2
api_key = ''
api_secret = ''
photoset_id = ''
<script type="text/javascript">
var since = '<%= @since.to_f %>';
var updater = setInterval( function() {
new Ajax.Updater('notes','/poller', {
method:'get',
parameters:"since="+since,
insertion:'top',
onSuccess:function(r) { since = r.responseText; }
})
}, 4000);
"""
Fetch people for Twitalyzer's mechanical turk. Will fetch and submit
Twitalyzer turk people forever with DELAY seconds between each pull.
Hit Ctrl-C (OSX, Linux) or Ctrl-D (Windows) to stop.
To use, just run:
> python twitalizer_turk.py
@blech
blech / baseconv.py
Created April 13, 2009 13:54
Flickr rev-canonical reverse engineering
"""
Convert numbers from base 10 integers to base X strings and back again.
Sample usage:
>>> base20 = BaseConverter('0123456789abcdefghij')
>>> base20.from_decimal(1234)
'31e'
>>> base20.from_decimal('31e')
1234
from PIL import Image, ImageColor, ImageDraw
import itertools
im = Image.open("real.jpg")
pix = im.load()
draw = ImageDraw.Draw(im)
def colorTargetMatch(c):
if c[0] < 235 and c[0] > 192: #red
if c[1] < 190 and c[1] > 130: #green