Skip to content

Instantly share code, notes, and snippets.

View robcowie's full-sized avatar

Rob Cowie robcowie

  • Recycleye
  • Leeds/London, United Kingdom
View GitHub Profile
@lrvick
lrvick / flask_geventwebsocket_example.py
Created September 1, 2011 07:17
Simple Websocket echo client/server with Flask and gevent / gevent-websocket
from geventwebsocket.handler import WebSocketHandler
from gevent.pywsgi import WSGIServer
from flask import Flask, request, render_template
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html')
@coldnebo
coldnebo / Default (Linux).sublime-keymap
Created August 10, 2011 23:20
simple scripts to prettify your xml and json in sublime text 2
[
{ "keys": ["ctrl+shift+x"], "command": "tidy_xml" },
{ "keys": ["ctrl+shift+j"], "command": "prettify_json" }
]
@eugenepyvovarov
eugenepyvovarov / index.html
Created August 4, 2011 15:34 — forked from mbostock/.block
Google Maps + D3
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no"/>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>
<script type="text/javascript" src="http://github.com/mbostock/d3/raw/v1.8.4/d3.js"></script>
<style type="text/css">
html, body, #map {
width: 100%;
@ajpalkovic
ajpalkovic / clipboardHistory.py
Created June 15, 2011 05:19
Sublime Clipboard History Plugin
import sublime, sublime_plugin
import math, time
# two globals store the complete clipboard history and position so that it is shared between all the various actions
_clipboardHistory = ['']
_clipboardIndex = 0
class ClipboardHistoryBase(sublime_plugin.ApplicationCommand):
# gets/sets the sublime clipboard
def clipboard(self, content=None):
@pamelafox
pamelafox / countryinfo.py
Last active March 24, 2025 15:03
Python list of country codes, names, continents, capitals, and pytz timezones
countries = [
{'timezones': ['Europe/Andorra'], 'code': 'AD', 'continent': 'Europe', 'name': 'Andorra', 'capital': 'Andorra la Vella'},
{'timezones': ['Asia/Kabul'], 'code': 'AF', 'continent': 'Asia', 'name': 'Afghanistan', 'capital': 'Kabul'},
{'timezones': ['America/Antigua'], 'code': 'AG', 'continent': 'North America', 'name': 'Antigua and Barbuda', 'capital': "St. John's"},
{'timezones': ['Europe/Tirane'], 'code': 'AL', 'continent': 'Europe', 'name': 'Albania', 'capital': 'Tirana'},
{'timezones': ['Asia/Yerevan'], 'code': 'AM', 'continent': 'Asia', 'name': 'Armenia', 'capital': 'Yerevan'},
{'timezones': ['Africa/Luanda'], 'code': 'AO', 'continent': 'Africa', 'name': 'Angola', 'capital': 'Luanda'},
{'timezones': ['America/Argentina/Buenos_Aires', 'America/Argentina/Cordoba', 'America/Argentina/Jujuy', 'America/Argentina/Tucuman', 'America/Argentina/Catamarca', 'America/Argentina/La_Rioja', 'America/Argentina/San_Juan', 'America/Argentina/Mendoza', 'America/Argentina/Rio_Gallegos', 'America/Argentina/Ushuai
@jarshwah
jarshwah / commands
Created May 2, 2011 00:29
Being explicit with django local settings
// Being explicit with which settings file is used, allows two important properties. settings.py is ALWAYS in a production ready state, even if 'settingslocal' is accidentally checked into source control. The other nice side effect, is that every developers settings files are stored in source control - allowing each developer to share components of their settings files with their peers.
// runserver
python manage.py runserver --settings settingsjosh
// syncdb
python manage.py syncdb --settings settingsjosh
@akheron
akheron / async_map.py
Created April 7, 2011 13:20
Asynchronous map for Tornado's ioloop
from tornado.ioloop import IOLoop
# Calls fn for all items of iterable, saves result to a list, and
# calls callback with that list. This is most useful when fn works
# asynchronously.
def async_map(fn, iterable, callback, io_loop=None):
ioloop = io_loop or IOLoop.instance()
def loop():
try:
@robcowie
robcowie / countries.csv
Created April 4, 2011 14:05
Create a table of Countries with ISO codes
alpha2 alpha3 numeric name
AF AFG 004 Afghanistan
AX ALA 248 Åland Islands
AL ALB 008 Albania
DZ DZA 012 Algeria
AS ASM 016 American Samoa
AD AND 020 Andorra
AO AGO 024 Angola
AI AIA 660 Anguilla
AQ ATA 010 Antarctica
@sygo
sygo / conf.hexdump
Last active August 7, 2023 15:00
additions to the standard grc.conf (check the appropriate conf files for each command)
# offset
regexp=([0-9a-fA-F]{1,7})+
colours=bold red
count=once
======
# Hex Bytes %_p
regexp=\|.+?\|
colours=cyan
count=once
======
@adamstac
adamstac / TODO
Created February 11, 2011 18:50
A Rubyist’s guide to setting up a Mac OS X development environment using Homebrew, RVM, Git and Bundler
* Review this article and add new steps as needed: http://blog.therubymug.com/blog/2010/05/20/the-install-osx.html