Skip to content

Instantly share code, notes, and snippets.

View yomimono's full-sized avatar
https://ko-fi.com/yomimono

yomimono yomimono

https://ko-fi.com/yomimono
View GitHub Profile
@yomimono
yomimono / ec2-ebs-ami.sh
Last active June 21, 2016 12:21
Automate creation of an EC2-ready Mirage unikernel.
#!/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
@yomimono
yomimono / fortune.hs
Created March 10, 2014 23:03
fortune server in haskell
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 ()
@yomimono
yomimono / Makefile
Last active January 2, 2016 01:39
An implementation of the Sieve of Eratosthenes, which answers the the question "what is the nth prime?", as long as n is <= 10001.
CFLAGS = -g -Wall
all : problem_7
problem_7 : problem_7.c
$(CC) $(CFLAGS) -o $@ $< -lm
@yomimono
yomimono / coruscate.ino
Created December 14, 2013 07:28
An Arduino program which instructs independently-addressable wearable LEDs to change color at random while avoiding certain undesirable states, and to set their intensity in accordance with input from a light sensor.
#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)