Skip to content

Instantly share code, notes, and snippets.

@atr000
atr000 / views.py
Created August 20, 2009 17:17 — forked from pr1001/views.py
# Module import statements
# Python
import urllib
import urlparse
import pickle
import logging
# App Engine
from google.appengine.ext import db
# Django
from django.http import HttpResponse, HttpResponseRedirect
#!/usr/bin/env python
# encoding: utf-8
"""
Pokes the Safari cache and makes thumbnails from all files. Nice learning tool.
surfing_yesterday.py
Created by Kohichi Aoki on 2009-07-22.
Copyright (c) 2009 drikin.com. All rights reserved.
@atr000
atr000 / snippet.txt
Created August 21, 2009 21:12
digraph to map uti / metadata linkages on osx. Great to see what qlplugins go where and attempt to fix Apple's lack of an interface
digraph UTI_Graph {
graph [rankdir=LR];
node [label="\N"];
graph [bb="0,0,1758,5802"];
com_adiumx_messagestyle [label="com.adiumx.messagestyle", fontsize=11, shape=rect, color=blue, height="0.36", style=rounded, pos="887,189", width="1.81"];
com_microsoft_powerpoint_slide_object [label="com.microsoft.powerpoint.slide-object", fontsize=11, shape=rect, color=blue, height="0.36", style=rounded, pos="382,5393",
width="2.58"];
public_content [label="public.content", fontsize=11, shape=rect, color=blue, height="0.36", style=rounded, pos="1601,2293", width="1.08"];
com_apple_rtfd [label="com.apple.rtfd", fontsize=11, shape=rect, color=blue, height="0.36", style=rounded, pos="1150,1079", width="1.11"];
com_microsoft_windows_media_wax [label="com.microsoft.windows-media-wax", fontsize=11, shape=rect, color=blue, height="0.36", style=rounded, pos="629,3214", width="2.42"];
#!/usr/bin/python
import prowlpy
apikey = 'YOUR API KEY HERE'
p = prowlpy.Prowl(apikey)
def my_func(account, sender, message, conversation, flags):
print sender, 'said:', message
p.add('Pidgin', sender, message)
@atr000
atr000 / apt
Created September 11, 2009 07:16
apt-get install devscripts build-essential
apt-get build-dep pkg
apt-get source evilwm
debchange -n and document your non-maintainer changes
debuild -us -uc so we don't try to sign it
dpkg -i the resultant package
@atr000
atr000 / apt
Created September 11, 2009 07:16
apt-get install devscripts build-essential
apt-get build-dep pkg
apt-get source evilwm
debchange -n and document your non-maintainer changes
debuild -us -uc so we don't try to sign it
dpkg -i the resultant package
#!/bin/sh
ifconfig en0 | grep inactive > /dev/null
RC=$?
if [ $RC -eq 0 ] ; then
WIREDSTR="inactive"
else
WIREDSTR="$(ifconfig en0 | grep media: | grep \( | sed 's/.*(//' | sed 's/ .*//' | sed 's/baseT/ MBit\/s/')"
fi
#!/usr/bin/env python
# requires py-appscript. assume this also will only run on >10.5.6 (or something modern)
# I always wanted a cli tool to "dump" browser states without attempting to get into the complexities of
# a particular datastore, given the concurrent usage of multiple browsers, each for specific tasks.
import appscript
print appscript.app("Camino").windows.first.current_tab.URL()
# real easy, cuts the applescript junk, and the dictionary/translate tools provide you with it all.
# now suckfari
#!/usr/bin/pythonw
# redundant given the python bindings but still a nice learning lesson since not much has that luxury
from appscript import *
# connect to Growl
growl = app('GrowlHelperApp')
# Make a list of all the notification types
# that this script will ever send:
allNotificationsList = ['Test Notification', 'Another Test Notification']
# apache2 conf file for using wsgi + mod_rewrite to serve wsgi setups dynamically, using a per directory setup (great for home systems or shell boxes)
# egregiously boosted from the helpful sir at:
# http://codespatter.com/2009/07/08/python-projects-in-users-home-directories-with-wsgi/
#
WSGIDaemonProcess wsgi_processes.%{ENV:python_project_name}
processes=2 threads=15
WSGIProcessGroup wsgi_processes.%{ENV:python_project_name}