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 Control.Concurrent (forkIO) | |
import Control.Monad (forever) | |
import Network | |
import System.IO | |
import System.Random | |
rand :: Int -> IO Int | |
rand p = getStdRandom (randomR (0, p)) | |
fortune :: [String] -> (Handle, HostName, PortNumber) -> IO () |
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
#include <Adafruit_NeoPixel.h> | |
#define PIN 6 | |
#define PIXELS 7 | |
#define MAX_PERTURBATION 3 | |
#define RANDOM_SOURCE 10 | |
Adafruit_NeoPixel strip = Adafruit_NeoPixel(PIXELS, PIN, NEO_GRB + NEO_KHZ800); | |
void setup() { |
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 Mirage | |
(* If the Unix `MODE` is set, the choice of configuration changes: | |
MODE=crunch (or nothing): use static filesystem via crunch | |
MODE=fat: use FAT and block device (run ./make-fat-images.sh) | |
*) | |
let mode = | |
try match String.lowercase (Unix.getenv "FS") with | |
| "fat" -> `Fat | |
| _ -> `Crunch |
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 Lwt | |
open Printf | |
open V1_LWT | |
open Re_str | |
module Main (C:CONSOLE) (FS:KV_RO) (S:Cohttp_lwt.Server) = struct | |
let start c fs http = | |
let read_fs name = |
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 Lwt | |
open V1_LWT | |
module Main (C: V1_LWT.CONSOLE) (CLIENT_STACK: V1_LWT.STACKV4) = struct | |
let local_webserver="8.8.8.8" | |
let port = 5162 | |
let start c client_stack = | |
let construct_request () = | |
let buf = Io_page.(to_cstruct (get 1)) in |
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
337 (* Compose the overall thread from the various tx/rx threads | |
338 and the main listener function *) | |
339 let tx_thread = (Tx.thread t pcb ~send_ack ~rx_ack) in | |
340 let rx_thread = (Rx.thread pcb ~rx_data) in | |
341 let wnd_thread = (Wnd.thread ~utx ~urx ~wnd ~state ~tx_wnd_update) in | |
342 let threads = [ tx_thread; rx_thread; wnd_thread ] in | |
343 let catch_and_cancel = function | |
344 | Lwt.Canceled -> () | |
345 | ex -> | |
346 (* cancel the other threads *) |
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
#include <Wire.h> | |
#include <Adafruit_NeoPixel.h> | |
#include <Adafruit_Sensor.h> | |
#include <Adafruit_TSL2561.h> | |
#define PIN 6 | |
#define MINIMUM_LUX 20 | |
// Parameter 1 = number of pixels in strip | |
// Parameter 2 = pin number (most are valid) |
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
CFLAGS = -g -Wall | |
all : problem_7 | |
problem_7 : problem_7.c | |
$(CC) $(CFLAGS) -o $@ $< -lm |
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
#!/bin/bash | |
#set -e | |
#set -x | |
fail() { | |
echo $1 | |
[ -e ${EBS_DEVICE} ] && [ "$VOLUME_ID" != "" ] && [ $REGION != "" ] && { | |
ec2-detach-volume --region $REGION $VOLUME_ID | |
ec2-delete-volume --region $REGION $VOLUME_ID |
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
Less Code, Less Magic, More Results | |
## Major Changes | |
* The solo5 targets `ukvm` and `virtio` (see [https://mirage.io/blog/introducing-solo5]), which allow unikernels to run on KVM hypervisors and on FreeBSD via bhyve, are now available in the mainline `mirage` package. These targets use a newly refactored freestanding OCaml runtime (see [https://github.com/mirage/ocaml-freestanding]). | |
* The `V1` and `V1_LWT` modules, which contained module type definitions agreed upon by implementations used in `mirage`, have been renamed to `Mirage_types` and `Mirage_types_lwt`. The module type definitions themselves are no longer contained in this repository, but have been moved to their own independently-versioned repositories and are merely referenced from `Mirage_types` and `Mirage_types_lwt`. | |
* Across the universe of module type definitions, errors in computation are now signalled by a `result` type and a set of polymorphic variants representing common errors that might occur. Individual implementations may extend |
OlderNewer