Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
#!/usr/bin/env ruby | |
# Convert Trac DB Wiki pages to Markdown source files | |
# This script is based on http://github.com/seven1m/trac_wiki_to_github which | |
# converted all pages from a Trac DB to GitHub Wiki format (as Textile). | |
# | |
# I made two changes: | |
# - uses MarkDown format instead | |
# - uses the sqllite3-ruby gem which does not need Ruby 1.9 |
/* | |
Some simple Github-like styles, with syntax highlighting CSS via Pygments. | |
*/ | |
body{ | |
font-family: helvetica, arial, freesans, clean, sans-serif; | |
color: #333; | |
background-color: #fff; | |
border: none; | |
line-height: 1.5; | |
margin: 2em 3em; |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
/** | |
** ____ _ ___ ___ _ _ | |
** | _ \ | | | \/ | | | (_) | |
** | | \ |__ _ _ __| | __ | . . | ___ _ __ ___ | | __ __ _ _ | |
** | | | | _` | '__| |/ / | |\/| |/ _ \| '_ \ / _ \| |/ // _` | | | |
** | |_/ /(_| | | | < | | | | (_) | | | | (_) | <| (_| | | | |
** |____/\__,_|_| |_|\_\ \_| |_/\___/|_| |_|\___/|_|\_\\__,_|_| | |
** | |
** Quassel Theme | |
** |
L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns
Compress 1K bytes with Zippy ............. 3,000 ns = 3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns = 20 µs
SSD random read ........................ 150,000 ns = 150 µs
Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs
import os | |
import sys | |
from distutils.core import setup | |
from distutils.dir_util import copy_tree | |
from py2exe.build_exe import py2exe | |
import glob | |
import zlib | |
import shutil |
-- show running queries (pre 9.2) | |
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
FROM pg_stat_activity | |
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- show running queries (9.2) | |
SELECT pid, age(clock_timestamp(), query_start), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
data:text/html, <style type="text/css">.e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div class="e" id="editor"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("editor");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/ruby");</script> | |
<!-- | |
For other language: Instead of `ace/mode/ruby`, Use | |
Markdown -> `ace/mode/markdown` | |
Python -> `ace/mode/python` | |
C/C++ -> `ace/mode/c_cpp` | |
Javscript -> `ace/mode/javascript` | |
Java -> `ace/mode/java` | |
Scala- -> `ace/mode/scala` |
Windows Registry Editor Version 5.00 | |
[HKEY_CLASSES_ROOT\7-Zip.001\shell] | |
@="extract" | |
[HKEY_CLASSES_ROOT\7-Zip.001\shell\extract] | |
@="Extract to Folder" | |
[HKEY_CLASSES_ROOT\7-Zip.001\shell\extract\command] | |
@="\"C:\\Program Files\\7-Zip\\7zG.exe\" x \"%1\" -o*" | |
[HKEY_CLASSES_ROOT\7-Zip.7z\shell] |