Credit for this goes to the Stack Overflow user Statistic Dean for his post on this question
(base)$ conda install -c conda-forge nb_conda_kernels
""" | |
Temporal Proxy | |
(c) Looking Glass Solutions 2007 | |
Licensed under GPL v2 | |
""" | |
## SQL COMMANDS: http://www.postgresql.org/docs/8.3/interactive/sql-commands.html | |
## USE PSYCO | |
# Importing the required modules |
Credit for this goes to the Stack Overflow user Statistic Dean for his post on this question
(base)$ conda install -c conda-forge nb_conda_kernels
# simpleSQL.py | |
# | |
# simple demo of using the parsing library to do simple-minded SQL parsing | |
# could be extended to include where clauses etc. | |
# | |
# Copyright (c) 2003, Paul McGuire | |
# | |
from pyparsing import Literal, CaselessLiteral, Word, Upcase, delimitedList, Optional, \ | |
Combine, Group, alphas, nums, alphanums, ParseException, Forward, oneOf, quotedString, \ | |
ZeroOrMore, restOfLine, Keyword |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/> | |
<script type="text/javascript" src="http://mbostock.github.io/d3/talk/20111018/d3/d3.js"></script> | |
<script type="text/javascript" src="http://mbostock.github.io/d3/talk/20111018/d3/d3.geom.js"></script> | |
<script type="text/javascript" src="http://mbostock.github.io/d3/talk/20111018/d3/d3.layout.js"></script> | |
<style type="text/css"> | |
circle { |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/> | |
<script type="text/javascript" src="http://mbostock.github.io/d3/talk/20111018/d3/d3.js"></script> | |
<script type="text/javascript" src="http://mbostock.github.io/d3/talk/20111018/d3/d3.geom.js"></script> | |
<script type="text/javascript" src="http://mbostock.github.io/d3/talk/20111018/d3/d3.layout.js"></script> | |
<style type="text/css"> | |
circle { |
-- In pg_stat_statements, there is a problem: sometimes (quite often), it registers the same query twice (or even more). | |
-- It's easy to check in your DB: | |
-- | |
-- with heh as ( | |
-- select userid, dbid, query, count(*), array_agg(queryid) queryids | |
-- from pg_stat_statements group by 1, 2, 3 having count(*) > 1 | |
-- ) select left(query, 85) || '...', userid, dbid, count, queryids from heh; | |
-- | |
-- This query gives you "full picture", aggregating stats for each query-database-username ternary |
HTTP request limiting =================================================================================================================== | |
frontend ft_web | |
# Use General Purpose Couter (gpc) 0 in SC1 as a global abuse counter | |
# Monitors the number of request sent by an IP over a period of 10 seconds | |
stick-table type ip size 1m expire 10s store gpc0,http_req_rate(10s) | |
tcp-request connection track-sc1 src | |
# refuses a new connection from an abuser | |
tcp-request content reject if { src_get_gpc0 gt 0 } |
Region Name Region Latency | |
EU (Frankfurt) eu-central-1 305ms | |
Asia Pacific (Tokyo) ap-northeast-1 716ms | |
EU (Ireland) eu-west-1 770ms | |
US West (N. California) us-west-1 927ms | |
US East (N. Virginia) us-east-1 1048ms | |
Asia Pacific (Seoul) ap-northeast-2 1066ms | |
US West (Oregon) us-west-2 1098ms | |
Asia Pacific (Singapore) ap-southeast-1 1242ms | |
South America (Sao Paulo) sa-east-1 1266ms |
The first 15 seconds of the D3 show reel. See full video at http://vimeo.com/29862153. Includes seamless transitions between the following visualization types:
#!/usr/bin/env python | |
#coding: utf-8 | |
import calendar, datetime, time, itertools | |
from itertools import cycle, starmap | |
class ReleaseCal(calendar.HTMLCalendar): | |
def __init__(self, groups, offset=0, skip_list=None): | |
super(ReleaseCal, self).__init__() | |
self.skip_list = skip_list if skip_list is not None else [] |