Skip to content

Instantly share code, notes, and snippets.

View dchud's full-sized avatar

Dan Chudnov dchud

  • @mitre (work) + CDC projects (work) + personal projects
  • Washington, DC, USA
View GitHub Profile
@dchud
dchud / dspace-4.0-bin-install-guide
Last active August 29, 2015 13:56
20-minute guide to installing DSpace-4.0 from binary release on Ubuntu 12.04 LTS
# dchud's 20 minute guide to installing DSpace 4.0 from the binary release
# on a clean ubuntu 12.04 server running on aws ec2 or where-have-you
#
# this guide assumes you are already comfortable with *nix system administration
#
# this guide leaves out anything to do with the many details of configuring
# DSpace itself; it just gets you to the "it's up and running" step
#
# to start: get your clean ubuntu-12.04 system up to date
$ sudo apt-get update && sudo apt-get upgrade
@dchud
dchud / 20141001-filecounts.min.json
Last active August 29, 2015 14:07
A year's worth of files
[["2014-09-22 22:00:00Z", 119], ["2014-09-22 09:00:00Z", 120], ["2014-09-22 03:00:00Z", 120], ["2014-09-22 08:00:00Z", 120], ["2014-09-22 21:00:00Z", 120], ["2014-09-22 14:00:00Z", 120], ["2014-09-22 06:00:00Z", 120], ["2014-09-22 18:00:00Z", 120], ["2014-09-22 01:00:00Z", 120], ["2014-09-22 00:00:00Z", 120], ["2014-09-22 02:00:00Z", 120], ["2014-09-22 10:00:00Z", 119], ["2014-09-22 11:00:00Z", 120], ["2014-09-22 12:00:00Z", 120], ["2014-09-22 16:00:00Z", 119], ["2014-09-22 20:00:00Z", 120], ["2014-09-22 07:00:00Z", 120], ["2014-09-22 17:00:00Z", 118], ["2014-09-22 15:00:00Z", 120], ["2014-09-22 04:00:00Z", 120], ["2014-09-22 05:00:00Z", 120], ["2014-09-22 23:00:00Z", 120], ["2014-09-22 13:00:00Z", 120], ["2014-09-22 19:00:00Z", 120], ["2014-09-09 22:00:00Z", 119], ["2014-09-09 09:00:00Z", 120], ["2014-09-09 03:00:00Z", 120], ["2014-09-09 08:00:00Z", 120], ["2014-09-09 21:00:00Z", 120], ["2014-09-09 14:00:00Z", 120], ["2014-09-09 06:00:00Z", 120], ["2014-09-09 18:00:00Z", 120], ["2014-09-09 01:00:00Z", 120],
@dchud
dchud / README.md
Last active August 29, 2015 14:09
animated Anscombe's Quartet regression diagnostics

What makes the Anscombe's Quartet of datasets useful, as wikipedia explains, is their near-equivalent summary stats: the x and y sets share the same mean, sample variance, correlation and simple linear regression model. It's instructive as a clear example of what to watch out for when developing simple linear regressions, and the issues each dataset highlights come clear in the different diagnostic plots.

The animation allows visual tracking of each data point through the

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.