Skip to content

Instantly share code, notes, and snippets.

View IPython 0.11 Test Traceback
**********************************************************************
IPython test group: IPython.config
/usr/local/lib/python2.6/dist-packages/nose/plugins/manager.py:391: UserWarning: Module pkg_resources was already imported from /usr/lib/python2.6/dist-packages/pkg_resources.pyc, but /usr/local/lib/python2.6/dist-packages is being added to sys.path
import pkg_resources
/usr/local/lib/python2.6/dist-packages/nose/plugins/manager.py:391: UserWarning: Module site was already imported from /usr/lib/python2.6/site.pyc, but /usr/local/lib/python2.6/dist-packages is being added to sys.path
import pkg_resources
..........
----------------------------------------------------------------------
Ran 10 tests in 0.013s
View gist:279387
................................................................................S..............F.F..
======================================================================
FAIL: Test that object's __del__ methods are called on exit.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/local/lib/python2.6/dist-packages/nose/case.py", line 183, in runTest
self.test(*self.arg)
File "/home/ub/Downloads/ipython-0.11.bzr.r1340-py2.6.egg_FILES/IPython/testing/decorators.py", line 225, in skipper_func
return f(*args, **kwargs)
File "/home/ub/Downloads/ipython-0.11.bzr.r1340-py2.6.egg_FILES/IPython/core/tests/test_run.py", line 160, in test_obj_del
View gist:281029
======================================================
Setting up Django using Apache/mod_wsgi on Ubuntu 8.10
======================================================
This article will cover setting up Django using Apache/mod_wsgi on Ubuntu
8.10. The article is targeted at a production environment, but keep in mind
this is a more generalized environment. You may have different requirements,
but this article should at least provide the stepping stones.
The article will use distribution packages where nesscary. As of 8.10 the
View gist:281820
>>> class x(object):
... def __call__(self):
... print "Hello, World!"
...
>>> x()
<__main__.x object at 0x9a5a1ac>
>>> x()()
Hello, World!
>>> type(x)
<type 'type'>
View wikipedia_abstract_from_dbpedia.py
from xml.etree import ElementTree as ET
import urllib
dbpedia_endpoint = "http://dbpedia.org/sparql?"
ns = {'ns': '{http://www.w3.org/2005/sparql-results#}'}
result_xpath ='%(ns)sresults/%(ns)sresult/%(ns)sbinding/%(ns)sliteral' % ns
def wikipedia_abstract_from_dbpedia(dbpedia_key):
sparql = """
SELECT ?abstract
View gist:309065
lakshman@localhost:~/clients/netnoir.com$ ls -ltr
total 308
drwxrwxrwx 6 www-data shabda3 4096 Jan 4 22:00 wp-includes
drwxrwxrwx 8 www-data shabda3 4096 Jan 4 22:00 wp-admin
-rwxrwxrwx 1 www-data root 2594 Feb 6 07:34 wp-config.php
-rwxrwxrwx 1 www-data shabda3 7578 Feb 16 03:57 wp-mail.php
drwxrwxrwx 6 www-data shabda3 4096 Feb 16 03:57 wp-content
-rwxrwxrwx 1 www-data shabda3 93445 Feb 16 03:57 xmlrpc.php
-rwxrwxrwx 1 www-data shabda3 3693 Feb 16 03:57 wp-trackback.php
-rwxrwxrwx 1 www-data shabda3 23097 Feb 16 03:57 wp-settings.php
View gist:488946
from django.core.cache import cache
def cache_for(seconds,fetch=0):
def cache_it(func):
def deco_func(self):
val = cache.get(self.get_cache_key(fetch))
if not val:
val = func(self)
cache.set(self.get_cache_key(fetch), val, seconds)
return val
return deco_func
View idiotpoweredscripting.js
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
// KuNG FU JS v.1 20yrsplus.info
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
//alert('Photo Uploaded! Please wait 1-2 minutes without leaving this page until we process your picture!');
function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
View gcj.py
def compute_count(case):
hops = int(case[0])
hop = 1
total_time = 0
pos = {'O':1,
'B':1}
available_time = 0
consumed_time = {'robot':'O',
'time': 0}
while hop<hops*2+1:
View gist:960830
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <conio.h>
#define IN "A-large-practice.in"
#define OUT "A-large-practice.out"
using namespace std;