Skip to content

Instantly share code, notes, and snippets.

View rjurney's full-sized avatar

Russell Jurney rjurney

View GitHub Profile
@rjurney
rjurney / worker.txt
Created December 28, 2014 23:49
dh -h on worker
Russells-MacBook-Pro-OLD:~ rjurney$ ssh chimpy@localhost -p 9122
Warning: Permanently added '[localhost]:9122' (RSA) to the list of known hosts.
chimpy@localhost's password:
Last login: Sun Nov 23 04:42:12 2014 from 172.17.0.13
chimpy@worker00:~$ df -h
Filesystem Size Used Avail Use% Mounted on
rootfs 19G 16G 1.5G 92% /
none 19G 16G 1.5G 92% /
tmpfs 2.7G 0 2.7G 0% /dev
shm 64M 8.0K 64M 1% /dev/shm
@rjurney
rjurney / death.pig
Last active August 29, 2015 14:14
How to assassinate Pig on any system - see line 4
sorted_asset_views = FOREACH (GROUP thing_views BY user_id) {
sorted_by_time_ids = ORDER thing_views BY datetime_viewed DESC;
most_recent_100 = LIMIT sorted_by_time_ids 100;
sorted_recent_100 = ORDER most_recent_100 BY datetime_viewed;
GENERATE group AS user_id, sorted_recent_100.(asset_id, asset_title, series_title, datetime_viewed) AS sorted_by_time_ids;
};
@rjurney
rjurney / fuck.sh
Created February 12, 2015 20:40
In JRuby/Ruby bundler hell
Russells-MacBook-Pro-OLD:marketing_web rjurney$ bundle install
Your jruby version is 1.7.19, but your Gemfile specified jruby 1.7.18
Russells-MacBook-Pro-OLD:marketing_web rjurney$ rvm use jruby-1.7.18
Using /Users/rjurney/.rvm/gems/jruby-1.7.18
Russells-MacBook-Pro-OLD:marketing_web rjurney$ jruby -v
jruby 1.7.19 (1.9.3p551) 2015-01-29 20786bd on Java HotSpot(TM) 64-Bit Server VM 1.7.0_40-b43 +jit [darwin-x86_64]
Russells-MacBook-Pro-OLD:marketing_web rjurney$ which jruby
/Users/rjurney/.rvm/rubies/jruby-1.7.18/bin/jruby
@rjurney
rjurney / create_load_statement.py
Created February 13, 2015 01:43
Create Pig LOAD statement from CSV
import sys, os, re
line = sys.stdin.readline()
columns = line.rstrip("\n").split("|")
load_statement = "full_dump = LOAD 'data/FullDump_clean.csv' AS (\n"
for column in columns:
load_statement += "\t{}:chararray, \n".format(column)
load_statement = load_statement[:-3]
load_statement += "\n);"
print load_statement
@rjurney
rjurney / fucked.js
Created February 20, 2015 04:16
Why can't I make addRow a normal function?
var addRow = function() {
}
$("#plus_button_1").click(addRow);
@rjurney
rjurney / jinq.js
Created April 4, 2015 21:28
Trying out jinqJs
var people = [{Name: 'Tom', Age: 15, Location: 'Port Jefferson'},
{Name: 'Jen', Age: 30, Location: 'Huntington'},
{Name: 'Diana', Age: 5, Location: 'Huntington'}];
console.log(jinqJs().from(people).groupBy('Location').sum('Age').orderBy([{field: 'Age', sort: 'desc'}]).select());
[Object, Object]
0: Object
Age: 35
@rjurney
rjurney / bsonRead.groovy
Last active August 29, 2015 14:18
How the hell do you use BsonBinaryReader?
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
@rjurney
rjurney / bson_to_titan.groovy
Created April 7, 2015 20:49
Loading Titan from BSON Data
import java.io.FileInputStream;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import org.bson.BsonBinaryReader;
// Setup BSON Reading of MongoDB mongodump data
filename = "/Users/rjurney/Software/marketing/dump/relato/companies.bson";
fIn = new FileInputStream(filename);
fChan = fIn.getChannel();
@rjurney
rjurney / k-core.py
Created June 21, 2015 04:06
Naive implementation of k-core
k = 3
nodes = {}
cgraph = graph.copy()
changes = True
while changes is not False:
changes = False
for node in cgraph.nodes():
if cgraph.in_degree(node) < k:
cgraph.remove_node(node)
changes = True
@rjurney
rjurney / cluster.tsv
Created June 28, 2015 23:01
What do these 20 companies have in common?
We can make this file beautiful and searchable if this error is corrected: No tabs found in this TSV file in line 0.
4 accenture.com 0.00302655705823
4 tibco.com 0.00242683250068
4 capgemini.com 0.00241365642793
4 salesforce.com 0.00237525137745
4 cognizant.com 0.00210109531292
4 opentext.com 0.0019762154224
4 carahsoft.com 0.00174258359131
4 redlinetrading.com 0.00156127741025
4 infor.com 0.00155154297355
4 ciber.com 0.00153249268069