Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
I may be slow to respond.

Ravi rskumar

💭
I may be slow to respond.
View GitHub Profile
View tornado_tyron.py
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
rskumar / validation.py
Created Apr 16, 2016
Mozilla cornice api request validation with Schematics model
View validation.py
# 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
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">
<template>
<style>
:host {
position: absolute;