Skip to content

Instantly share code, notes, and snippets.

@shantanuo
shantanuo / index.html
Created February 10, 2014 08:20 — forked from insin/index.html
<!DOCTYPE html>
<html>
<head>
<title>tableToExcel Demo</title>
<script src="tableToExcel.js"></script>
</head>
<body>
<h1>tableToExcel Demo</h1>
<p>Exporting the W3C Example Table</p>
@shantanuo
shantanuo / index.html
Created February 10, 2014 08:45 — forked from insin/index.html
<!DOCTYPE html>
<html>
<head>
<title>tableToExcel Demo</title>
<script src="tableToExcel.js"></script>
</head>
<body>
<h1>tableToExcel Demo</h1>
<p>Exporting the W3C Example Table</p>
-- Provide a log file debugging statement.
SELECT 'DROP PROCEDURE IF EXISTS dropForeignKeys';
-- Conditionally drop the procedure.
DROP PROCEDURE IF EXISTS dropForeignKeys;
-- Provide a log file debugging statement.
SELECT 'CREATE PROCEDURE dropForeignKeys';
-- Change delimiter to create procedure.
#! /usr/bin/env python
import json
import requests
def process(obj, ds):
data = {}
values = obj[ds]['value']
index = obj[ds]['dimension'][obj[ds]['dimension']['id'][1]]['category']['index']
labels = obj[ds]['dimension'][obj[ds]['dimension']['id'][1]]['category']['label']
#! /usr/bin/env python
import json
import requests
def process(obj, ds):
data = {}
values = obj[ds]['value']
index = obj[ds]['dimension'][obj[ds]['dimension']['id'][1]]['category']['index']
labels = obj[ds]['dimension'][obj[ds]['dimension']['id'][1]]['category']['label']
import argparse
import json
import time
import boto.ec2
# Set up argument parser
parser = argparse.ArgumentParser(
description='Request AWS EC2 spot instance and tag instance and volumes.',
$ cd /tmp
$ echo "foo bar baz foo foo quz" > test1
$ echo "bar bar foo bar baz foo quz foo foo" > test2
$ sed -i '.bak' 's/foo/replaced/g' test*
$ tail test1 test2
==> test1 <==
replaced bar baz replaced replaced quz
==> test2 <==
bar bar replaced bar baz replaced quz replaced replaced
import psutil
import simplejson
import time
import urllib2
# Sends the CPU and memory usage stats to Loggly. Sends both a machine total and per process.
def log():
""""""
proc_dict = {}
#!/usr/bin/python
#
# Convert a Row-Based-Replication binary log to Statement-Based-Replication format, cheating a little.
# This script exists since Percona Toolkit's pt-query-digest cannot digest RBR format. The script
# generates enough for it to work with.
# Expecting standard input
# Expected input is the output of "mysqlbinlog --verbose --base64-output=DECODE-ROWS <binlog_file_name>"
# For example:
# $ mysqlbinlog --verbose --base64-output=DECODE-ROWS mysql-bin.000006 | python binlog-rbr-to-sbr.py | pt-query-digest --type=binlog --order-by Query_time:cnt --group-by fingerprint
#
from parse_conn import parse_connection
import unittest
class InvalidInputs(unittest.TestCase):
def testNoAt(self):
"""parse_connection should raise an exception
for an invalid connection string"""
self.assertRaises(ValueError, parse_connection, 'invalid uri')
if __name__ == "__main__":