Skip to content

Instantly share code, notes, and snippets.

View ryanfb's full-sized avatar

Ryan Baumann ryanfb

View GitHub Profile
@mcewand
mcewand / PennInHand_grabber.py
Last active August 29, 2015 14:02
Quick script to help students in the Rare Book School M-95 course.
#!/bin/python
# 1. Save this file to your local machine where you want to save the files
# 2. Change 'manuscript' to the one you want
# 3. Change 'lastItem' to the last numbered item of the text section of the manuscript
# 4. Add a directory 'jpgs' that the images will be stored in
# 5. Run "python PennInHand_grabber.py"
import sys
import urllib
anonymous
anonymous / bad-usenet-post-extractor.rb
Created September 3, 2014 03:48
Takes a directory full of disordered, misnamed, obfuscated multi-volume RAR files and extracts them. For those Usenet full TV season backlog posts that get picked up by Sick Beard and have millions of .0 .1 .2 files you can't extract and throw "There are no videofiles in folder" in the post-processor. See e.g. http://sickbeard.com/forums/viewtop…
#!/usr/bin/env ruby
require 'pty'
require 'expect'
$rar_divider = "-------------------------------------------------------------------------------\n"
def check_rar_contents(file)
$stderr.puts "Checking RAR contents for: #{file}"
rar_contents = `unrar l -v "#{file}" 2>&1`.split($rar_divider)
diff --git classify/trainingsampleset.cpp classify/trainingsampleset.cpp
index afbf3f4..6121395 100644
--- classify/trainingsampleset.cpp
+++ classify/trainingsampleset.cpp
@@ -693,6 +693,8 @@ void TrainingSampleSet::ComputeCanonicalSamples(const IntFeatureMap& map,
fcinfo.canonical_sample = fcinfo.samples[0];
fcinfo.canonical_dist = 0.0f;
for (int i = 0; i < fcinfo.samples.size(); ++i) {
+ #pragma omp parallel
+ {
# Endpoint http://vocab.getty.edu/sparql
select ?t ?name (count(*) as ?c) {
?x gvp:placeType ?t. ?t gvp:prefLabelGVP/xl:literalForm ?name
} group by ?t ?name
# 0. Inspired by https://twitter.com/paregorios/status/568513448130187264
# 1. This includes place types AND cultures/styles (eg "religious center" and "Maya")
# 2. Exploring the AAT hierarchy above these types could also be interesting
# 3. We also provide TGN counts as per Mar 2015
# 4. The query is a bit expensive (1.2M places, 2.7M type instances), so be nice and use the attached TSV
anonymous
anonymous / ddb board branches
Created August 23, 2010 14:44
Arthur/P.Sijp.,_44
Bart/O.Heid.,_210
Paola/O.Heid._154
adelattr/P.Brux.Bawit_12
approved/2010/04/30/SB_24_15977
approved/2010/05/14/P.Brux._Bawit,_1
approved/2010/06/16/CPL,_310
approved/2010/06/16/O.Ber._2,_130
approved/2010/06/16/P.Brux._Bawit,_9
approved/2010/07/08/O.Heid.,_330
anonymous
anonymous / rake output on dl-pa
Created August 23, 2010 15:16
Loaded suite /usr/local/jruby-1.5.1/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader
Started
.....................................EEEE.F...............
Finished in 96.705 seconds.
1) Error:
test: a publication copied to another owner should be a child of its parent. (PublicationTest):
NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.destroy
$jruby -S rake --trace
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8
(in /data/papyri.info/sosol/editor)
** Invoke default (first_time)
** Invoke test (first_time)
** Execute test
** Invoke test:units (first_time)
** Invoke db:test:prepare (first_time)
** Invoke db:abort_if_pending_migrations (first_time)
** Invoke environment (first_time)
@jdfox777
jdfox777 / P.Petra.III
Created April 5, 2011 20:47
complex XML that blows up xsugar
<div xml:lang="grc" type="edition" xml:space="preserve">
<ab>
<lb n="1"/><gap reason="lost" atLeast="10" atMost="15" unit="line"/>
<lb n="1"/><gap reason="lost" quantity="5" unit="character"/> <supplied reason="lost">ὑπομνησ</supplied>τικὸν τῶν συνθε<gap reason="illegible" quantity="1" unit="character"/><gap reason="lost" quantity="12" unit="character" precision="low"/> <supplied reason="lost">π</supplied><unclear>ε</unclear>ρὶ χ<unclear>ρ</unclear><supplied reason="lost">έ</supplied>ους καὶ
<lb n="2"/><gap reason="lost" quantity="13" unit="character" precision="low"/><unclear>ε</unclear>ντων μ<unclear>ε</unclear><gap reason="illegible" quantity="1" unit="character"/><unclear>ε</unclear><gap reason="lost" quantity="2" unit="character"/><gap reason="illegible" quantity="2" unit="character"/><gap reason="lost" quantity="30" unit="character" precision="low"/>
<lb n="3"/><gap reason="lost" quantity="15" unit="character" precision="low"/>ων. ἐπείπερ π<gap reason="illegible" quantity="1" unit="character"/><gap reas
@ryanfb
ryanfb / gist:955889
Created May 4, 2011 19:50
automatic git changelog from tags
# major versions only
prever=""; for ver in `git tag | grep -v rc | gsort -V -r`; do if [ "$prever" != "" ]; then echo $prever; git rev-list --pretty=oneline --abbrev-commit --no-merges $prever ^$ver; echo ""; fi; prever=$ver; done | less
# RC's only
prever=""; for ver in `git tag | grep rc | gsort -V -r`; do if [ "$prever" != "" ]; then echo $prever; git rev-list --pretty=oneline --abbrev-commit --no-merges $prever ^$ver; echo ""; fi; prever=$ver; done | less
@hcayless
hcayless / gist:1328970
Created October 31, 2011 21:12
migration error
13928:
ready
ready
rake aborted!
An error has occurred, all later migrations canceled:
private method `gsub' called for nil:NilClass
/usr/local/rvm/rubies/jruby-1.6.2/lib/ruby/1.8/cgi.rb:342:in `escape'
./db/migrate//20110811204557_escape_comments.rb:5:in `up'
org/jruby/RubyArray.java:1602:in `each'