Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Mining Interest Topics from Plurk by Using Python
Search
Ken Lee
May 24, 2013
Programming
7
270
Mining Interest Topics from Plurk by Using Python
Ken Lee
May 24, 2013
Tweet
Share
More Decks by Ken Lee
See All by Ken Lee
Mining Interest Topics from Plurk by Using Python - Taipei.py
echain
0
85
CitC: Chewing in the Cloud
echain
1
81
Mining Interest Topics from Plurk
echain
2
43
Other Decks in Programming
See All in Programming
VSCodeでのDatabricks開発もお勧めしたい/I would also recommend Databricks development with VSCode.
kazumain
0
250
ゆるい個人開発のススメ
kuroppe1819
10
990
Elm 0.19.0 Changes
bkuhlmann
0
490
Netty Chicago Java User Group 2024-04-17
sullis
0
170
StoreKit2によるiOSのアプリ内課金のリニューアル
kangnux
0
110
AWS CDKコントリビュートTIPS / aws-cdk-contribution-tips
gotok365
2
180
R言語の環境構築と基礎 Tokyo.R 112
bob3bob3
0
270
スクラムガイドのスプリントレトロスペクティブを改めて読みかえしてみた / Re-reading the Sprint Retrospective Section in the Scrum Guide
mackey0225
3
430
Git Lint
bkuhlmann
4
750
Tailwind CSSを本気でカスタマイズする方法
fsubal
13
5.3k
PHPはいつから死んでいるかの調査
chiroruxx
1
400
雑に思考を整理する技術と効能
konifar
60
29k
Featured
See All Featured
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
121
39k
Automating Front-end Workflow
addyosmani
1356
200k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
19
1.7k
Designing for humans not robots
tammielis
248
25k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
155
14k
The Brand Is Dead. Long Live the Brand.
mthomps
49
29k
Teambox: Starting and Learning
jrom
128
8.4k
4 Signs Your Business is Dying
shpigford
175
21k
Practical Orchestrator
shlominoach
182
9.7k
Build your cross-platform service in a week with App Engine
jlugia
225
17k
GraphQLとの向き合い方2022年版
quramy
32
12k
Stop Working from a Prison Cell
hatefulcrawdad
266
19k
Transcript
Mining Interest Topics from Plurk by Using Python
[email protected]
About Me * Ken Lee * @echain * Developer at
Synology Inc. * Worked for NCTU CSCC * Just graduated from NCTU
很久很久以前...
D-1268 #GoPlurk
None
>>> import Java Traceback (most recent call last): File "<stdin>",
line 1, in <module> ImportError: No module named Java
>>> import Java Traceback (most recent call last): File "<stdin>",
line 1, in <module> ImportError: No module named Java >>> >>> import PHP Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named PHP
D-848 NSC College Student Creative Research Award
None
D-701 #ECPlurk
>>> from multiprocessing import Process >>> import multiprocessing.connection >>> import
MySQLdb >>> import re >>> import urllib2
>>> from multiprocessing import Process >>> import multiprocessing.connection >>> import
MySQLdb >>> import re >>> import urllib2 >>> >>> import ecspy >>> from matplotlib import pyplot
None
None
D-270 Happy b-day to Taeyeon
None
None
None
None
None
None
None
None
None
None
None
D-260 Happy b-day to Emily
「開工!!! 先把資料撈回來。」 \(▔□▔")/
# pacman -S python2-pip # cd /usr/bin # ln -s
pip2 pip # pip install plurk-oauth $ python2 >>> from PlurkAPI import PlurkAPI
「嗚… 系工作站有資源 限制,multiprocessing 會用掉一堆記憶體。」 \(▔□▔")/
# pip install gevent $ python2 >>> from gevent import
monkey >>> from gevent.pool import Pool >>> from gevent.queue import Queue
「砍站的速度不太理想, 似乎是因為 oauth2 用 的 httplib 效能很差。」 \(▔□▔")/
# pip install urllib3 $ python2 >>> import urllib3 >>>
urllib3.connection_from_url()
D-230 Happy b-day to Jessica
「噗哈哈哈… 朋友和粉絲的關聯 終於重新爬完了。」 (・ω・。)
None
MariaDB [plurk]> SHOW TABLE STATUS; +---------+-----------+------------+ | Name | Data
| Index | +---------+-----------+------------+ | fans | 233720343 | 901548032 | | friends | 421496919 | 1625860096 | | users | 189420940 | 79509504 | +---------+-----------+------------+
「索引的大小比資料 還要肥是怎樣?」 ヾ(゚▽゚*)ノ
# pacman -S redis # pip install redis $ python2
>>> import redis >>> from retry import retry
「A Multi-Level Aggregation Method for optimizing modularity; Louvain method」 ヾ(゚▽゚*)ノ
「糟糕,用 CPython 跑 @jserv 的 test case 要七分半才跑得完。」 ヾ(゚▽゚*)ノ
# pacman -S pypy # pypy get-pip.py # pip install
networkx $ pypy >>> import networkx >>> import community
「讚,現在最慢三十秒就 可以人肉 @jserv 了。」 ヾ(゚▽゚*)ノ
D-188 Happy b-day to Yoona
「報告老師,實驗室的 儲存空間不夠了。」 ( ̄﹁ ̄)
老師說:「要有機器。」 就有了機器。 ( ̄﹁ ̄)
None
「現在有二十台機器可以 用,來玩玩看新的砍站 架構吧!」 ( ̄﹁ ̄)
# pacman -S zeromq # pip install pyzmq # pip
install msgpack-python $ python2 >>> import zmq >>> import msgpack
None
「呃… CPU 使用率怎麼會 這麼高? I/O bound 變 成 CPU bound
了 ?!」 ಠ_ಠ
$ free -h total used Mem: 15G 15G -/+ buffers/cache:
8.9G Swap: 251M 3.8M $ cat /proc/cpuinfo ... model name: Dual Core AMD Opteron(tm) Processor 270 ...
「骨董 CPU 不意外… 算 HMAC-SHA1 和解 JSON 花太多時間。」 (´・ω・`)
# pacman -S openssl # pip install ujson $ python2
>>> import hmac_sha1 >>> import ujson
D-159 Happy b-day to Seohyun
「用 MySQL 存噗文有 點不太直覺,來試試很 潮的 MongoDB。」 ( ̄﹁ ̄)
「20 = (1+9) * 2 = 兩隊少女時代 + 兩位經紀人」 \⊙▽⊙/
「那就把這些機器組成 Replicated Sharded MongoDB cluster 吧。」 ‧★,:*:‧\( ̄▽ ̄)/‧:*‧°★*
None
None
「噗文全部抓回來了, 可是內容夾雜了英文、 中文和火星文…」 ヾ(゚▽゚*)ノ
「CKIP 在學校的 mirror 被入侵關機中。」 \(▔□▔")/ 「而且 CKIP 看不懂英 文,只能斷中文詞。」
「自幹斷詞系統。」 ヾ(゚▽゚*)ノ
# pip install regex # pip install marisa-trie # pip
install sqlalchemy $ python2 >>> import regex >>> import marisa_trie >>> import sqlalchemy
D-120 Happy b-day to Helena
老師說:「系統的網頁 前端不要用 PHP 寫。」 Σヽ(゚Д ゚; )ノ
None
「現在放棄的話, 就要準備去當兵囉。」 _(:3」∠)_
# pacman -S mod_wsgi2 # pacman -S memcached # pip
install flask $ python2 >>> from gevent.wsgi \ import WSGIServer >>> import flask
老師說:「系統要能同 時讓多人連線使用,算 community 要夠快。」 Σヽ(゚Д ゚; )ノ
None
「我們實驗室的工作站 只有 16 核心可以用。」 ヾ(゚▽゚*)ノ
「團結就是力量。」 \⊙▽⊙/
$ yaourt -S rabbitmq # pip install celery $ python2
>>> import celery
None
None
D-55 National Day of Taiwan
「論文快寫完了,來幫這次 做的系統取個名字。」 ( ̄﹁ ̄)
「Social Networking Service Discovery (SNSD) system」 ヾ(゚▽゚*)ノ
「好巧!少女時代的簡寫 也是 SNSD 耶!」 \⊙▽⊙/
$ whois snsd.tw Domain Name: snsd.tw Contact: Ken Lee
[email protected]
Record expires on 2013-10-11 (YYYY-MM-DD) Record created on 2012-10-10 (YYYY-MM-DD) Registration Service Provider: APT
D-31 Happy b-day to Anne
None
None
None
None
None
None
D-7 Thesis oral presentation
None
None
None
D-Day Graduated!!!
None
None
結論
* 可嘗試使用 NoSQL 來解決問題 * 不夠快?寫 C-extension * 跟 C
不熟?那就交給 pypy 吧! * pypi 上的套件很多,多看多比較 * 要感謝的人太多了,就感謝 * 少女時代吧!