Skip to content

Instantly share code, notes, and snippets.

@fqxp
fqxp / rx_wikipedia_demo.py
Created October 3, 2016 20:19
Demo for using rx with gbulb and asyncio in python
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
import gbulb
import rx
import json
from rx.subjects import Subject
from rx.concurrency import AsyncIOScheduler
from tornado.httpclient import AsyncHTTPClient
from tornado.httputil import url_concat
@fqxp
fqxp / .gtkrc-2.0
Created June 6, 2015 19:18
Fix annoying gray bar at bottom and right side of gvim window
style "vimfix" {
bg[NORMAL] = "#242424" # this matches my gvim theme 'Normal' bg color.
}
widget "vim-main-window.*GtkForm" style "vimfix"
@fqxp
fqxp / fabfile.py
Created May 11, 2013 13:22
Set up Postgres server, user and database with fabric. Put into fabfile.py
def _run_as_pg(command):
return sudo('sudo -u postgres %s' % command)
def pg_user_exists(username):
with settings(hide('running', 'stdout', 'stderr', 'warnings'), warn_only=True):
res = _run_as_pg('''psql -t -A -c "SELECT COUNT(*) FROM pg_user WHERE usename = '%(username)s';"''' % locals())
return (res == "1")
def pg_database_exists(database):
with settings(hide('running', 'stdout', 'stderr', 'warnings'), warn_only=True):