Skip to content

Instantly share code, notes, and snippets.

View dchud's full-sized avatar

Dan Chudnov dchud

View GitHub Profile
class SolrPaginator:
"""
Take a solr.py result and return a Django paginator-like object.
"""
def __init__(self, q, result):
self.q = q
self.result = result
@property
#!./bin/python
import os
import sqlite3
import web
import pymarc
print 'Clearing out old db'
#!/usr/bin/env python
import grp
import mimetypes
from optparse import OptionParser
import os
from pprint import pprint
import pwd
from stat import *
import sys
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@dchud
dchud / gist:1525187
Created December 27, 2011 21:17
umlaut error trace
NoMethodError in Resolve#index
Showing resolve/_service_errors.rhtml where line #25 raised:
You have a nil object when you didn't expect it!
The error occurred while evaluating nil.values
Extracted source (around line #25):
22: <ul>
23: <% failed_dispatches.each do | dispatch | %>
@dchud
dchud / gist:2960200
Created June 20, 2012 14:38
voyager/oracle/django weirdness
# debugging a problem ticketed at https://github.com/gwu-libraries/launchpad/issues/22
# note: reopened django ticket w/comment https://code.djangoproject.com/ticket/15313#comment:4
# t.py script:
import cx_Oracle
dsn_tns = cx_Oracle.makedsn('oracle.example.com', 1521, 'VGER')
conn = cx_Oracle.connect('user', 'pass', dsn_tns)
c = conn.cursor()
r = c.execute("""
@dchud
dchud / README.md
Created December 10, 2012 23:39
d3 way to handle 3D array

In the middle of this script is a for loop that iterates over the arrays in the 3D data array. There must be a more d3ish way of doing this than using a javascript for loop, but I can't figure out how to retain each row's index position in the larger array to pass to the y() scaling function.

@dchud
dchud / gist:4496191
Created January 9, 2013 19:43
settings to add to local_settings.py
DATA_DIR = '/home/dchud/projects/social-feed-manager/sfm/data'
TWITTER_DEFAULT_USERNAME = 'MY FANCY USERNAME'
TWITTER_CONSUMER_KEY = 'ITS CONSUMER KEY'
TWITTER_CONSUMER_SECRET = 'ITS CONSUMER SECRET'
@dchud
dchud / gist:5090701
Created March 5, 2013 14:35
I stand with Dale Askey.
http://mellenpress.com/mellenpress.cfm?pc=26
Hello, I am an academic librarian in the USA, and I am writing to urge you to drop all your legal proceedings against Dale Askey. I am not a specialist in the fields your authors cover, nor do I have any opinion about the scholarly quality about your published titles. As a research university librarian, however, I personally believe that your lawsuits against Mr. Askey and McMaster University are an affront to academic freedom and scholarship in general. You have many options for fora within which to disprove your critics that fall well within the sphere of scholarly communication and gracious professional discourse. But by slapping down lawsuits in reaction to what appears to be reasoned, polite criticism, you have crossed the boundary into unacceptable behavior.
I urge you to reconsider and to drop all of your legal actions against Mr. Askey immediately.
Thank you for your consideration, -Daniel Chudnov
@dchud
dchud / ercamp-examples.md
Last active December 18, 2015 19:09
API call examples for ERcamp 2013 at GW Libraries