Skip to content

Instantly share code, notes, and snippets.

View master-q's full-sized avatar
🌴
On vacation

Kiwamu Okabe master-q

🌴
On vacation
View GitHub Profile
@master-q
master-q / GetAllPagePan2.hs
Created January 5, 2012 11:05
GetAllPagePan2.hs
#!/usr/bin/env runhaskell
{-# Language OverloadedStrings #-}
import qualified Text.Pandoc as P
import System.Process
import System.Exit
import qualified System.IO.UTF8 as U8
import Data.ByteString.Char8 ()
findLink' :: [P.Inline] -> [(String, String)]
findLink' inlines = concat $ fmap go inlines
@master-q
master-q / GetAllPagePan_Fin.hs
Created January 5, 2012 11:45
GetAllPagePan_Fin.hs
#!/usr/bin/env runhaskell
import qualified Text.Pandoc as P
import System.Process
import System.Exit
import Data.ByteString.Char8 ()
import Codec.Binary.UTF8.String
{--
http://groups.google.com/group/haskell-jp/browse_thread/thread/b15a016985d8c426
によるとghc 7.0.Xまでのsystem関数はlocale encodingが通らない。変換が必要。
@master-q
master-q / run_redblacktree.txt
Created January 17, 2012 01:46
github.com/master-q/readPurelyFunctionalDataStructures/tree/master/RedBlackTreeの実行結果
$ omake check [~/src/readPurelyFunctionalDataStructures/RedBlackTree]
omake: Symbol `FamErrlist' has different size in shared object, consider re-linking
*** omake: reading OMakefiles
*** omake: finished reading OMakefiles (0.01 sec)
- build . <check>
+ ./redblack_tree_test
.
Ran: 1 tests in: 5.98 seconds.
OK- build . <check>
+ ./redblack_tree_test
@master-q
master-q / gist:2775250
Created May 23, 2012 13:32
daemonから子プロセスへSIGUSR1を送信
#include <sys/types.h>
#include <signal.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <syslog.h>
int catch_sigusr1 = 0;
int catch_sigbus = 0;
@master-q
master-q / gist:2866508
Created June 4, 2012 05:20
monthly-reportのmakeエラー at debian sid
(/usr/share/texlive/texmf-dist/tex/latex/hyperref/hdvipdfm.def
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/rerunfilecheck.sty))
(./debianmeetingresume200511.aux)
(/usr/share/texlive/texmf-dist/tex/latex/hyperref/nameref.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/gettitlestring.sty))
(./debianmeetingresume200511.out) (./debianmeetingresume200511.out) [1]
(./debianmeetingresume200511.toc) [1] <image200502/openlogo-nd.eps>
(/usr/share/texlive/texmf-dist/tex/latex/base/omscmr.fd) [2] [3] [4]
<image200502/openlogo-nd.eps> [5] [6] [7] <image200502/openlogo-nd.eps>
[8] [9] <image200502/openlogo-nd.eps> [10] [11] [12]
@master-q
master-q / gist:2930300
Created June 14, 2012 13:32
ghcのブランチでsync-all getが通らない?
$ git clone git://github.com/ghc/ghc.git
$ cd ghc
$ git checkout ghc-7.4.1-release
$ ./sync-all get -b ghc-7.4.1-release
--snip--
== libraries/bytestring: running git config core.ignorecase true
== running git clone git://github.com/ghc/packages-cabal-1.14.git libraries/Cabal -b ghc-7.4.1-release
Cloning into 'libraries/Cabal'...
fatal: remote error:
Repository not found.
@master-q
master-q / gist:2982877
Created June 24, 2012 11:27
いろいろ調査の残骸
=> schedule (rts/Schedule.c)
=> StgRunIsImplementedInAssembler (rts/StgCRun.c)
=> stg_returnToStackTop (rts/StgStartup.cmm)
=> stg_enter_info (rts/HeapStackCheck.cmmのINFO_TABLE_RET( stg_enter, RET_SMALL, P_ unused))
=> ZCMain_main_info (Main.hs)
=> call newCAF (rts/sm/Storage.c)
=> stg_ap_p_fast (utils/genapply/GenApply.hs genapplyコマンド出力結果)
=> stg_bh_upd_frame_info
=> stg_marked_upd_frame_info
=> call overwritingClosure
@master-q
master-q / gist:3096308
Created July 12, 2012 06:40
HaskellのflushStdHandles関数のコールグラフ (間違い?)
flushStdHandles
-> hFlush stdout
-> wantWritableHandle "hFlush" stdout flushWriteBuffer
let (FileHandle _ m) = stdout -- mはMVar
-> wantWritableHandle' "hFlush" stdout m flushWriteBuffer
let act = checkWritableHandle flushWriteBuffer
-> withHandle_' "hFlush" stdout m act
let act' = \h_ -> {do a <- act h_; return (h_,a)}
-> withHandle' "hFlush" stdout m act'
-> (h',v) <- do_operation "hFlush" h act' m
@master-q
master-q / gist:3192919
Created July 28, 2012 11:29
newCAFの第三引数は何者なのか?
(gdb) b newCAF
Breakpoint 1 at 0x69c15c: file rts/sm/Storage.c, line 353.
(gdb) run +RTS -V0
Starting program: /home/kiwamu/src/DiveIntoRTS/Main +RTS -V0
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Breakpoint 1, newCAF (reg=0x94ee18, caf=0x90c8a0, bh=0x7ffff6c04000) at rts/sm/Storage.c:353
353 if (lockCAF(caf,bh) == 0) return 0;
@master-q
master-q / gist:3192949
Created July 28, 2012 11:44
ZCMain_main_infoからstg_ap_p_fastが呼ばれる前にスタックトップから2番目に置かれるのはstg_CAF_BLACKHOLE_infoへのポインタのポインタ
(gdb) b stg_ap_p_fast
Breakpoint 1 at 0x6b1470
(gdb) run +RTS -V0
Starting program: /home/kiwamu/src/DiveIntoRTS/Main +RTS -V0
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Breakpoint 1, 0x00000000006b1470 in stg_ap_p_fast ()
(gdb) info registers rbp
rbp 0x7ffff6c05370 0x7ffff6c05370