Skip to content

Instantly share code, notes, and snippets.

Russell Jurney rjurney

Block or report user

Report or block rjurney

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ntrepid8
ntrepid8 / cron_speedtest.sh
Created Jun 28, 2017
Script to run speedtest-cli via cron and log the results
View cron_speedtest.sh
#!/usr/bin/env bash
LOG_PATH="/home/$(whoami)/log/speedtest.log"
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}"
else
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"
wget https://github.com/Medium/phantomjs/releases/download/v2.1.1/$PHANTOM_JS.tar.bz2
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
rjurney / gist:5570095
Last active Dec 17, 2015
A github ForkEvent as a Pig map via elephant-bird and ILLUSTRATE
View gist:5570095
{
id=1509192740,
repo=[
id#3094885,
name#oetiker/jquery.EmbedPicasaGallery,
url#https://api.github.dev/repos/oetiker/jquery.EmbedPicasaGallery
],
created_at=2012-01-04T20:17:45Z,
payload=[
forkee#
@rjurney
rjurney / convert_to_scikit.py
Last active Dec 16, 2015
How to convert a pile of pig training data into the format scikit expects :)
View convert_to_scikit.py
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
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
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
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
rjurney / flask_splat.py
Created Dec 11, 2012
How do I do this splatization in Flask without being SO FREAKING UGLY?
View flask_splat.py
# 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)
@app.route("/emails/<int:offset1>/<int:offset2>")
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.