This file contains 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
#1 | |
shopt -s globstar && wc -l **/*.[ch] | |
#2 | |
find -name *.\[c\|h\] | xargs wc -l |
This file contains 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
-- insert a record if it doesn't exist, ignore if it does exist | |
-- if EventTypeName column is unique | |
INSERT OR IGNORE INTO EVENTTYPE (EventTypeName) VALUES 'ANI Received' | |
-- otherwise | |
INSERT INTO EVENTTYPE (EventTypeName) | |
SELECT 'ANI Received' | |
WHERE NOT EXISTS (SELECT 1 FROM EVENTTYPE WHERE EventTypeName = 'ANI Received'); |
This file contains 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
sudo apt-get install ruby1.9.1 | |
sudo ln -s /usr/bin/ruby1.9.1 /usr/bin/ruby | |
bash < <( curl https://rvm.beginrescueend.com/releases/rvm-install-head ) | |
sudo /usr/bin/apt-get install build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake | |
rvm install 1.9.2-head |
This file contains 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
.PHONY: clean test | |
test: allfirstlines_iteratee allfirstlines_naive gen_nuclear_test | |
bash run_test.sh | |
allfirstlines_naive: allfirstlines_naive.hs | |
ghc --make -rtsopts -O2 $@ | |
allfirstlines_iteratee: allfirstlines_iteratee.hs | |
ghc --make -rtsopts -O2 $@ |
This file contains 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 qualified Data.MemoCombinators as Memo | |
coins = [1,2,5,10,20,50,100,200] | |
sol1 = f | |
where f :: Int -> Int -> Int | |
f = Memo.memo2 Memo.integral (Memo.arrayRange (0,7)) mf | |
where mf :: Int -> Int -> Int | |
mf n k | (k >= 8) || (n < 0) = 0 | |
| n == 0 = 1 |
This file contains 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
class C a where | |
toString :: a -> String | |
instance C String where | |
toString = id | |
main = do | |
putStrLn $ toString "Hello World" |
This file contains 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.Dynamic | |
import Data.Maybe | |
hlist :: [Dynamic] | |
hlist = [toDyn "string", | |
toDyn (7::Int), | |
toDyn (pi :: Double), | |
toDyn 'x', | |
toDyn ((), Just "foo")] |
This file contains 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
f2_rbu | |
:: forall a_ase. GHC.Real.Integral a_ase => GHC.Types.Int -> a_ase | |
[GblId, Arity=2] | |
f2_rbu = | |
\ (@ a_ase) | |
($dIntegral_asf :: GHC.Real.Integral a_ase) | |
(eta_B1 :: GHC.Types.Int) -> | |
GHC.List.!! | |
@ a_ase | |
(GHC.List.filter |
This file contains 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
{-# LANGUAGE BangPatterns #-} | |
import Data.Word | |
import Data.List | |
sum_word :: Word -> Word | |
sum_word n = k n 0 | |
where k 0 s = s | |
k !n !s = k (n-1) (s+1) | |
main = do |
This file contains 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
{-# LANGUAGE DeriveDataTypeable #-} | |
module Main where | |
import System.Console.CmdArgs.Implicit | |
import System.IO | |
import System.Environment | |
import System.Exit | |
import Data.Maybe |
OlderNewer