Skip to content

Instantly share code, notes, and snippets.

I may be slow to respond.

Ravi rskumar

I may be slow to respond.
View GitHub Profile
import collections
import json
import redis
import threading
from tornado import gen
from tornado import ioloop
from tornado import web
from tornado.options import define
from tornado.options import options
import tornadoredis
rskumar /
Created Apr 16, 2016
Mozilla cornice api request validation with Schematics model
# coding: utf8
from schematics.models import ModelMeta
from schematics.exceptions import ModelValidationError
def validate_model(model):
Validate cornice api request against given schematics `model`
:param model: Schematics model
rskumar / statistics.sql
Created Feb 22, 2016 — forked from ruckus/statistics.sql
Postgres statistics queries
View statistics.sql
** Find commmonly accessed tables and their use of indexes:
SELECT relname,seq_tup_read,idx_tup_fetch,cast(idx_tup_fetch AS numeric) / (idx_tup_fetch + seq_tup_read) AS idx_tup_pct FROM pg_stat_user_tables WHERE (idx_tup_fetch + seq_tup_read)>0 ORDER BY idx_tup_pct;
Returns output like:
relname | seq_tup_read | idx_tup_fetch | idx_tup_pct
schema_migrations | 817 | 0 | 0.00000000000000000000
user_device_photos | 349 | 0 | 0.00000000000000000000
View designer.html
<link rel="import" href="../topeka-elements/theme.html">
<link rel="import" href="../topeka-elements/topeka-resources.html">
<link rel="import" href="../topeka-elements/topeka-app.html">
<polymer-element name="my-element">
:host {
position: absolute;