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(now_skew). | |
-compile(export_all). | |
go() -> | |
A = os:timestamp(), | |
NA = now(), | |
Master = self(), | |
spawn(fun()->loop(1000000), Master!done end), | |
%spawn(fun()->loop(500000), Master!done end), | |
receive done->ok 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
;;; Global clock implementation of Life. | |
(defmodule life_sync_cell | |
(export (start_link 1) (set_neighbours 2) (tick 1) | |
(init 1) (handle_cast 2)) | |
(using gen_server) | |
(behaviour gen_server)) | |
(include-file "deps/lfe_utils/include/using.lfe") | |
;;; Exported: |
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
/* TOMMY's CONNECT 4 PROGRAM */ | |
#include <iostream> | |
using namespace std; | |
char cBlock[] = {178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178}; | |
int choice; | |
char block = 178; | |
bool bGameover = false; | |
char iPlayerTurn = 'X'; | |
bool bPlayerTurn = true; |
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 Main where | |
import Data.Word | |
import Data.Int | |
import Text.Parsec | |
import Control.Monad | |
import Control.Applicative hiding ((<|>),many) | |
import qualified Data.ByteString.Lazy as S | |
import Data.ByteString.Lazy (ByteString) |
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 Key ( decode | |
) where | |
import Control.Monad | |
import Data.Char | |
import Data.List | |
import Data.Word | |
import Data.Bits | |
import Data.Array | |
decode key = fmap (pack . cipher . shuffle) (initialize . normalize $ key) |
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
Hot Code Reload in the Small: Hot Upgrades in the Large | |
Erlang's strongest strength is reliability, and thus uptime. Language design, VM features, and OTP design principles come together to produce code with useful properties. Two important ones are arbitrary error recovery, and hot upgrades. With them, systems with many nines of uptime can be built. | |
This talk will focus on hot upgrades. We will start in the small, with low level mechanisms. Then, using examples and demonstrations, we'll cover the conventions and libraries that bring hot upgrades to the large. | |
By the end, you'll see how a system can be kept running non-stop despite being patched, updated, extended, and partially rewritten! |
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(tst). | |
-export([go/0]). | |
a()->1. | |
b()->two. | |
c()->"three". | |
go() -> [a(),b(),c()]. | |
{module, tst}. %% version = 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
;; ([{atom(),binary()}], pid()) -> {missing,atom()} | |
;; | {bad_value,atom()} | |
;; | {unescaped,|atom()} | |
;; | malicious | |
;; | ok. | |
(defn sanitize [args logger-pid] | |
(ablock user-err | |
; check for user screwing up the input, inform them | |
(check-missing args) | |
(if (/= '() it) |
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(iter). | |
-export([fac/1]). | |
-define( for(Arg,Seed,Body) | |
, begin F = fun(Iter,Arg)->Body end, F(F,Seed) end | |
). | |
-define( iter(Arg) | |
, Iter(Iter,Arg) | |
). | |
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
(defmodule octree | |
(export all)) | |
(include-file "all2.lfe") ; lfe_utils library | |
;; Vectors: | |
(defmacro :vec3 ((x y z) `(tuple 'vec3 ,x ,y ,z))) | |
(defn :+ [(:vec3 x y z) (:vec3 a b c)] |