This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
characters = load 'example.pig' using XMLLoader('character'); | |
describe characters | |
{properties:map[], name:chararray, born:datetime, qualification:chararray} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
characters = load 'example.xml' using XMLLoader('character'); | |
describe characters | |
{properties:map[], name:chararray, born:datetime, qualification:chararray} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
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# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# save history to ~/.bash_history as soon as command is run | |
export PROMPT_COMMAND='history -a' | |
# save unlimited history | |
# osx doesn't seem to respect =-1 or = options | |
export HISTSIZE=9999999999 | |
export HISTFILESIZE=999999999 | |
# osx doesn't actually respect this and it'll fall back to unix timestamp (which we want) | |
export HISTTIMEFORMAT="%d/%m/%y %T " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |