Skip to content

Instantly share code, notes, and snippets.

@hetsch
hetsch / multilingual.py
Created January 11, 2012 09:51
Multilingual model for appengine ndb
import functools
import unittest2
import os
from google.appengine.api import datastore_errors
from google.appengine.ext.ndb import model
from google.appengine.ext.ndb import tasklets
from google.appengine.ext import testbed
#---------------------------------------
@hetsch
hetsch / router.js
Created March 14, 2012 09:20
Backbone named parameter routing
Components.Router = Backbone.Router.extend({
// @todo also support unnamed params
// 'page/edit/(?<language>[a-z]{2})/(?<entityId>[a-z0-9]{24})/(.*)'
route: function(route, name, callback) {
Backbone.history || (Backbone.history = new Backbone.History);
if (!XRegExp.isRegExp(route)) route = this._routeToRegExp(route);
if (!callback) callback = this[name];
Backbone.history.route(route, _.bind(function(fragment) {
var routeParams = XRegExp.exec(fragment, route),
@hetsch
hetsch / farm.py
Created June 2, 2012 18:20 — forked from minrk/farm.py
"""
Simple task farm, with routed replies in pyzmq
For http://stackoverflow.com/questions/7809200/implementing-task-farm-messaging-pattern-with-zeromq
Note that things are run in threads to keep stuff in one file, there is no
reason they need to be.
License: Public Domain
@hetsch
hetsch / binding.c
Created June 12, 2012 14:23
Inotifyx Python3 bindings
/*
* Copyright (c) 2004 Novell, Inc.
* Copyright (c) 2005 Manuel Amador <[email protected]>
* Copyright (c) 2009-2011 Forest Bond <[email protected]>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
@hetsch
hetsch / tree.md
Created October 5, 2012 07:55 — forked from hrldcpr/tree.md
one-line tree in python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

@hetsch
hetsch / wtforms_populate_obj.py
Created October 20, 2012 09:23
WTForms populate_obj problem
from wtforms.form import Form
from wtforms.fields import TextField, TextAreaField, FieldFist, FormField
class PluginForm(Form):
tags = TextField('Some random tags',)
files = TextField('Some random files',)
@hetsch
hetsch / mongoose_localized_schema.coffee
Created October 20, 2012 22:51
mongoose localized schema
mongoose = require("mongoose")
Schema = mongoose.Schema
languages = ['de', 'en', 'es']
defaultLanguage = 'de'
getLanguage = () ->
return 'de'
class MultilingualSchema extends Schema
@hetsch
hetsch / index-with-redis.php
Created December 11, 2012 16:54 — forked from JimWestergren/index-with-redis.php
Redis as a Frontend Cache for WordPress
<?php
/*
Author: Jim Westergren & Jeedo Aquino
File: index-with-redis.php
Updated: 2012-10-25
This is a redis caching system for wordpress.
see more here: www.jimwestergren.com/wordpress-with-redis-as-a-frontend-cache/
// this is a locale bundle
var locale = {"en-US":"<locale xml:lang=\"en\" xmlns=\"http://purl.org/net/xbiblio/csl\"> <style-options punctuation-in-quote=\"true\"/> <date form=\"text\"> <date-part name=\"month\" suffix=\" \"/> <date-part name=\"day\" suffix=\", \"/> <date-part name=\"year\"/> </date> <date form=\"numeric\"> <date-part name=\"year\"/> <date-part name=\"month\" form=\"numeric\" prefix=\"-\" range-delimiter=\"/\"/> <date-part name=\"day\" prefix=\"-\" range-delimiter=\"/\"/> </date> <terms> <term name=\"document-number-label\">No.</term> <term name=\"document-number-authority-suffix\">Doc.</term> <term name=\"un-sales-number-label\">U.N. Sales No.</term> <term name=\"collection-number-label\">No.</term> <term name=\"open-quote\">\u201c</term> <term name=\"close-quote\">\u201d</term> <term name=\"open-inner-quote\">\u2018</term> <term name=\"close-inner-quote\">\u2019</term> <term name=\"ordinal-01\">st</term> <term name=\"ordinal-02\">nd</ter
# http://forum.xbian.org/thread-370.html
sudo su #default password = 'raspberry'
service xbmc stop
apt-get update
apt-get install libcurl3 libva1
cd /opt
rm -rf xbian
git clone -b xbian-alpha5 git://github.com/xbianonpi/xbian.git
cd xbian