Skip to content

Instantly share code, notes, and snippets.

View durdn's full-sized avatar

Nicola Paolucci durdn

View GitHub Profile
@durdn
durdn / models.py
Created June 7, 2010 14:35
models.py
from datetime import datetime
from StringIO import StringIO
from django.db import models
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from tagging.models import Tag
import account.models
@durdn
durdn / query.py
Created June 7, 2010 14:36
query.py
from urllib import urlopen,quote
from urlparse import urljoin
from tms.parser import Record, TMSParser
from settings import TMS_SERVER_ENTRY_POINT
from settings import AUTHOR_SERVER_ENTRY_POINT
from settings import LOG_TMS_REQUESTS
def indent_xml(xml, indent=' '*4):
"""Indent and return XML."""
@durdn
durdn / parser.py
Created June 7, 2010 14:37
parser.py
try:
from lxml import etree
except:
from xml.etree import ElementTree as etree
from datetime import datetime
class Record(object):
""" Stores data about an artifact in TMS """
def __init__(self, **kwds):
@durdn
durdn / tests.py
Created June 7, 2010 14:43
tests.py
from StringIO import StringIO
from datetime import datetime
from django.test import TestCase
import settings
from tms.parser import TMSParser, TMSAuthorParser
from tms.query import QueryProcessor
from collectie.collections.models import TMSObject
@durdn
durdn / tuttivisti-test.py
Created June 14, 2010 07:42
sample tuttivisti API calls
from django.test.client import Client
from simplejson import loads
import movies.views
import movies.tests
from movies.models import *
from django.contrib.auth.models import User
class TestAPI(unittest.TestCase):
def setUp(self):
@durdn
durdn / salvatore.user.js
Created February 29, 2012 22:40
clarity-for-salvatore
// ==UserScript==
// @name clarity-for-salvatore
// @namespace http://durdn.com/clarity-for-salvatore
// @include http://www.salvatorebrizzi.com/*
// ==/UserScript==
(function(a){String.prototype.trim===a&&(String.prototype.trim=function(){return this.replace(/^\s+/,"").replace(/\s+$/,"")}),Array.prototype.reduce===a&&(Array.prototype.reduce=function(b){if(this===void 0||this===null)throw new TypeError;var c=Object(this),d=c.length>>>0,e=0,f;if(typeof b!="function")throw new TypeError;if(d==0&&arguments.length==1)throw new TypeError;if(arguments.length>=2)f=arguments[1];else do{if(e in c){f=c[e++];break}if(++e>=d)throw new TypeError}while(!0);while(e<d)e in c&&(f=b.call(a,f,c[e],e,c)),e++;return f})})();var Zepto=function(){function v(a){return{}.toString.call(a)=="[object Function]"}function w(a){return a instanceof Object}function x(a){return a instanceof Array}function y(a){return typeof a.length=="number"}function z(b){return b.filter(function(b){return b!==a&&b!==null})}function A(a
@durdn
durdn / custom.conf
Created March 5, 2012 12:05
autologin on xubuntu, ubuntu, linux
Try this edit:
$ cat /etc/gdm/custom.conf
[daemon]
TimedLoginEnable=false
AutomaticLoginEnable=true
TimedLogin=user_You_want_to_login
AutomaticLogin=user_You_want_to_login
TimedLoginDelay=30
@durdn
durdn / freshbook-mindcurv-timesheet.user.js
Created April 20, 2012 15:26
Freshbook Mindcurv Timesheet Beautifier
// ==UserScript==
// @name freshbook-mindcurv-timesheet
// @namespace http://userscript.org/durdn
// @include https://mindcurv.freshbooks.com/*
// ==/UserScript==
(function(a){String.prototype.trim===a&&(String.prototype.trim=function(){return this.replace(/^\s+/,"").replace(/\s+$/,"")}),Array.prototype.reduce===a&&(Array.prototype.reduce=function(b){if(this===void 0||this===null)throw new TypeError;var c=Object(this),d=c.length>>>0,e=0,f;if(typeof b!="function")throw new TypeError;if(d==0&&arguments.length==1)throw new TypeError;if(arguments.length>=2)f=arguments[1];else do{if(e in c){f=c[e++];break}if(++e>=d)throw new TypeError}while(!0);while(e<d)e in c&&(f=b.call(a,f,c[e],e,c)),e++;return f})})();var Zepto=function(){function v(a){return{}.toString.call(a)=="[object Function]"}function w(a){return a instanceof Object}function x(a){return a instanceof Array}function y(a){return typeof a.length=="number"}function z(b){return b.filter(function(b){return b!==a&&b!==null})}function A(a){r
@durdn
durdn / freshbook-mindcurv-timesheet.user.css
Created April 23, 2012 14:52
Freshbook Mindcurv Timesheet CSS
body {
color : red
}
.tabArea {
background-color : white;
background-image : none;
background-repeat : none;
border : none;
}
@durdn
durdn / nginx.conf
Created May 12, 2012 16:17
Upstart Configuration for nginx
# nginx
description "nginx http daemon"
author "George Shammas <georgyo@gmail.com>"
start on (filesystem and net-device-up IFACE=lo)
stop on runlevel [!2345]
env DAEMON="/data/apps/nginx/sbin/nginx -c /data/apps/nginx/conf/nginx.conf"
env PID=/var/run/nginx.pid