Quick reference for git / GitHub daily workflow
- create the local branch
| [submodule "iostream_callback"] | |
| path = iostream_callback | |
| url = git://gist.github.com/753987.git |
| #coding: utf-8 | |
| from bottle import route, error, post, get, run, static_file, abort, redirect, response, request, template | |
| @route('/') | |
| @route('/index.html') | |
| def index(): | |
| return '<a href="/hello">Go to Hello World page</a>' | |
| @route('/hello') | |
| def hello(): |
| #! /usr/bin/python | |
| """ | |
| This simple script makes it easy to create server certificates | |
| that are signed by your own Certificate Authority. | |
| Mostly, this script just automates the workflow explained | |
| in http://www.tc.umn.edu/~brams006/selfsign.html. | |
| Before using this script, you'll need to create a private |
| # For http://stackoverflow.com/questions/21248222/how-can-tornado-serve-a-single-static-file-at-an-arbitrary-location/21248691?noredirect=1#comment32053685_21248691 | |
| class MyFileHandler(StaticFileHandler): | |
| def initialize(self, file_mapping, **kwargs): | |
| self.file_mapping = file_mapping | |
| super(MyFileHandler, self).initialize(**kwargs) | |
| @classmethod | |
| def get_absolute_path(cls, root, path): | |
| return StaticFileHandler.get_absolute_path(root, self.file_mapping.get(path, path)) |
| >>> import itertools | |
| >>> import string | |
| >>> from elasticsearch import Elasticsearch,helpers | |
| es = Elasticsearch() | |
| >>> # k is a generator expression that produces | |
| ... # a series of dictionaries containing test data. | |
| ... # The test data are just letter permutations | |
| ... # created with itertools.permutations. | |
| ... # | |
| ... # We then reference k as the iterator that's |
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| import io | |
| import ssl | |
| import sys | |
| import copy | |
| import base64 | |
| import socket | |
| import httplib |
| #!/usr/bin/env python | |
| from __future__ import print_function | |
| import os | |
| import shutil | |
| import subprocess | |
| def get_width(default=80): | |
| '''Attempt to detect console width and default to 80''' |