This file contains hidden or 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 os,sys,re,math | |
from getopt import getopt | |
from glob import glob | |
from os.path import basename | |
import itertools | |
import string | |
SQL_COMMENT = re.compile("-- .*") |
This file contains hidden or 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
from math import log, ceil | |
v = int("9"*38) | |
x = "%x" % v | |
print x | |
print (len(x)/2)*8 | |
log2 = lambda a : log(a)/log(2) |
This file contains hidden or 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, re, math, string | |
from os.path import basename | |
import json | |
class Desc(object): | |
def __init__(self, fname): | |
f = basename(fname) | |
self.f = f.replace(".desc.txt","") | |
partcol = False | |
cols = [] |
This file contains hidden or 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, re, math, os | |
from socket import gethostbyname | |
def main(args): | |
lines = [l.strip() for a in args for l in open(a)] | |
print "\n".join(["\t".join([gethostbyname(l),l]) for l in lines]) | |
main(sys.argv[1:]) |
This file contains hidden or 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, re, math, os | |
from xml.dom.minidom import parse | |
from collections import namedtuple | |
Sample = namedtuple("Sample", ['query', 'duration', 'success', 'end', 'start', 'user']) | |
RUN_NUM = re.compile(r'(?P<query>.*\.sql)(_(?P<run>[0-9]*))?') | |
def runid(q): | |
m = RUN_NUM.match(q) | |
return (m.group('query'), int(m.group('run'))) |
This file contains hidden or 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
analyze table call_center compute statistics for columns | |
analyze table catalog_page compute statistics for columns | |
analyze table catalog_returns compute statistics for columns | |
analyze table catalog_sales compute statistics for columns | |
analyze table customer compute statistics for columns | |
analyze table customer_address compute statistics for columns | |
analyze table customer_demographics compute statistics for columns | |
analyze table date_dim compute statistics for columns | |
analyze table household_demographics compute statistics for columns |
This file contains hidden or 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 re | |
from itertools import groupby | |
print """ | |
mvn clean package install -DskipTests=true -Phadoop-2 | |
cd itests | |
mvn clean | |
""" | |
s = """ |
This file contains hidden or 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 re, sys | |
NX = True | |
try: | |
import networkx as nx | |
except: | |
NX = False | |
sys.stderr.write("Could not import nx\npip install networkx, please\n") | |
plan39 = """ | |
Map 1 <- Map 5 (BROADCAST_EDGE), Map 6 (BROADCAST_EDGE), Map 8 (BROADCAST_EDGE), Reducer 7 (BROADCAST_EDGE), Reducer 9 (BROADCAST_EDGE) |
This file contains hidden or 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 yum | |
yb = yum.YumBase() | |
yb.setCacheDir() | |
pkgs=[p for p in yb.pkgSack.returnNewestByNameArch(patterns='*.rpm') if 'HDP' in p.repoid] | |
for p in pkgs: | |
print "wget -c ", p.remote_url |
This file contains hidden or 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, re, os, math | |
import dpkt | |
import socket | |
from collections import defaultdict | |
def ip_str(ip): | |
return socket.inet_ntoa(ip) | |
class Connection(object): | |
def __init__(self): |