Skip to content

Instantly share code, notes, and snippets.

View fish2000's full-sized avatar
👉
MINUTE CONCERN, EXTRAORDINARY CONFLAGRATION

Alexander Böhn fish2000

👉
MINUTE CONCERN, EXTRAORDINARY CONFLAGRATION
  • Objects in Space and Time, LLC
  • Baltimore, MD
  • X @fish2000
View GitHub Profile
@fish2000
fish2000 / upload_images_to_tumblr.py
Created September 30, 2010 04:55
upload images en masse to a tumblr account
#!/usr/bin/env python
# encoding: utf-8
"""
_shootemup.py
Created by fish on 2009-06-04.
Copyright (c) 2009 OST LLC. All rights reserved.
I wrote this in 10min so YMMV; but you really don't need an over-the-top
API binding for Tumblr cuz it's so simple, which I appreciate.
@fish2000
fish2000 / django_bash_settings.bash
Created September 30, 2010 05:01
bash aliases/functions/environment vars for use w/ django
export JANGY_PROJECT='/Users/fish/Dropbox/ost2/ost2'
export BPYTHON_INIT_SCRIPT='${JANGY_PROJECT}/utils/django_shell_imports.py'
export PYTHONPATH="${JANGY_PROJECT}:${PYTHONPATH}"
alias jangy="python manage.py"
alias bp="cd $JANGY_PROJECT && bpython --interactive $BPYTHON_INIT_SCRIPT"
@fish2000
fish2000 / whereismyshit.py
Created September 30, 2010 05:04
dump lists of all directories and egg files, in sys.path and all visible .pth files; group the results accordingly.
#!/usr/bin/env python
# encoding: utf-8
"""
whereismyshit.py
Created by FI$H 2000 on 2010-09-16.
Copyright (c) 2010 OST, LLC. All rights reserved.
"""
from __future__ import with_statement
@fish2000
fish2000 / backupmodelstofixtures.py
Created September 30, 2010 05:20
TARBALL DATABASE FIXTURE DUMPER, for django
#!/usr/bin/env python
# encoding: utf-8
"""
backupmodelstofixtures.py
TARBALL DATABASE FIXTURE DUMPER.
Created by FI$H 2000 on 2010-04-18.
Copyright (c) 2010 OST, LLC.
MIT License. It works, bitches.
@fish2000
fish2000 / isbnwrangle.py
Created September 30, 2010 05:21
ad-hoc python interface to ISBNdb.com web service API
#!/usr/bin/env python
# encoding: utf-8
"""
isbnwrangle.py
Created by FI$H 2000 on 2010-03-24.
Copyright (c) 2010 OST, LLC. All rights reserved.
"""
import sys, os, unittest, pyisbn, urllib2, simplejson
@fish2000
fish2000 / findmyshit.py
Created September 30, 2010 05:25
sometimes you need to find some shit (in this case, the 'site-packages' folder which went missing after the OS X 10.6 upgrade)
#!/usr/bin/env python
# find /usr /opt /System /Library ~ -name "site-packages" -print 2> /dev/null
import os
print ">>>\t FINDING MY SHIT...."
whwreismyshit = os.execv('/usr/bin/find', (
@fish2000
fish2000 / closure-example.py
Created September 30, 2010 05:31
example of python closures
def cl_get(what=None):
def cl(self, yodogg):
print u"cl_get(what): %s" % what
print u"cl.func_name: %s" % cl.func_name
print u"cl(self) type: %s" % type(self)
print u"cl(yodogg): %s" % yodogg
return cl
class Stuff(Thingy):
@staticmethod
@fish2000
fish2000 / readability.py
Created September 30, 2010 05:51
python port of Arc90 readability.js (circa 2009)
#!/usr/bin/env python
# encoding: utf-8
#####
##### Readability.py -- by fish. © 2009, Some Rights Reserved But Some May Be
##### http://objectsinspaceandtime.com/
#####
##### it's a python port of the Readability JavaScript bookmarklet,
##### by Arc90 Labs --
##### http://lab.arc90.com/2009/03/readability.php
@fish2000
fish2000 / autoshot.py
Created September 30, 2010 06:06
python windows cron-ish screenshot service example
#!/usr/bin/env python
# encoding: utf-8
"""
autoshot.py
Extend the Windows Service to do a real task
(the PIL call did not work here, hence the entirely
separate oneshot.py script)
Created by fish on 2009-12-08.
portype = ContentType.objects.get(model='axitem')
starthue = colors.Color('#585852')
endhue = colors.Color('#FFCB36')
mosttags = cloud = None
if len(Tagg.objects.cloud_for_model(AXItem)) > 0:
mosttags = reduce(lambda ti, to: (float(ti) < float(to)) and float(to) or float(ti),
map(lambda tg: int(tg.items.filter(content_type=portype).count()),
Tagg.objects.cloud_for_model(AXItem)))
cloud = map(lambda tt: (tt[0], starthue.blend(endhue, 0.7-(float(tt[1])/mosttags))),