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
# File: mp3_tag.py | |
# | |
# Description: This module provides MP3 tags correction, i.e. from | |
# any encoding X to UTF-8, the standard across different apps | |
# and platforms. The default parameters target the common Chinese | |
# encoding GBK. | |
# | |
# Features: 1. it recursively handles MP3 files > 512KB in all subdirectories. | |
# 2. outputs a log formatted to show the directory structure | |
# with failures (decoding/encoding error, the field will be |
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
# File: benchmark.py | |
# Desc: This computes the average run time of a piece of code. | |
# Author: Falcon Dai | |
# Date: 5/2/2012 | |
import time | |
global_dict = globals() | |
# should be run as soon as the module is imported to |
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
<!-- Google Checkout/Paypal donation gadget --> | |
<!-- written by Falcon Dai, falcondai.com --> | |
<!-- | |
Usage: Replace all occurrences of {mid} by your Google Merchant ID, {name} by your name, and {pid} by your PayPal account email then it should work. | |
Disclaimer: you can use this freely but it does not have any warranty. If you like it, you can buy me a coffee. | |
--> | |
<p>You can buy me a coffee!</p> | |
<b>via Google Checkout</b> |
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
// use HTML5 Web Storage or an object to cache | |
localStorage = localStorage || sessionStorage || {}; | |
sessionStorage = sessionStorage || {}; | |
// @param work: a function that works on k, i.e. of the form function(k) {} | |
// @param is_permanent: true if the data should be stored in localStorage, else in sessionStorage | |
function perform(work, k, url, is_permanent) { | |
var s = is_permanent? localStorage : sessionStorage; | |
if (s[k]) { |
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
<!doctype html> | |
<style> | |
body { | |
font: 10px sans-serif; | |
} | |
.axis path, | |
.axis line { | |
fill: none; |
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
(custom-set-variables | |
;; custom-set-variables was added by Custom. | |
;; If you edit it by hand, you could mess it up, so be careful. | |
;; Your init file should contain only one such instance. | |
;; If there is more than one, they won't work right. | |
'(custom-enabled-themes (quote (deeper-blue))) | |
(custom-set-faces | |
;; custom-set-faces was added by Custom. | |
;; If you edit it by hand, you could mess it up, so be careful. | |
;; Your init file should contain only one such instance. |
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
EXT_NAME=omni | |
all: clean pages package | |
pages: | |
jade jade/*.jade -Po . | |
clean: | |
rm -rf *~ | |
rm -f $(EXT_NAME).zip |
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/bash | |
echo installing fonts at $PWD to ~/.fonts/ | |
find . -name '*.ttf' -exec cp \{\} ~/.fonts/ \; | |
find . -name '*.otf' -exec cp \{\} ~/.fonts/ \; | |
echo finished installing |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>fileTypes</key> | |
<array/> | |
<key>foldingStartMarker</key> | |
<string>/\*\*</string> | |
<key>foldingStopMarker</key> | |
<string>\*\*/</string> |
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
class lazy_csv_reader(list): | |
def __init__(self, csv_reader, pos): | |
self.reader = csv_reader | |
self.pos = pos | |
def __iter__(self): | |
r = self.reader.next() | |
while r: | |
yield r[self.pos] | |
r = self.reader.next() |
OlderNewer