Skip to content

Instantly share code, notes, and snippets.

View harrisj's full-sized avatar

Jacob Harris harrisj

View GitHub Profile
--- a/subversion-1.6.5/Makefile 2009-09-23 16:34:05.000000000 -0400
+++ b/subversion-1.6.5/Makefile 2009-09-23 17:53:37.000000000 -0400
@@ -41,8 +41,8 @@
-SVN_APR_LIBS = -L/usr/lib -R/usr/lib -lapr-1 -lpthread
-SVN_APRUTIL_LIBS = -L/usr/lib -R/usr/lib -laprutil-1 -lsqlite3 -lexpat -liconv
+SVN_APR_LIBS = -L#{HOMEBREW_PREFIX}/lib -L/usr/lib -R/usr/lib -lapr-1 -lpthread
+SVN_APRUTIL_LIBS = -L#{HOMEBREW_PREFIX}/lib -L/usr/lib -R/usr/lib -laprutil-1 -lsqlite3 -lexpat -liconv
SVN_APR_MEMCACHE_LIBS =
SVN_DB_LIBS =
SVN_GNOME_KEYRING_LIBS =
require_dependency 'net/ftp'
class FTPMock
def gettextfile(remote_path, local_path)
test_file = File.join(RAILS_ROOT, 'test', 'data', 'dbready', remote_path)
if !File.exists?(test_file)
raise Net::FTPPermError, test_file + ' not found!'
end
FileUtils.cp test_file, local_path
@harrisj
harrisj / gist:1269322
Created October 7, 2011 02:53
Tweet Sources about Steve Jobs
715944 tweets collected on Wed. night for 80 minutes
Filtering out to clients that had at least 1% of traffic, here is the breakdown
Echofon: 28308 3.95%
Mobile Web: 16266 2.27%
UberSocial for BlackBerry: 47728 6.67%
TweetDeck: 35792 5.00%
Twitter for BlackBerry®: 59479 8.31%
Twitter for iPhone: 136235 19.03%
Twitter for Mac: 12870 1.80%
@harrisj
harrisj / tinyurl_test.rb
Created April 26, 2012 16:44
Testing Punctuation on URL Shorteners
require 'net/http'
# These links were taken from my twitter timeline. No endorsement implied.
tiny_urls = {
'bitly' => ['http://bit.ly/3S9c5K', 'http://developer.nytimes.com/'],
'j.mp' => ['http://j.mp/JsML0u', 'http://www.npr.org/2012/04/26/151303230/an-african-trader-and-the-perils-of-business-in-china'],
'tinyurl' => ['http://tinyurl.com/6rq9vob', 'http://politicsoftheplate.com/?p=1283'],
'owly' => ['http://ow.ly/axesj', 'http://threatpost.com/en_us/blogs/opera-12-beta-released-new-security-features-including-do-not-track-support-042612'],
'ht.ly' => ['http://ht.ly/1j7LiX', 'http://rssfeeds.usatoday.com/~r/usatoday-LifeTopStories/~3/8vFV-fFfhAc/1'],
'is.gd' => ['http://is.gd/gk0FoM', 'http://www.wired.com/dangerroom/2012/04/joe-schmoe-drones/'],
@harrisj
harrisj / article_fetcher.rb
Created June 22, 2012 20:16
Basic code for the nytimes_ebooks
# encoding: UTF-8
require 'rubygems'
require 'rest-client'
require 'nokogiri'
class ArticleFetcher
def self.fetch_text(url)
case url
when /video\.nytimes\.com/
@harrisj
harrisj / gist:4532095
Created January 14, 2013 18:21
Rocky Stracke is a GitHubber. I kid because I love...
1.9.3p327 :005 > 100.times { puts "#{Faker::Name.name} is a GitHubber" }; 0
Sid Littel is a GitHubber
Henri Wuckert is a GitHubber
Annette Ledner is a GitHubber
Mercedes Murray MD is a GitHubber
Rocky Stracke is a GitHubber
Miss Noah Reichel is a GitHubber
Miss Ludie Schaefer is a GitHubber
Mr. Isom Hilll is a GitHubber
Elva Homenick DVM is a GitHubber
@harrisj
harrisj / twitter_moderation
Created March 29, 2013 00:58
Using Twitter as a Content Filtering Interface
One random idea I have been kicking around with in the past is using Twitter as a crowdsourced moderation interface. This is an interesting approach in the following cases:
1. We receive many more potential items than we want to appear on the official, moderated interface.
2. The moderation twitter account is an interesting behind-the-scenes stream for people who are really interested in the content we are moderating down for the final site.
The final site could be another twitter account that posts only the best or anything else really (blog, tumblr, facebook, pinterest, what have you).
This approach won't really work well if you want to filter out questionable content. It's not an obscenity filter but merely a fun way of separating out the most popular items from the stream. How does it work?
For each item you post to the firehose twitter account, you store the following information in your DB:
@harrisj
harrisj / tweet_signatures.md
Last active November 24, 2020 11:03
Tweet Signatures: a simple solution for thwarting forged tweets

A Simple Solution for Faked Tweets

Recently, a somewhat large selection of my timeline was shocked by the discovery that it's simple to make a fake-looking tweet on the web. Some feared it would be only a matter of time before some news organization is suckered by a fake tweet that seems to come from a real source.

Luckily, the solution already exists, and it's something you already use constantly: GNU PrivacyGuard signatures Here is an approach for verifying a tweet is authentic and hasn't been tampered with that is so simple even @KimKardashian could figure it out. To get started, we just need to do a little setup first:

  1. Of course, you have already installed GnuPG for your own use, generated a keypair and uploaded it to a keyserver so that other people can look it up. Its email address must be publicly listed in your twitter profile.
  2. Then, you must collect the public keys of the people you fo
@harrisj
harrisj / meter.rb
Created April 3, 2013 14:47
Some sample code for the term logic in the haiku finder
So, basically, scanning a sentence becomes like this:
1. Split the sentence into words
2. For each word, create a cleaned version (basically strip off quotes and punctuation) and look up in the dictionary.
3. If not found, try a few fallbacks based on stemmming rules or such
4. Otherwise, add the word to a term_misses table.
These code is really ugly (sorry!), and you might notice I actually am talking about meter in it. This is because the background image for the haikus is generated from the meter. But I don't want to do the meter for new words (sorry, syllable is enough), so for those I just return - as the meter (otherwise it's a combination of 1 or 0)
HAIKU (11000 1010011 11110)
@harrisj
harrisj / gist:5320576
Created April 5, 2013 16:18
Here is a recent sample of syllable counts I added to the Haiku Bot
akept 2
alighted 3
apexes 3
atemporal 4
azolla 3
benshi 2
bewigged 2
blarney 2
brocaded 3
bunga 2