Skip to content

Instantly share code, notes, and snippets.

@nebuta
nebuta / haskell_advent_2012_26.md
Last active July 31, 2022 17:32
HaskellでWebスクレイピング - Haskell Advent Calendar 2012

HaskellでWebスクレイピング

この記事はHaskell Advent Calendar 2012の26日目の記事です。Haskell Advent Calendar初参加です。コメントなどお待ちしております。

前提知識 - Haskellでの文字列処理

HaskellではString([Char]の別名)が文字列の基本型で、これはリストであるためにパターンマッチ・再帰やPreludeやData.Listにあるリスト用の関数を使って処理ができるという利点があります。ただし、実用上はパフォーマンスが低いため、TextByteStringが代わりに用いられます。Textはいわゆるユニコード文字列、ByteStringはバイト列という区別です。この使い分けに関してはちょうどAdvent Calendarの@brain_appleさんのこの記事で解説されました。StackOverflowでの質問も参考になります。

HaskellでのHTMLパーシング用ライブラリの概観

Hackageを見ると、

@didip
didip / tornado_cookie_secret_generator.py
Created February 12, 2011 17:20
Generates secure cookie secret for Tornado Web Framework
@didip
didip / supervisord-example.conf
Created January 30, 2011 05:10
Example configuration file for supervisord.conf
[unix_http_server]
file=/tmp/supervisor.sock ; path to your socket file
[supervisord]
logfile=/var/log/supervisord/supervisord.log ; supervisord log file
logfile_maxbytes=50MB ; maximum size of logfile before rotation
logfile_backups=10 ; number of backed up logfiles
loglevel=error ; info, debug, warn, trace
pidfile=/var/run/supervisord.pid ; pidfile location
nodaemon=false ; run supervisord as a daemon
@mblondel
mblondel / lda_gibbs.py
Last active October 9, 2023 11:31
Latent Dirichlet Allocation with Gibbs sampler
"""
(C) Mathieu Blondel - 2010
License: BSD 3 clause
Implementation of the collapsed Gibbs sampler for
Latent Dirichlet Allocation, as described in
Finding scientifc topics (Griffiths and Steyvers)
"""