This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
A Python module that enables posting notifications to the Growl daemon. | |
See <http://growl.info/> for more information. | |
""" | |
__version__ = "0.7" | |
__author__ = "Mark Rowe <[email protected]>" | |
__copyright__ = "(C) 2003 Mark Rowe <[email protected]>. Released under the BSD license." | |
__contributors__ = ["Ingmar J Stein (Growl Team)", | |
"Rui Carmo (http://the.taoofmac.com)", | |
"Jeremy Rossi <[email protected]>", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
""" | |
Prowlpy V0.4.2 | |
Written by Jacob Burch, 7/6/2009 | |
Python module for posting to the iPhone Push Notification service Prowl: http://prowl.weks.net/ | |
""" | |
__author__ = '[email protected]' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
To be used as part of an automator script, install as a service. | |
Sends the highlighted text to your iphone using prowl | |
''' | |
import sys | |
from prowl import Prowl | |
import Growl | |
notifier = Growl.GrowlNotifier('Prowl', ['status']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
This python script listens for distributed notifications from iTunes of new songs playing, | |
works alot better then constantly polling. | |
''' | |
import Foundation | |
from AppKit import * | |
from PyObjCTools import AppHelper | |
class GetSongs(NSObject): | |
def getMySongs_(self, song): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Automatically post the currently playing track to twitter | |
Create an Automator service workflow to use | |
''' | |
import sys | |
from appscript import * | |
from os import popen | |
username='' | |
password='' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
This script grabs the currently playing song from Itunes and generates a dict with the song details such as name, artist, album, genre etc. | |
You need the appscript library | |
''' | |
from appscript import * | |
it = app('iTunes') | |
tags = ['name', 'artist','album','genre','played_date','duration'] | |
if it.isrunning(): | |
state = it.player_state.get() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Runs a RAW SQL query in DJANGO and returns dictionaries to the template rather then a tuple | |
''' | |
from myapp.files.models import summary | |
from django.shortcuts import render_to_response | |
def generate_dicts(cur): | |
import itertools | |
fieldnames = [d[0].lower() for d in cur.description] | |
while True: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
This Snippet creates a custom template tag for passing a context variable to your template with a list of choices from your models.py i.e | |
COL_CHOICES =( | |
(1, 'Not Applicable'), | |
(2, 'Black'), | |
) | |
Usage: | |
1. Save to template tags dir |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
This Snippet, lets you create a generic custom model manager to summarize data on a table by any field. | |
Benefits: | |
- You wont be repeating yourself! | |
- A single url & template can be used to summarize by any field in your model | |
Example Usage: Book.counts.by(field, year, month, day) i.e Book.counts.by(category, 2009, 9, 24) | |
Notes: |