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
$script = <<SCRIPT | |
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF | |
echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list | |
sudo apt-get update | |
sudo apt-get install -y mono-complete | |
sudo apt-get install -y automake libtool curl unzip | |
curl -sSL https://github.com/libuv/libuv/archive/v1.4.2.tar.gz | sudo tar zxfv - -C /usr/local/src | |
cd /usr/local/src/libuv-1.4.2 | |
sudo sh autogen.sh | |
sudo ./configure |
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 Keyboard | |
keyToBool x = if x == 0 then False else True | |
sfx p = lift (\p -> p.x) p | |
signalX = sfx Keyboard.arrows | |
xArrowPulse = fpsWhen 10 (keyToBool <~ signalX) | |
main = lift asText xArrowPulse |
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 Random | |
import Mouse | |
import Keyboard | |
data Fruit = Apple | Orange | Banana | Melon | Guava | |
rand = Random.range 0 4 (Mouse.clicks) | |
fruit n = if | n == 0 -> Apple | |
| n == 1 -> Orange | |
| n == 2 -> Banana | |
| n == 3 -> Melon | |
| otherwise -> Guava |
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 Random | |
data Brick = Line | LeftSquiggle | RightSquiggle | LeftStick | RightStick | Box | |
rand = Random.range 0 6 (constant 1) | |
brick n = if | n == 0 -> Line | |
| n == 2 -> LeftSquiggle | |
| n == 3 -> RightSquiggle | |
| n == 4 -> RightStick | |
| n == 5 -> LeftStick | |
| otherwise -> Box | |
brickText = asText <~ (brick <~ rand) |
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 Random | |
data Brick = Line | LeftSquiggle | RightSquiggle | LeftStick | RightStick | Square | |
rand a = Random.range 0 6 (constant a) | |
brick n = if | n == 0 -> Line | |
| n == 2 -> LeftSquiggle | |
| n == 3 -> RightSquiggle | |
| n == 4 -> RightStick | |
| n == 5 -> LeftStick | |
| otherwise -> Square | |
main = asText <~ (brick <~ (rand 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
time = lift (inSeconds . fst) (timestamp (fps 40)) | |
a dy = let c = filled blue (circle 10) | |
in collage 300 300 | |
[c |> move (0, 100 * cos dy)] | |
b = lift a time | |
main = b |
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 Signal | |
import Mouse | |
cl = (clamp 100 200) <~ Mouse.x | |
reactiveCircle = (filled blue) <~ (circle <~ (toFloat <~ cl)) | |
main = lift (collage 300 300) (Signal.combine [reactiveCircle]) |
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
let initMask length = List.init length (fun i -> if i = length - 1 then 1 else 0) | |
let addOne mask = List.foldBack (fun t (resList, c) -> (if (t = 1 && c = 1) then (0::resList, 1) elif (t = 0 && c= 0) then (0::resList, 0) else (1::resList, 0))) mask ([], 1) |> fst | |
let subsetsWhosSumsSatisfiesPredicate lst pred = | |
let rec work mask = seq{ | |
let sum, subSet = List.fold2 (fun (accSum, subSet) m l -> if m = 0 then (accSum, subSet) else (accSum + l, l::subSet)) (0, []) mask lst | |
if pred sum then | |
yield (List.rev subSet) | |
if List.exists (fun t -> t = 0) mask then | |
yield! work (addOne mask) | |
} |
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
open System.Net.Sockets | |
open System.IO | |
open System | |
let port = 1234 | |
let clientProc i = | |
printfn "Connecting" | |
let client = new System.Net.Sockets.TcpClient("192.168.48.43", port) | |
let inew = i+uint64(1) | |
let sw = new StreamWriter(client.GetStream()) |
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
[STAThread] | |
static void Main() | |
{ | |
_nui = new Runtime(); | |
var app = new Application(); | |
var window = new Window(); | |
InitializeNui(); //Initializing the Runtime object and opening video streams | |
CreateGUI(window); //Setting up a canvas to hold the RGB video and the image attached to the hand of captured person | |
var skeletonFrameReadyObservable = Observable.FromEventPattern(_nui, "SkeletonFrameReady"); | |
var trackedSkeletons = from ev in skeletonFrameReadyObservable |
NewerOlder