Skip to content

Instantly share code, notes, and snippets.

View jamesadney's full-sized avatar

James Adney jamesadney

View GitHub Profile
@quad
quad / forward-test.py
Created April 19, 2009 12:03
A hilarious use of the Skype API to connect random people together.
#!/usr/bin/env python
import logging
import dbus
import dbus.service
import gobject
# Set DBUS as the default MainLoop.
from dbus.mainloop.glib import DBusGMainLoop
@segphault
segphault / web-ui.py
Created May 5, 2009 19:54
Experimental UI for the Ubuntu messaging indicator
#!/usr/bin/env python
import gtk, gobject, indicate, dbus, webkit
from xdg.DesktopEntry import DesktopEntry
from mako.template import Template
class IndicatorInspector:
def __init__(self):
self.servers = []
self.listener = indicate.Listener()
# Copyright 2009 Igor Kolar <igor.kolar@gmail.com>
#
# Licensed under the EUPL, Version 1.1 or – as soon they
# will be approved by the European Commission - subsequent
# versions of the EUPL (the "Licence");
# You may not use this work except in compliance with the
# Licence.
# You may obtain a copy of the Licence at:
# http://ec.europa.eu/idabc/eupl5
#
@endolith
endolith / bansheeserver.py
Created October 11, 2009 20:03
Banshee remote server (by Nikitas Stamatopoulos)
#!/usr/bin/env python
#Copyright (C) 2009 Nikitas Stamatopoulos
# Modified by endolith@gmail.com 2009-10
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation, either version 3 of the License, or
#(at your option) any later version.
#!/usr/bin/env python
import gtk, dbus, dbus.service, sqlite3
from dbus.mainloop.glib import DBusGMainLoop
DB_FILENAME = "/home/segphault/test.sqlite"
DBusGMainLoop(set_as_default=True)
class Notifier(dbus.service.Object):
@dpogue
dpogue / netwatcher.py
Created January 30, 2011 10:10
Python script to watch for Avahi/Bonjour workstation broadcasts and present alerts using libnotify
#!/usr/bin/env python
import dbus, gobject, avahi, pynotify, time
from dbus import DBusException
from dbus.mainloop.glib import DBusGMainLoop
TYPE = '_workstation._tcp'
def service_resolved(*args):
name = args[5].split('.')[0]
ip = args[7]
@ludviglindblom
ludviglindblom / detect_full_screen.html
Created May 18, 2011 16:32 — forked from nathansmith/detect_full_screen.html
Detect full-screen mode for desktop browsers.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Detect Full-Screen</title>
<style>
* {
font-family: sans-serif;
line-height: 1.5;
anonymous
anonymous / bootstrap.sh
Created June 2, 2011 17:19
Django on Heroku with Celery and Sentry
virtualenv --no-site-packages .
source bin/activate
bin/pip install Django psycopg2 django-sentry
bin/pip freeze > requirements.txt
bin/django-admin.py startproject mysite
cat >.gitignore <<EOF
bin/
include/
lib/
EOF
@bdarnell
bdarnell / fdserver.py
Created July 9, 2011 20:41
Demonstration of sharing file descriptors across processes
#!/usr/bin/env python
"""This is a demonstration of sharing file descriptors across processes.
It uses Tornado (need a recent post-2.0 version from github) and the
multiprocessing module (from python 2.6+). To run it, start one copy
of fdserver.py and one or more copies of testserver.py (in different
terminals, or backgrounded, etc). Fetch http://localhost:8000 and
you'll see the requests getting answered by different processes (it's
normal for several requests to go to the same process under light
load, but under heavier load it tends to even out).
@lrvick
lrvick / flask_geventwebsocket_example.py
Created September 1, 2011 07:17
Simple Websocket echo client/server with Flask and gevent / gevent-websocket
from geventwebsocket.handler import WebSocketHandler
from gevent.pywsgi import WSGIServer
from flask import Flask, request, render_template
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html')