I hereby claim:
- I am r on github.
- I am raffi (https://keybase.io/raffi) on keybase.
- I have a public key whose fingerprint is B262 7921 28F9 D515 ACED 1781 F4FC 2692 B6C6 98A5
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
# run the 'host' command, but timeout after 30 seconds. | |
# | |
# args: | |
# - parameter to pass to 'host' | |
# - file to send output of 'host' to | |
# | |
# returns: | |
# 1 => lookup timedout | |
# 0 => successful run | |
function timeout_host() { |
register /home/raffi/appprofiler/commons-lang-2.5.jar; | |
register /home/raffi/appprofiler/scala-library.jar; | |
register /home/raffi/appprofiler/appprofiler_2.7.7-1.0.jar; | |
test_data = load 'test.tsv' as (first, second); | |
distances = foreach test_data { | |
distance = com.twitter.appprofiler.pig.piggybank.LevenshteinDistance(first, second); | |
generate distance, first, second; | |
}; |
package com.twitter.appprofiler.pig.piggybank | |
import org.apache.commons.lang.StringUtils | |
import org.apache.pig.{EvalFunc, FuncSpec, PigWarning} | |
import org.apache.pig.backend.executionengine.ExecException | |
import org.apache.pig.data.{DataByteArray, Tuple} | |
import java.io.IOException | |
import java.util.{List => JList} |
package com.twitter.appprofiler.pig.piggybank; | |
import org.apache.commons.lang.StringUtils; | |
import org.apache.pig.EvalFunc; | |
import org.apache.pig.PigWarning; | |
import org.apache.pig.backend.executionengine.ExecException; | |
import org.apache.pig.data.DataByteArray; | |
import org.apache.pig.data.Tuple; | |
import java.io.IOException; |
--- | |
tests: | |
inputs: | |
- 23456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abc | |
- !binary | | |
ZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXp7fH1+f8KAwoHCgsKDwoTChcKGwofC | |
iMKJworCi8KMwo3CjsKPwpDCkcKSwpPClMKV | |
- !binary | | |
wpbCl8KYwpnCmsKbwpzCncKewp/CoMKhwqLCo8KkwqXCpsKnwqjCqcKqwqvC |
jQuery.twstreamer | |
.init() | |
.credentials(USERNAME, PASSWORD) | |
.connect( | |
function(tweet) { | |
// receive tweet | |
console.log(tweet); | |
}, | |
'track', // api method (track, follow, etc.) | |
'twitter', // api query |
#!/usr/bin/env ruby | |
# update_profile_background_image.rb | |
# | |
# a simple example of how to construct the OAuth signatures necessary to upload | |
# a background image to a Twitter profile page. this will call | |
# account/update_profile_background_image.xml with the contents of | |
# 'background.png' (must be in the same directory as this script). care has | |
# been given to document this script, as well as to correlate lines in this | |
# script with the OAuth Core 1.0 specification (http://oauth.net/core/1.0/). |
function xmlcurl { | |
curl -s $1 | tidy -xml -i -w 0 -q | |
} | |
YAHOO_API_ENDPOINT="http://where.yahooapis.com/v1" | |
# get this APP_ID from http://developer.yahoo.com/geo/geoplanet/ | |
YAHOO_APP_ID=FILL YOUR APP ID HERE | |
# lookup a string and find a matching WOEID | |
function woeid_search { | |
LOC=$(echo -n "$1" | perl -pe's/([^-_.~A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg'); |
def significant_figures(num) | |
sn = num.to_s.sub(/e[-+]*\d+$/i, '') # remove the scientific notation | |
sn = sn.sub(/0*$/, '') unless sn.include?('.') # remove any trailing zeros | |
sn.sub('.', '').sub(/^[-+]?0*/, '').length # remove the sign, leading zeros | |
end |