This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hello! | |
0 stapio(2284): -> sys_execve | |
3 stapio(2284): name = ./exec | |
6 stapio(2284): argv[0] = ./exec | |
7 stapio(2284): envp[0] = HOSTNAME=localhost.localdomain | |
10 stapio(2284): envp[1] = TERM=xterm | |
15 stapio(2284): -> do_execve | |
17 stapio(2284): filename = ./exec | |
18 stapio(2284): __argv[0] = ./exec | |
20 stapio(2284): __envp[0] = HOSTNAME=localhost.localdomain |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.List | |
data RegressionCalcTable = RegressionCalcTable { | |
sumX :: Double, | |
sumY :: Double, | |
sumXX :: Double, | |
sumXY :: Double, | |
sumYY :: Double, | |
elemNum :: Double | |
} deriving (Show, Eq) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import System.Random | |
import Control.Monad | |
import Numeric.LinearAlgebra | |
import Graphics.Gnuplot.Simple | |
import Data.List | |
import System.Environment | |
import System.Exit | |
trainingDataFileName = "training.dat" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.Char | |
import Data.List | |
s = "73167176531330624919225119674426574742355349194934" | |
++ "96983520312774506326239578318016984801869478851843" | |
++ "85861560789112949495459501737958331952853208805511" | |
++ "12540698747158523863050715693290963295227443043557" | |
++ "66896648950445244523161731856403098711121722383113" | |
++ "62229893423380308135336276614282806444486645238749" | |
++ "30358907296290491560440772390713810515859307960866" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 10未満の自然数のうち、3 もしくは 5 の倍数になっているものは 3, 5, 6, 9 の4つがあり、 これらの合計は 23 になる。 | |
-- 同じようにして、1,000 未満の 3 か 5 の倍数になっている数字の合計を求めよ。 | |
euler1 = sum $ filter (\n -> n `mod` 3 == 0 || n `mod` 5 == 0) [1..999] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- フィボナッチ数列の項は前の2つの項の和である。 最初の2項を 1, 2 とすれば、最初の10項は以下の通りである。 | |
-- 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... | |
-- 数列の項の値が400万を超えない範囲で、偶数値の項の総和を求めよ。 | |
fibo = 1:2:(zipWith (+) (tail fibo) fibo) | |
euler2 = sum . filter even . takeWhile (< 4000000) $ fibo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Control.Monad.Reader | |
import Control.Monad.State | |
import qualified Data.Map as Map | |
data Elem = A | B | C | D | E | F | G | |
deriving (Show, Eq, Ord) | |
type Visited = [Elem] | |
type AdjMap = Map.Map Elem [Elem] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <errno.h> | |
#include <fcntl.h> | |
#include <sys/types.h> | |
#include <sys/stat.h> | |
int main() { | |
const int fd = open("/dev/random", | |
O_RDONLY); | |
int i; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import System.IO | |
import Control.Applicative | |
import Control.Monad | |
main = do | |
isEnd <- isEOF | |
unless isEnd $ do | |
ws <- words <$> getLine | |
forM_ ws $ \w -> do | |
putStrLn (w ++ "\t1") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import System.IO | |
import Control.Applicative | |
import Control.Monad | |
import Text.Parsec | |
import Text.Parsec.String | |
import Data.Map | |
import Data.Char | |
wordCount' :: Parser (String, Int) |