Skip to content

Instantly share code, notes, and snippets.

@segphault
segphault / XMLRPCServer.pm.patch
Created February 8, 2009 07:25
Extend MT getRecentPosts API call so the user can filter on author id and entry status
diff --git a/lib/MT/XMLRPCServer.pm b/lib/MT/XMLRPCServer.pm
index d627f5c..7f89547 100644
--- a/lib/MT/XMLRPCServer.pm
+++ b/lib/MT/XMLRPCServer.pm
@@ -610,7 +610,14 @@ sub _get_entries {
my($author, $perms) = $class->_login($user, $pass, $blog_id);
die _fault(MT->translate("Invalid login")) unless $author;
die _fault(MT->translate("Permission denied.")) unless $perms && $perms->can_create_post;
- my $iter = MT->model($obj_type)->load_iter({ blog_id => $blog_id },
+
@segphault
segphault / twin.py
Created March 6, 2009 18:07
Week in review script using my improved XML-RPC API for MT
#!/usr/bin/env python
import gconf
import myxmlrpc as xmlrpclib
RPC_URL = "http://write.arstechnica.com/mt-xmlrpc.cgi"
RPC_USER = gconf.Client().get_string("/apps/cms/username")
RPC_PASS = gconf.Client().get_string("/apps/cms/password")
RPC_BLOG = "1"
@segphault
segphault / config.py
Created March 16, 2009 03:33
Fix the gnome keyring fallback support in Gwibber
try:
import gnomekeyring
except:
gnomekeyring = None
...
# Edited version of getitem/setitem in the config.py Account class
# This will probably fix the gnomekeyring fallback
@segphault
segphault / .fonts.conf
Created March 17, 2009 04:33
Save this XML as ~/.fonts.conf and then restart your session
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<match target="font">
<edit name="autohint" mode="assign">
<bool>true</bool>
</edit>
</match>
</fontconfig>
@segphault
segphault / entry-widget-enhancements.c
Created March 22, 2009 01:25
Test of new entry widget features in GTK+ 2.16
/*
* Testing new GTK+ 2.16 features
* SegPhault (Ryan Paul) - 03/20/2009
*/
#include <gtk/gtk.h>
#include <glib/gprintf.h>
GtkWidget *entry;
@segphault
segphault / gtkrc
Created April 3, 2009 00:10
My custom Murrine-based GTK+ theme
# MurrinaSegPhault v0.04
# Uses Murrina Engine by Cimi
style "theme-default"
{
GtkButton::default_border = { 1, 1, 1, 1 }
GtkButton::default_outside_border = { 2, 2, 2, 2 }
GtkRange ::trough_border = 0
GtkPaned ::handle_size = 8
GtkRange ::slider_width = 15
@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()
@segphault
segphault / jetpack-digg.js
Created May 22, 2009 09:33
A Jetpack plugin that will show the Digg count for a web page
jetpack.statusBar.append({
html: '<span id="count">Digg</span>',
width: 55,
onReady: function(doc) {
var url = jetpack.tabs.focused.contentWindow.location.href;
function updateDiggs() {
if (url != jetpack.tabs.focused.contentWindow.location.href) {
url = jetpack.tabs.focused.contentWindow.location.href;
console.log(url);
#!/usr/bin/env python
import SimpleHTTPServer
from gwibber import microblog, config
from mako.template import Template
PORT = 10002
def generate_html(messages):
return Template("""
#!/usr/bin/env python
"""
NOTE: This example is outdated and no longer works properly.
For the latest working example, please see the GTG wiki:
http://live.gnome.org/gtg/dbus
"""
import dbus