http://www.jitbit.com/news/181-jitbits-sql-interview-questions/
employees
- employee_id
- department_id
- boss_id
- name
-- show running queries (pre 9.2) | |
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
FROM pg_stat_activity | |
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- show running queries (9.2) | |
SELECT pid, age(clock_timestamp(), query_start), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
#!/usr/bin/env python | |
""" | |
Feed this program line-oriented JSON tweet data (as received from the API) | |
on STDIN and get unshortened URLs mentioned in the tweets on STDOUT. | |
This module will look up multiple urls at once using the multiprocessing | |
library. Change CONCURRENCY to have more or less processes, defaults to 10. | |
""" |
#!flask/bin/python | |
from flask import Flask, jsonify, abort, request, make_response, url_for | |
from flask_httpauth import HTTPBasicAuth | |
app = Flask(__name__, static_url_path = "") | |
auth = HTTPBasicAuth() | |
@auth.get_password | |
def get_password(username): | |
if username == 'miguel': |
http://www.jitbit.com/news/181-jitbits-sql-interview-questions/
employees
/* | |
* L.SingleTile uses L.ImageOverlay to display a single-tile WMS layer. | |
* url parameter must accept WMS-style width, height and bbox. | |
*/ | |
L.SingleTile = L.ImageOverlay.extend({ | |
defaultWmsParams: { | |
service: 'WMS', | |
request: 'GetMap', | |
version: '1.1.1', |
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
""" | |
WSGI middleware to record requests and responses. | |
""" | |
from __future__ import print_function, unicode_literals | |
import logging |
goog.provide('L.SingleTileWMSLayer'); | |
goog.require('L.Map'); | |
L.SingleTileWMSLayer = L.ImageOverlay.extend({ | |
defaultWmsParams: { | |
service: 'WMS', | |
request: 'GetMap', | |
version: '1.1.1', |
-- Decoding | |
SELECT CONVERT_FROM(DECODE(field, 'BASE64'), 'UTF-8') FROM table; | |
-- Encoding | |
SELECT ENCODE(CONVERT_TO(field, 'UTF-8'), 'base64') FROM table; |
#!/usr/bin/python | |
import unittest | |
import time | |
from throttle import throttle | |
class TestThrottle(unittest.TestCase): | |
@throttle(1) | |
def increment(self): |
#!/usr/bin/env python | |
import sys | |
import logging | |
import tornado.log | |
# For pretty log messages, if available | |
try: | |
import curses | |
except ImportError: | |
curses = None |