Skip to content

Instantly share code, notes, and snippets.

Russell Jurney rjurney

View GitHub Profile
ntrepid8 /
Created Jun 28, 2017
Script to run speedtest-cli via cron and log the results
#!/usr/bin/env bash
if result=$(/usr/bin/speedtest --simple); then
parsed_result=$(printf "${result}\"" | sed ':a;N;$!ba;s/\n/" /g' | sed 's/: /="/g')
printf "[$(date)] ${parsed_result}\n" >> "${LOG_PATH}"
printf "[$(date)] error\n" >> "${LOG_PATH}"
exit 1
View install phantomjs 2.1.1 - ubuntu
sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev -y
sudo apt-get install libfreetype6 libfreetype6-dev -y
sudo apt-get install libfontconfig1 libfontconfig1-dev -y
cd ~
export PHANTOM_JS="phantomjs-2.1.1-linux-x86_64"
sudo tar xvjf $PHANTOM_JS.tar.bz2
sudo mv $PHANTOM_JS /usr/local/share
sudo ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/bin
rjurney / gist:5570095
Last active Dec 17, 2015
A github ForkEvent as a Pig map via elephant-bird and ILLUSTRATE
View gist:5570095
rjurney /
Last active Dec 16, 2015
How to convert a pile of pig training data into the format scikit expects :)
import sys, os
import numpy as np
from collections import defaultdict
from operator import itemgetter
from sklearn.naive_bayes import GaussianNB
# live 1 classic pop and rock
# onli 2 classic pop and rock
# tri 1 classic pop and rock
# keep 3 classic pop and rock
rjurney / classify.pig
Created Apr 10, 2013
Biggest ILLUSTRATE I've ever had work :)
View classify.pig
register /me/Software/elephant-bird/pig/target/elephant-bird-pig-3.0.6-SNAPSHOT.jar
register /me/Software/pig/build/ivy/lib/Pig/json-simple-1.1.jar
set elephantbird.jsonloader.nestedLoad 'true'
/* Remove files from previous runs */
rmf /tmp/prior_words.txt
rmf /tmp/prior_genres.txt
rmf /tmp/p_word_given_genre.txt
rmf /tmp/p_genre_given_word.txt
rjurney / example.pig
Created Dec 24, 2012 — forked from anonymous/Example.pig
I want to extend Pig's existing XMLLoader to go beyond capturing the text inside a tag and to actually create a Pig mapping of the Document Object Model the XML represents. This would be similar to elephant-bird's JsonLoader. Semi-structured data can vary, so this behavior can be risky but... I want people to be able to load JSON and XML data ea…
View example.pig
characters = load 'example.xml' using XMLLoader('character');
describe characters
{properties:map[], name:chararray, born:datetime, qualification:chararray}
anonymous / Example.pig
Created Dec 24, 2012
Mapping the XML DOM to a Pig schema
View Example.pig
characters = load 'example.pig' using XMLLoader('character');
describe characters
{properties:map[], name:chararray, born:datetime, qualification:chararray}
rjurney /
Created Dec 11, 2012
How do I do this splatization in Flask without being SO FREAKING UGLY?
# Enable /emails and /emails/ to serve the last 20 emaildb in our inbox unless otherwise specified
default_offsets={'offset1': 0, 'offset2': 0 + config.EMAIL_RANGE}
@app.route('/', defaults=default_offsets)
@app.route('/emails', defaults=default_offsets)
@app.route('/emails/', defaults=default_offsets)
def list_emaildb(offset1, offset2):
offset1 = int(offset1)
offset2 = int(offset2)
emails = emaildb.find()[offset1:offset2] # Uses a MongoDB cursor
You can’t perform that action at this time.