Skip to content

Instantly share code, notes, and snippets.

View tzengyuxio's full-sized avatar

Tzeng Yuxio tzengyuxio

View GitHub Profile
@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')
@tzengyuxio
tzengyuxio / tuili.py
Created May 30, 2019 16:39
2018 年刑偵科推理試題
#!/usr/bin/env python3
# 題目: https://imgur.com/a/WvVHKUO
import string
base = 4
digs = string.digits + string.ascii_letters
N = 4 ** 10
@tzengyuxio
tzengyuxio / MacInstall.md
Created March 22, 2019 16:59
Install Note (Mac Mini 2018, 冬至)

終端機

  • Hack Regular 16 點
  • [v] 柔邊處理文字
  • 使用粗體
  • [v] 閃爍游標

Homebrew

Homebrew

爭清塗愁時月修聲,自前干中。
    衰丘步二 結況
遮生月醉田,李音不忽君。歸朝不前遠,涼梅遠不留。
    庭答德二 項物 長能
Rowhild;
CORIOLANUS:
But I think'st true.
Second Citizen:
By the lord!
'Since, bay them as forth from me.
CLARENCE:
gless
wace us a glause,
Than ouch the camfal dean!
CORIOLANUS:
Whesale with-let Marcer terpty body of comk
Tose thus sear it thy and house hithy
meirs with your rricmord, all resw.
Gor expoace they kincensuling but broskry Romeighcciod,
One: loxte.
@tzengyuxio
tzengyuxio / divisions.py
Created August 17, 2016 17:02
Fetch all county-level administrative divisions of PRC
#!/usr/bin/env python3
from bs4 import BeautifulSoup
from urllib.request import urlopen
from urllib.parse import urljoin
import io
import json
homepage = "https://zh.wikipedia.org/zh-tw/Category:%E4%B8%AD%E5%8D%8E%E4%BA%BA%E6%B0%91%E5%85%B1%E5%92%8C%E5%9B%BD%E5%90%84%E7%9C%81%E7%BA%A7%E8%A1%8C%E6%94%BF%E5%8C%BA%E8%A1%8C%E6%94%BF%E5%8C%BA%E5%88%92%E6%A8%A1%E6%9D%BF" # noqa
@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 / 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 / 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