Skip to content

Instantly share code, notes, and snippets.

Avatar

Damon Snyder drsnyder

View GitHub Profile
@drsnyder
drsnyder / qubole.py
Last active Sep 12, 2016
Qubole to CSV
View qubole.py
__author__ = 'minesh'
from optparse import OptionParser
from qds_sdk.commands import *
from io import *
class ResultsFP:
def __init__(self, filename):
self.filename = filename
def write(self, res):
@drsnyder
drsnyder / trending-threads.json
Created Jun 16, 2016
Trending threads JSON payload
View trending-threads.json
@drsnyder
drsnyder / client-poc.js
Created Nov 6, 2015
JS client for evaluating proof-of-work cost
View client-poc.js
var argv = require('minimist')(process.argv.slice(2));
var cjs = require('cryptojs');
var s = require('sprintf-js');
var sha1 = cjs.Crypto.SHA1;
var repeatString = function(s, n) {
var ret = '';
for (i = 0; i < n; i++) {
ret += s;
@drsnyder
drsnyder / registry-example.php
Created Jun 18, 2015
Service registry singleton
View registry-example.php
// setup your dependency graph
\Wikia\Services\ServiceRegistry::instance()->setUserPreferenceService($fakePreferenceService)
function doSomethingWithPreferences() {
// ...
\Wikia\Services\ServiceRegistry::instance()->getUserPreferenceService()
->setPreference($userId, $name, $value);
// ...
}
@drsnyder
drsnyder / pandora-article.json
Last active Aug 29, 2015
Pandora reference JSON from `/muppet/articles/Kermit+the+Frog?embed=[users]&renderType=mobile`
View pandora-article.json
{
"_links": {
"self": {
"href": "/muppet/articles/Kermit the Frog"
},
"comments": [
{
"href": "/muppet/articles/Kermit the Frog/comments"
}
],
@drsnyder
drsnyder / kemit-the-frog.json
Created Jan 8, 2015
Mercury article JSON payload.
View kemit-the-frog.json
{
"data": {
"details": {
"id": 50,
"title": "Kermit the Frog",
"ns": 0,
"url": "\/wiki\/Kermit_the_Frog",
"revision": {
"id": 786536,
"user": "Mrmegapig",
@drsnyder
drsnyder / varnishlog.txt
Created Oct 30, 2014
Request to vignette
View varnishlog.txt
2242 ReqStart c 74.120.190.15 59269 857607622
2242 RxRequest c GET
2242 RxURL c /vampirediaries/images/2/27/The-originals-season-2-red-door-photos-5.jpg/revision/latest/zoom-crop/width/240/height/240?cb=2014102201002
3
2242 RxProtocol c HTTP/1.1
2242 RxHeader c Accept: image/webp,*/*;q=0.8
2242 RxHeader c User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.94 Safari/537.36
2242 RxHeader c Referer: http://vampirediaries.wikia.com/wiki/Red_Door
2242 RxHeader c Accept-Language: en-GB,en;q=0.8,en-US;q=0.6,en;q=0.4
2242 RxHeader c Fastly-Client-IP: 103.245.70.78
View legolas.json
{
"@context" : "http://schema.org",
"@type" : "Article",
"name" : "Legolas",
"image" : "http://img1.wikia.nocookie.net/__cb20070715152604/lotr/images/d/d7/Tengwar_Legolas.png",
"url" : "http://lotr.wikia.com/wiki/Legolas",
"publisher" : {
"@type" : "Organization",
"name" : "[Wikia]"
}
View netflix.xml
<link href="http://api-public.netflix.com/catalog/titles/series/70023522/cast" rel="http://schemas.netflix.com/catalog/people" title="cast">
<cast>
<link href="http://api-public.netflix.com/catalog/people/30011713" rel="http://schemas.netflix.com/catalog/person" title="Steve Carell"/>
<link href="http://api-public.netflix.com/catalog/people/30014922" rel="http://schemas.netflix.com/catalog/person" title="John Krasinski"/>
<link href="http://api-public.netflix.com/catalog/people/20047634" rel="http://schemas.netflix.com/catalog/person" title="Jenna Fischer"/>
<link href="http://api-public.netflix.com/catalog/people/20028105" rel="http://schemas.netflix.com/catalog/person" title="Rainn Wilson"/>
</cast>
</link>
View api.json
{
"items": {
"19192": {
"id": 19192,
"title": "Hitman Absolution Full Disclosure Trailer",
"ns": 6,
"url": "/File:Hitman_Absolution_Full_Disclosure_Trailer",
"revision": {
"id": 37872,
"user": "TheBlueRogue",