Skip to content

Instantly share code, notes, and snippets.

@hasenj
hasenj / haiku.py
Created July 30, 2012 07:45 — forked from friggeri/haiku
python version: random heroku-like name generator
import random
def haiku():
# originally from: https://gist.github.com/1266756
# with some changes
# example output:
# "falling-late-violet-forest-d27b3"
adjs = [ "autumn", "hidden", "bitter", "misty", "silent", "empty", "dry", "dark",
"summer", "icy", "delicate", "quiet", "white", "cool", "spring", "winter",
"patient", "twilight", "dawn", "crimson", "wispy", "weathered", "blue",
"billowing", "broken", "cold", "damp", "falling", "frosty", "green",
@hasenj
hasenj / markdown_furigana.py
Last active February 24, 2016 18:04 — forked from huangziwei/markdown_furigana.py
a python script for writing furigana in markdown
import fileinput
import re
import sys
```
eg. [東京]{とうきょう} -> <ruby>東京<rp>(</rp><rt>とうきょう</rt><rp>)</rp></ruby>
```
def furiganize(line):
# (?<!\\) means don't match if preceeded by a backslash
return re.sub(ur'(?<!\\)\[(.*?)\]\{(.*?)\}', ur'<ruby>\1<rp>(</rp><rt>\2</rt><rp>)</rp></ruby>', line.rstrip())