Skip to content

Instantly share code, notes, and snippets.

💭
We are hiring!

Anand Chitipothu anandology

💭
We are hiring!
Block or report user

Report or block anandology

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@anandology
anandology / edition.
Created Mar 20, 2009
couchdb view for /type/edition
View edition.
{
"_rev": "1-262566171",
"_id": "_design/type_edition",
"language": "javascript",
"views": {
"by_title": {
"map": "function(doc) { if (doc.type.key == '/type/edition' && doc.title) emit(doc.title, doc.key);}"
},
"by_isbn_10": {
"map": "function(doc) { if (doc.type.key == '/type/edition' && doc.isbn_10) for (var i in doc.isbn_10) emit(doc.isbn_10[i], doc.key);}"
@anandology
anandology / ol.conf
Created Apr 17, 2009
OL configurations in various formats
View ol.conf
[infogami]
infogami_server = "http://ia331526:7070"
smtp_server = "mail.archive.org"
secret_key = "xxx"
plugins = ["openlibrary", "search", "scod", "recaptcha", "akismet", "i18n"]
python_path = ["/0/pharos/code/openlibrary/pharos"]
[plugin_search]
solr_server_address = "pharosdb-bu.us.archive.org:7983"
solr_fulltext_address = "ia301443:7983"
View fcgi_server.py
"""web frontend for fastcgi process.
Usage:
python fcgi_server.py socket-file
"""
from web.wsgiserver import CherryPyWSGIServer
from flup.client.fcgi_app import FCGIApp
server_address = ("0.0.0.0", 8080)
View couchview.py
"""Utility to iterate over couchdb view result."""
import urllib
import simplejson
class Result:
def __init__(self, total_rows, offset, data):
self.total_rows = total_rows
self.offset = offset
self._data = data
View format_tb.py
def f(x):
def g(y):
fail
return g
def format_tb(tb):
# this should get value of x
f1 = f(1)
try:
@anandology
anandology / subdomain_wsgi.py
Created Nov 1, 2010
WSGI application to delegate requests based on domain name.
View subdomain_wsgi.py
import re
class SubDomainApp:
"""WSGI application to delegate requests based on domain name.
"""
def __init__(self, mapping):
self.mapping = mapping
def __call__(self, environ, start_response):
host = environ.get("HTTP_HOST", "")
@anandology
anandology / jsoneval.js
Created Nov 4, 2010
node.js script to process JSON strings one per each line.
View jsoneval.js
#!/usr/bin/env node
var carrier = require('carrier');
var stdin = process.openStdin();
stdin.setEncoding('utf8');
carrier.carry(stdin, function(line) {
var body = JSON.parse(line);
eval(process.argv[2]);
@anandology
anandology / coucheval.js
Created Nov 4, 2010
node.js script to process couchdb output
View coucheval.js
#!/usr/bin/env node
// Sample usage:
//
// $ curl -s 'http://127.0.0.1:15984/seeds/_all_docs?limit=10&include_docs=true' | coucheval.js 'console.log(JSON.stringify(row.doc));'
//
var carrier = require('carrier');
var stdin = process.openStdin();
@anandology
anandology / seeds_view.py
Created Nov 10, 2010
Python Script to add design document to couchdb database
View seeds_view.py
import couchdb
view = {
"_id": "_design/seeds",
"fulltext": {
"by_seed": {
"index": """function(doc) {
if (doc.seeds) {
var d = new Document();
for (var i=0; i<doc.seeds.length; i++) {
@anandology
anandology / subject_comparision.txt
Created Dec 2, 2010
Comparison of works for subject:carpentry in solr (via subjects API) and couchdb (lists).
View subject_comparision.txt
# key has_subject in_solr in_couch
/works/OL7714039W True False True
/works/OL7714035W True False True
/works/OL10612120W True False True
/works/OL7713011W True False True
/works/OL7713015W True False True
/works/OL36429W True False True
/works/OL9365418W False True False
/works/OL13571022W False True False
/works/OL5264422W False True False
You can’t perform that action at this time.