Skip to content

Instantly share code, notes, and snippets.

View natematias's full-sized avatar

J. Nathan Matias natematias

View GitHub Profile
#This script will change the existing card database for wagn so that the root template card specifies that reads will require an authenticated user rather than anonymous access as was the default
# The role encapsulating read needs authenticated user
Card.find_by_name("Basic+*tform").permit(:read, Role[:auth])
# from IRB
require 'rexml/document'
include REXML
doc = Document.new(File.new('Strings.xml'))
elements = doc.root.elements.collect
# Get a wordcount:
find . -type f \( -iname "*.cpp" -or -iname "*.java" \)
@natematias
natematias / wordpress_key_value_query.sql
Created December 1, 2010 16:11
one record per WordPress user account
SELECT wp_users.user_login, wp_users.user_nicename, wp_users.user_email
GROUP_CONCAT(CONCAT(meta_key, ": ", meta_value)),
FROM wp_users JOIN wp_usermeta ON wp_users.id = wp_usermeta.user_id
GROUP BY wp_users.user_login;
@natematias
natematias / top_uk_books
Created August 16, 2012 18:54
Top UK Books
[{"Rank":1,"Title":"Da Vinci Code,The","Author":"Brown, Dan","Volume Sales":"5,094,805","Editions Combined":7,"Imprint":"Corgi Books","Publisher":"Transworld Grp","Publication Date":"Monday, March 1, 2004","Genre":"F2.1 Crime, Thriller & Adventure"},
{"Rank":2,"Title":"Harry Potter and the Deathly Hallows","Author":"Rowling, J.K.","Volume Sales":"4,475,152","Editions Combined":8,"Imprint":"Bloomsbury Publishing PLC","Publisher":"Bloomsbury Grp","Publication Date":"Saturday, July 21, 2007","Genre":"Y2.1 Children's Fiction"},
{"Rank":3,"Title":"Harry Potter and the Philosopher's Stone","Author":"Rowling, J.K.","Volume Sales":"4,200,654","Editions Combined":8,"Imprint":"Bloomsbury Publishing PLC","Publisher":"Bloomsbury Grp","Publication Date":"Thursday, June 26, 1997","Genre":"Y2.1 Children's Fiction"},
{"Rank":4,"Title":"Harry Potter and the Order of the Phoenix","Author":"Rowling, J.K.","Volume Sales":"4,179,479","Editions Combined":5,"Imprint":"Bloomsbury Publishing PLC","Publisher":"Bloomsbury Grp","Publ
@natematias
natematias / httpd2.conf extract
Created January 28, 2013 22:03
What I added to my OSX /etc/apache2/httpd.conf to proxy CouchDB through Apache and overcome the cross-site scripting problem when developing my own couch apps.
## just for context, here's the Directory entry from /etc/apache2/httpd.conf
<Directory />
Options FollowSymLinks
AllowOverride All
Order deny,allow
Deny from all
</Directory>
# Turn on mod_rewrite
@natematias
natematias / extract_baby_names.rb
Last active December 12, 2015 08:19
Scrape baby names from the infochimps US census site download
#scraper requires the SSN scraped babynames dataset from infochimps
#www.infochimps.com/datasets/popular-baby-names-by-year-top-1000-us-social-security-administr
require 'nokogiri'
for year in (1880..2009)
f = File.open("babynames/top-1000-#{year}-num.html")
html = f.read
doc = Nokogiri::HTML(html)
@natematias
natematias / kafkacorpus
Created July 1, 2013 04:30
Kafka Short Story Text Corpus, compiled from the following websites: http://franzkafkastories.com/shortStories.php https://records.viu.ca/~Johnstoi/kafka/kafkatofc.htm This file has been compiled for the purposes of text analysis and does not differentiate between different stories. Lines have been randomised as a courtesy to the copyright holders.
'Caught in the act!' said I, tapping him lightly on the shoulder. Then I ran up the steps, and the disinterested devotion on the servants' faces in the ha"ll delighted me like an unexpected treat. I looked at them all, one after another, while they took my greatcoat off and wiped my shoes clean.
And he stood completely unsupported and kicked his legs. He was radiant with insight.
And it had taken me such a long time in this man's company to recognize the same old game. I rubbed my finger tips together to wipe away the disgrace.
For such reasons, supposing one wanted to keep up correspondence with him, one could not send him any real news such as could frankly be told to the most distant acquaintance. It was more than three years since his last visit, and for this he offered the lame excuse that the political situation in Russia was too uncertain, which apparently would not permit even the briefest absence of a small businessman while it allowed hundreds of thousands of Russians to travel peacefully abroad. Bu
Axelrod really wanted me to do this on teleprompter -- but I told him I'm much better when I wing it. I know these evenings run long, so I'm going to be brief. Talk about the audacity of hope. President Obama does send his greetings, though. He can't be here tonight -- because he's busy getting ready for Easter. He thinks it's about him
My record stands for itself. I never say anything I don't mean. Everybody knows whatever I say, I do. And my whole life has been devoted to leveling the playing field for middle-class people, giving them an even break, treating Main Street and Wall Street the same, holding the same responsibility. Look at my record. It's been all about the middle class. They're the people who grow this country. We think you grow this country from the middle out, not from the top down.
My fellow Democrats, and my favorite Democrat.
Jilly, I want you to know that Beau, Hunt, Ashley, and I are so proud of you. We admire the way you treat every single student who walks into your classroom. You not
Install
=============
Here's what you need to know to get a laptop to run HedyNet locally. The following notes were assembled on a Mac running OSX 10.7.5, Macports, and Python 2.7.1. It assumes you have figured out how to download a copy of HedyNet from github.
Requirements
-----------------
(see the requirements files in the requirements/ folder)
- Pip