Skip to content

Instantly share code, notes, and snippets.

@hit9
hit9 / tree.md
Created January 13, 2013 12:47 — forked from hrldcpr/tree.md

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

GitHub OAuth Busy Developer's Guide

This is a quick guide to OAuth2 support in GitHub for developers. This is still experimental and could change at any moment. This Gist will serve as a living document until it becomes finalized at Develop.GitHub.com.

OAuth2 is a protocol that lets external apps request authorization to private details in your GitHub account without getting your password. All developers need to register their application before getting started.

Web Application Flow

  • Redirect to this link to request GitHub access:
body {
font-family: Helvetica, arial, sans-serif;
font-size: 14px;
line-height: 1.6;
padding-top: 10px;
padding-bottom: 10px;
background-color: white;
padding: 30px; }
body > *:first-child {
@hit9
hit9 / daemon.py
Created June 11, 2013 12:49 — forked from jamiesun/daemon.py
#! /usr/bin/env python2.7
#encoding:utf-8
#@description:一个python守护进程的例子
#@tags:python,daemon
import sys
import os
import time
import atexit
from signal import SIGTERM
@hit9
hit9 / gist:7639670
Created November 25, 2013 10:58 — forked from kran/gist:6291095
xfconf-query -c xsettings -p /Gtk/KeyThemeName -s Emacs
@hit9
hit9 / 00-index.txt
Created December 8, 2013 14:06 — forked from knzm/00-index.txt
- Install xhtml2pdf (former "pisa").
http://www.xhtml2pdf.com/
- Install Takao Font (TakaoPGothic.ttf).
https://launchpad.net/takao-fonts/
- Modify conf.py as below.
- Modify Makefile as below.

Follow these steps to install graphite on OS X Lion.

Prerequisites

  • Python 2.7
  • Brew
  • Git

Install dependencies

Install Cairo

import sys
from PySide.QtCore import QObject, Slot
from PySide.QtGui import QApplication
from PySide.QtWebKit import QWebView
html = """
<html>
<body>
<h1>Hello!</h1><br>

Getting Started with NPM (as a developer)

If you haven't already set your NPM author info, now you should:

npm set init.author.name "Your Name"
npm set init.author.email "you@example.com"
npm set init.author.url "http://yourblog.com"

npm adduser

# coding: utf-8
from flask import Flask
from werkzeug.wsgi import pop_path_info, peek_path_info
from werkzeug.serving import run_simple
app = Flask(__name__)
class PathDispatcher(object):