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
/* | |
* $ gcc `pkg-config --libs --cflags libuv` libuv_tcp_echo.c -o tcp_echo | |
*/ | |
#include <stdio.h> | |
#include <stdbool.h> | |
#include <stdlib.h> | |
#include <time.h> | |
#include <sys/socket.h> |
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 <iostream> | |
#include <functional> | |
#include <unordered_map> | |
template<class Arg, class Res> | |
class memoize { | |
std::function<Res(Arg)> func; | |
std::unordered_map<Arg, Res> mem; | |
public: |
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
{-# LANGUAGE GADTs #-} | |
module SafeList where | |
data Empty | |
data NonEmpty | |
class Emptiness e | |
instance Emptiness Empty | |
instance Emptiness NonEmpty |
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
#!/bin/bash | |
# | |
# CMOS reader in Bash | |
# | |
# Copyright (C) 2015, ZOG Industries Inc, Dmytro S. | |
# Permission to use, copy, modify, and/or distribute this software | |
# for any purpose with or without fee is hereby granted, provided that | |
# the above copyright notice and this permission notice appear in all | |
# copies. |
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 <iostream> | |
#include <string> | |
#include <set> | |
#include <vector> | |
#include <iterator> | |
#include <algorithm> | |
int main() { | |
std::string s; | |
std::getline(std::cin, s); |
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 SleepSort (sleepsort) where | |
import Control.Concurrent | |
import Control.Concurrent.STM | |
worker chan timefun val = do | |
threadDelay $ timefun val | |
atomically $ writeTChan chan val | |
sleepsort :: (a -> Int) -> [a] -> IO [a] |
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 <iostream> | |
#include <string> | |
using std::cout; | |
using std::endl; | |
using std::string; | |
template <typename T> | |
class clever_ptr { | |
string log; |
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.Binary.Get as BG | |
import Data.Binary.Put as BP | |
import Data.ByteString (ByteString) | |
import qualified Data.ByteString as B | |
import qualified Data.ByteString.Internal as BI | |
import qualified Data.ByteString.Lazy as BL | |
import Data.Word | |
import Data.Int |
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 Happstack.Server | |
import System.Environment | |
import Control.Monad (when) | |
main = do | |
args <- getArgs | |
when (length args < 2) $ error "Usage: ./HelloHTTP " | |
simpleHTTP nullConf $ serveDirectory EnableBrowsing ["index.htm"] (head args) |
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
#!/bin/bash | |
export CHECKSUM_AT=148 | |
function joinlines { | |
while read line ; do | |
echo -n "$line" | |
done | |
} |