ghc bf.hs
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
{io} = require './server' | |
net = require 'net' | |
{EventEmitter} = require 'events' | |
EE = new EventEmitter | |
# TCP/IP | |
server = net.createServer (client) -> | |
console.log 'client connected' | |
client.on 'end', -> |
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
// net 模組 | |
var net = require('net'); | |
// 建立一個 TCP 伺服器,當有人建立連線時就 ... | |
var server = net.Server(function (socket) { // 連線會當參數傳進來 | |
// 當有資料從這連線傳過來時就 ... | |
socket.on('data', function (data) { // 資料會當參數傳進來 | |
// 輸出到 console |
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
sum [a | a <- [1..1000], mod a 3 == 0 && mod a 5 == 0] |
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, ladies... | |
Look at your repo, | |
Now back to me, | |
Now back at your repo, | |
Now back to me. | |
Sadly, it isn't me, but if it stopped using nothing at all and switched to Travis CI | |
it could be like it's me. |
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
module Logic where | |
open import Function using (const; _∘_) | |
open import Data.Unit using (⊤; tt) | |
open import Data.Bool using (Bool; false; true; not; _∨_; if_then_else_) | |
open import Data.Nat using (ℕ; zero; suc; _≟_; _+_) | |
open import Data.List using (List; []; _∷_; map; _++_) | |
open import Data.Product using (Σ; _,_; _×_) | |
open import Relation.Nullary using (Dec; yes; no) | |
open import Relation.Binary.PropositionalEquality using (_≡_; refl; inspect; [_]) |
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.Set | |
type State = String | |
type Alphabet = Char | |
type Language = String | |
type States = Set State | |
type Alphabets = Set Alphabet | |
type Transition = State -> Alphabet -> State | |
type NDTransition = State -> Alphabet -> States |
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 | |
import Data.Bits | |
fib :: Int -> Integer | |
fib n = snd . foldl' fib' (1, 0) . dropWhile not $ | |
[testBit n k | k <- let s = bitSize n in [s-1,s-2..0]] | |
where | |
fib' (f, g) p | |
| p = (f*(f+2*g), ss) | |
| otherwise = (ss, g*(2*f-g)) |
- avenir
- asap
- oldenburg
- museo slab
- monda
- economica
- lato
- iterstatecondmono
- oxygen
- rambla
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
adapter :: (Ptr CUChar -> CUInt -> Ptr CUChar -> Ptr CUInt -> IO CInt) -> Int -> String -> String | |
adapter function chunkSize content = map cuchar2char $ unsafePerformIO $ do | |
-- allocate buffers | |
inputBuffer <- mallocArray chunkSize | |
outputBuffer <- mallocArray chunkSize | |
outputSize <- mallocBytes 32 | |
-- put it in | |
pokeArray inputBuffer (map char2cuchar content) | |
poke outputSize (fromIntegral chunkSize) |
OlderNewer