start new:
tmux
start new with session name:
tmux new -s myname
""" | |
twisted async/await with asyncio reactor and uvloop | |
""" | |
import asyncio | |
import uvloop | |
from asyncio.tasks import ensure_future | |
try: | |
# as per github source the asyncio reactor is intended to be released in future version |
var http = require('http'); | |
var url = require('url'); | |
var portNumber = Number(process.argv[2]); | |
function parseTime(time) { | |
return { | |
hour: time.getHours(), | |
minute: time.getMinutes(), | |
second: time.getSeconds() | |
} |
# -*- coding: utf-8 -*- | |
""" | |
Flask-Login example | |
=================== | |
This is a small application that provides a trivial demonstration of | |
Flask-Login, including remember me functionality. | |
:copyright: (C) 2011 by Matthew Frazier. | |
:license: MIT/X11, see LICENSE for more details. | |
""" |
import mimerender | |
mimerender.register_mime('pdf', ('application/pdf',)) | |
mimerender = mimerender.FlaskMimeRender(global_charset='UTF-8') | |
def render_pdf(html): | |
from xhtml2pdf import pisa | |
from cStringIO import StringIO | |
pdf = StringIO() | |
pisa.CreatePDF(StringIO(html.encode('utf-8')), pdf) |
-- 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%' |
A warning occurred (42 apples) | |
An error occurred |