This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from __future__ import print_function | |
REQUIREMENTS = [ 'distribute', 'version', 'Cython', 'sortedcollection' ] | |
try: | |
from setuptools import find_packages | |
from distutils.core import setup | |
from Cython.Distutils import build_ext as cython_build | |
import sortedcollection |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sublime Text Plugins iCloud Drive | |
First Machine | |
On your first machine, use the following instructions. | |
$ cd ~/Library/Application\ Support/Sublime\ Text\ 2/Packages/ | |
$ mkdir ~/Library/Mobile\ Documents/com\~apple\~CloudDocs/Web\ Dev/Plugins | |
$ mv User ~/Library/Mobile\ Documents/com\~apple\~CloudDocs/Web\ Dev/Plugins | |
$ ln -s ~/Library/Mobile\ Documents/com\~apple\~CloudDocs/Web\ Dev/Plugins/User |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://stackoverflow.com/questions/19112296/how-to-pass-arguments-from-tornado-to-a-js-file-but-not-html | |
$ tree | |
. | |
├── static | |
│ └── scripts | |
│ └── test.js | |
├── templates | |
│ └── index.html | |
└── test.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from socket import * | |
sockets = {} | |
s = socket() | |
s.bind(('', 1234)) | |
s.listen() | |
ns, na = s.accept() | |
sockets[na] = ns |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/swift | |
import Foundation | |
var keepAlive = true | |
dump(ProcessInfo().arguments) | |
let runLoop = RunLoop.current | |
let distantFuture = Date.distantFuture |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tornado.ioloop | |
import tornado.web | |
from datetime import datetime | |
import urlparse | |
from bson.json_util import dumps | |
import pymongo | |
from pymongo import Connection | |
class Home(tornado.web.RequestHandler): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ast | |
import sys | |
import pprint | |
import re | |
type_lookup = { | |
ast.Module: 'Module', | |
ast.FunctionDef: 'Function', | |
ast.ClassDef: 'Class' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Core Graphics method | |
CGDataProviderRef provider = CGDataProviderCreateWithURL((__bridge CFURLRef)fontURL); | |
CGFontRef graphicsFont = CGFontCreateWithDataProvider(provider); | |
CTFontRef coreTextFont = CTFontCreateWithGraphicsFont(graphicsFont, fontSize, /*matrix*/ NULL, /*attributes*/ NULL); | |
if (coreTextFont) { | |
NSFont *font = (__bridge NSFont *)coreTextFont; | |
[fonts addObject:font]; | |
CFRelease(coreTextFont); | |
} | |
CGFontRelease(graphicsFont); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Demonstration of server-sent events with Tornado. To see the | |
stream, you can either point your browser to ``http://localhost:8080`` | |
or use ``curl`` like so:: | |
$ curl http://localhost:8080/events | |
""" | |
import signal | |
from tornado import web, gen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Query a property from the terminal, e.g. background color. | |
# | |
# XTerm Operating System Commands | |
# "ESC ] Ps;Pt ST" | |
oldstty=$(stty -g) | |
# What to query? |