Skip to content

Instantly share code, notes, and snippets.

View rskumar's full-sized avatar
💭
I may be slow to respond.

Ravi rskumar

💭
I may be slow to respond.
View GitHub Profile
@rskumar
rskumar / designer.html
Last active August 29, 2015 14:11
designer
<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;
@rskumar
rskumar / statistics.sql
Created February 22, 2016 21:15 — forked from ruckus/statistics.sql
Postgres statistics queries
** 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
@rskumar
rskumar / validation.py
Created April 16, 2016 22:17
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
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