Skip to content

Instantly share code, notes, and snippets.

@neelsmith
neelsmith / setOsxEditor.sh
Created September 10, 2013 16:21
Set OS X EDITOR environment variable to open a Mac app like TextEdit
export EDITOR="/usr/bin/open -n -W -a /Applications/TextEdit.app"
@neelsmith
neelsmith / citekit-config
Created September 17, 2013 01:13
CiteKit: basic configuration of default resources
<ul id="citekit-sources">
<li class="citekit-source cite-text citekit-default">http://DEFAULTCTS</li>
<li class="citekit-source cite-image citekit-default">http://DEFAULTIMGSVC</li>
<li class="citekit-source cite-collection citekit-default">http://DEFAULTCOLL</li>
</ul>
@neelsmith
neelsmith / acceptcm.pl
Created October 25, 2013 10:20
critic markup perl: accept markup in stdin
while (<STDIN>) {
my $currLine = $_;
# accept deletions:
$currLine =~ s#{--[^\-]+--}##g;
# accept additions:
$currLine =~ s#{\+\+([^+]*)\+\+}#$1#g;
# accept changes:
$currLine =~ s#{~~[^~]+~>([^~]+)~~}#$1#;
print $currLine;
}
@neelsmith
neelsmith / rejectcm.pl
Created October 25, 2013 10:21
critic markup perl: reject critic markup
while (<STDIN>) {
my $currLine = $_;
#reject deletions:
$currLine =~ s#{--([^\-]+)--}#$1#g;
#reject additions:
$currLine =~ s#{\+\+([^+]*)\+\+}##g;
#reject changes:
$currLine =~ s#{~~([^~]+)~>[^~]+~~}#$1#g;
print $currLine;
}
@neelsmith
neelsmith / collectXmlText.groovy
Last active December 28, 2015 18:49
groovy script showing how to extract text node content from an XML file
/*
groovy XmlParser creates a tree of nodes that are
either Strings or groovy.util.Node objects. Walk the
parsed tree recursively and save text content.
*/
String collectText(Object n, String allText) {
if (n.getClass().getName() == "java.lang.String") {
allText = allText + n
@neelsmith
neelsmith / javaUtf8.sh
Created January 6, 2014 19:02
Set default file encoding option so java/groovy source code is UTF8.
export JAVA_OPTS="$JAVA_OPTS -Dfile.encoding=UTF8"
@neelsmith
neelsmith / writeUtf8Output.groovy
Created January 6, 2014 19:05
Wrap System.out in a UTF-8 OutputStreamWriter.
OutputStreamWriter osw = new OutputStreamWriter(System.out, "UTF-8")
osw.write "μῆνιν ἄειδε\n"
osw.close()
@neelsmith
neelsmith / instanceFromName.groovy
Last active February 11, 2024 15:52
groovy: get an instance of a class from its name as a string
def objectInstance = Class.forName("NAME.AS.STRING").newInstance()
@neelsmith
neelsmith / .profile
Last active August 29, 2015 13:56
Globally make java be more reasonable about character encoding in file io.
# Add to your .profile or equivalent:
export JAVA_OPTS="$JAVA_OPTS -Dfile.encoding=UTF8"
@neelsmith
neelsmith / README.md
Last active August 29, 2015 13:56
Athenian Tribute Quota payments

Athenian Tribute quota payments: extant records

The Athenian Tribute Quota Lists

In the fifth century B.C., members of the "League of the Greeks" paid annual tribute to Athens. The Athenian Tribute Quota lists are a series of fragmentarily preserved inscriptions recording the proportion of that payment (1/60) that was handed over to the Treasurers of Athena.

Interaction