Skip to content

Instantly share code, notes, and snippets.

**********************************************************************
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
................................................................................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
======================================================
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
>>> class x(object):
... def __call__(self):
... print "Hello, World!"
...
>>> x()
<__main__.x object at 0x9a5a1ac>
>>> x()()
Hello, World!
>>> type(x)
<type 'type'>
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
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
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
@lprsd
lprsd / idiotpoweredscripting.js
Created May 4, 2011 19:05
Osama killed video
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 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(';');
@lprsd
lprsd / gcj.py
Created May 7, 2011 14:46
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:
@lprsd
lprsd / gist:960830
Created May 7, 2011 20:55 — forked from JeGa/gist:921635
code jam
#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;