Skip to content

Instantly share code, notes, and snippets.

View tzengyuxio's full-sized avatar

Tzeng Yuxio tzengyuxio

View GitHub Profile
@tzengyuxio
tzengyuxio / civ5zh.py
Created July 25, 2011 22:45
Civ5 簡轉繁轉碼工具
# -*- coding: utf-8 -*-
import os, sys
import shutil
dirOpencc = "D:\\Apps\\opencc\\"
dirOrigin = "E:\\Steam\\steamapps\\common\\sid meier's civilization v\\assets\\"
dirOutput = "E:\\work\\civ5zh\\Sources\\assets\\"
specialFiles = ['Gameplay\\XML\\NewText\\CIV5Credits_zh_CN.txt',
@tzengyuxio
tzengyuxio / civ5zh.nsi
Created July 25, 2011 22:48
文明五正簡漢化包安裝指令
# Auto-generated by EclipseNSIS Script Wizard
# 2011/7/20 上午 10:21:09
!define NAME "civ5zh"
!define FULLNAME "Civilization V 正簡雙漢化"
!define VERSION "1.0"
Name "${FULLNAME} ${VERSION}"
# General Symbol Definitions
@tzengyuxio
tzengyuxio / uigesturerecognizer.m
Created July 26, 2011 11:17
iOS 手勢範例
// 宣告一個 recognizer, 並加到需要偵測該手勢的 UIView 元件上
- (void)viewDidLoad {
UISwipeGestureRecognizer* recognizer;
// handleSwipeFrom 是偵測到手勢後,所要呼叫的方法
recognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipeFrom)];
// 不同的 Recognizer 有不同的實體變數
// 例如 SwipeGesture 可以指定方向
// 而 TapGesture 則可以指定次數
recognizer.direction = UISwipeGestureRecognizerDirectionUp
[self.view addGestureRecognizer:recognizer];
@tzengyuxio
tzengyuxio / uitapgesturerecognizer.m
Created July 26, 2011 11:49
單點擊與雙點擊同時成立
- (void)viewDidLoad {
// 單擊的 Recognizer
UITapGestureRecognizer* singleRecognizer;
singleRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleSingleTapFrom)];
singleTapRecognizer.numberOfTapsRequired = 1; // 單擊
[self.view addGestureRecognizer:singleRecognizer];
// 雙擊的 Recognizer
UITapGestureRecognizer* double;
doubleRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleDoubleTapFrom)];
@tzengyuxio
tzengyuxio / onimushi.py
Created October 12, 2011 15:57
fetch manga jpegs
import urllib
sFiles="iieye0001-23513.JPG|iieye0002-18220.JPG|iieye0003-10817.JPG|iieye0004-75058.JPG|iieye0005-80467.JPG|iieye0006-26063.JPG|iieye0007-94037.JPG|iieye0008-12816.JPG|iieye0009-14654.JPG|iieye0010-17029.JPG|iieye0011-20600.JPG|iieye0012-96905.JPG|iieye0013-91006.JPG|iieye0014-55435.JPG|iieye0015-10618.JPG|iieye0016-16298.JPG|iieye0017-19149.JPG|iieye0018-16392.JPG|iieye0019-20006.JPG|iieye0020-19246.JPG|iieye0021-79939.JPG|iieye0022-11035.JPG|iieye0023-13656.JPG|iieye0024-20087.JPG|iieye0025-91993.JPG|iieye0026-17052.JPG|iieye0027-14807.JPG|iieye0028-34208.JPG|iieye0029-19081.JPG|iieye0030-80558.JPG|iieye0031-76807.JPG|iieye0032-93202.JPG|iieye0033-14767.JPG|iieye0034-34961.JPG|iieye0035-14144.JPG|iieye0036-53597.JPG|iieye0037-41496.JPG|iieye0038-61202.JPG|iieye0039-95867.JPG|iieye0040-12868.JPG|iieye0041-20183.JPG|iieye0042-45299.JPG|iieye0043-92110.JPG|iieye0044-14851.JPG|iieye0045-41312.JPG|iieye0046-88416.JPG|iieye0047-70173.JPG|iieye0048-18556.JPG|iieye0049-30552.JPG|iieye0050-59343.JPG|i
@tzengyuxio
tzengyuxio / kekkaishi01.py
Created October 12, 2011 16:46
kekkaishi manga fetcher
import urllib
# http://mh.99770.cc/manhua/5264/
# http://mh.99770.cc/manhua/5264/42671.htm?s=3 (Book 1)
sServer="http://61.164.109.141:99/dm03/"
sFiles="/ok-comic00/j/jjs/vol_01/99770_001DD.jpg|/ok-comic00/j/jjs/vol_01/99770_002en.jpg|/ok-comic00/j/jjs/vol_01/99770_003zb.jpg|/ok-comic00/j/jjs/vol_01/99770_004va.jpg|/ok-comic00/j/jjs/vol_01/99770_005yQ.jpg|/ok-comic00/j/jjs/vol_01/99770_006cQ.jpg|/ok-comic00/j/jjs/vol_01/99770_007OI.jpg|/ok-comic00/j/jjs/vol_01/99770_008bY.jpg|/ok-comic00/j/jjs/vol_01/99770_009ue.jpg|/ok-comic00/j/jjs/vol_01/99770_010pv.jpg|/ok-comic00/j/jjs/vol_01/99770_011rC.jpg|/ok-comic00/j/jjs/vol_01/99770_012TU.jpg|/ok-comic00/j/jjs/vol_01/99770_013qr.jpg|/ok-comic00/j/jjs/vol_01/99770_014BY.jpg|/ok-comic00/j/jjs/vol_01/99770_015fI.jpg|/ok-comic00/j/jjs/vol_01/99770_016YE.jpg|/ok-comic00/j/jjs/vol_01/99770_017Le.jpg|/ok-comic00/j/jjs/vol_01/99770_018mb.jpg|/ok-comic00/j/jjs/vol_01/99770_019HC.jpg|/ok-comic00/j/jjs/vol_01/99770_020DB.jpg|/ok-comic00/j/jjs/vol_01/99770_021te.jpg|/ok-comic
@tzengyuxio
tzengyuxio / typo.py
Created November 30, 2011 16:43
Generate misspelling words...
#!/usr/bin/python
import sys
import random
def misspell(s):
# word and punctation
(w, p) = (s, '') if s[-1] not in [',', '.', ';', ':'] else (s[:-1], s[-1])
if len(w) <= 3:
return s
@tzengyuxio
tzengyuxio / blogstats.sh
Created April 19, 2012 02:04
stats of octopress blogpost
#!/bin/bash
# start year and end year
SYEAR=2005
EYEAR=`date "+%Y"`
POSTPATH=~/github/octopress/source/_posts/
echo
echo "YEAR File # Word Count"
@tzengyuxio
tzengyuxio / gist:4284108
Created December 14, 2012 09:44
Fetch IMDb Top 250 into CSV file.
#!/usr/bin/python
# -*- coding: utf-8 -*-
import urllib2
import HTMLParser
import csv
import datetime
import codecs, cStringIO # for UnicodeWriter
response = urllib2.urlopen('http://www.imdb.com/chart/top')
#!/usr/bin/python
#
# author: [email protected]
# usage: cat file.input | ./qround-problem-a.py > file.output
import sys
def get_a_row():
a = (int)(sys.stdin.readline())
b = 5 - a