Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/python3
from google.cloud import bigquery
import re
import requests
import os
import json
from redash_client.client import RedashClient
import csv
#!/usr/bin/python3
from google.cloud import bigquery
import re
DATASET = 'telemetry'
TABLE_IDS = [
import argparse
import logging
import apache_beam as beam
import apache_beam.transforms.window as window
from apache_beam.transforms.core import Filter
from apache_beam.examples.wordcount import WordExtractingDoFn
from apache_beam.options.pipeline_options import PipelineOptions
from apache_beam.options.pipeline_options import SetupOptions
from apache_beam.options.pipeline_options import StandardOptions
import boto3
import click
import re
import threading
from time import sleep
from queue import Queue
from itertools import ifilter
class DateMatchWorker(threading.Thread):
import argparse
import csv
import json
BASE_SCHEMA = {
"eventGroupName": "dt",
"filters": {
"docType": [
"main"
#!/usr/bin/python
from datetime import datetime, timedelta
import argparse
import threading
import Queue
import subprocess
fmt = "%Y%m%d"
FROM_PATH = "telemetry-parquet"
@sunahsuh
sunahsuh / download_spark_log.sh
Created November 21, 2017 17:50
Download the driver's spark log given a cluster id
# Usage: download_spark_log.sh j-XXXXXXX <optional download path>
# Required: aws cli and jq
cluster=$1
# Optional second argument defaults to .
dlLoc=${2:-\.}
instance=$(aws emr list-instances --cluster-id "$cluster" --instance-group-types MASTER | jq -r '.Instances[0].Ec2InstanceId')
logLocs3n=$(aws emr describe-cluster --cluster-id $cluster | jq -r '.Cluster.LogUri')
logLoc=${logLocs3n//s3n:/s3:}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sunahsuh
sunahsuh / rdio.js
Last active November 18, 2015 01:25
Rdio Playlist -> CSV bookmarklet (scroll through your entire playlist to make sure the whole thing has been loaded in the rdio tab)
javascript:(function() {
var bookmarklet = {
init: function() {
this.parse();
},
parse: function() {
page = "";
$(".Track:visible")
.children(".info")
.each(function() {
index
4
p iteration
0, p iteration
1, index
5
p iteration
0, p iteration
0, p iteration
1, 0, p iteration