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
def total_ordering(eq, gt): | |
def inner(clz): | |
class Ordering: | |
def __init__(self, *arg1, **arg2): | |
clz.__init__(self, *arg1, **arg2) | |
def __eq__(self, other): | |
return eq(self, other) | |
def __gt__(self, other): |
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 <Wire.h> | |
#include <LiquidCrystal_I2C.h> | |
#include <DHT.h> | |
#define MG_PIN (0) //define which analog input channel you are going to use | |
#define DC_GAIN (8.5) //define the DC gain of amplifier | |
#define READ_SAMPLE_INTERVAL (50) //define how many samples you are going to take in normal operation | |
#define READ_SAMPLE_TIMES (5) //define the time interval(in milisecond) between each samples in | |
//normal operation | |
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
FROM armv7/armhf-ubuntu:14.04 | |
MAINTAINER Justin Lin <caterpillar@openhome.cc> | |
ENV TERM linux | |
# Basic tools | |
RUN apt-get -qq update && \ | |
apt-get -qqy install wget && \ | |
apt-get -qqy install vim && \ | |
apt-get -qqy install unzip && \ |
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
# sshd | |
# VERSION: 0.0.2 | |
# origin: | |
# MAINTAINER Sven Dowideit <SvenDowideit@docker.com> | |
# https://docs.docker.com/examples/running_ssh_service/ | |
# | |
# modified by: Wei Lin | |
# date: 2015/9/2 | |
# Pull base image. |
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
# Oracle Java 8 Dockerfile | |
# | |
# https://github.com/dockerfile/java | |
# https://github.com/dockerfile/java/tree/master/oracle-java8 | |
# | |
# origin: https://github.com/dockerfile/java/blob/master/oracle-java8/Dockerfile | |
# modified by: Wei Lin | |
# date: 2015/9/2 | |
# Pull base image. |
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
FROM resin/rpi-raspbian | |
MAINTAINER Justin Lin <caterpillar@openhome.cc> | |
# Basic tools | |
RUN apt-get -qq update && \ | |
apt-get -qqy install wget && \ | |
apt-get -qqy install vim && \ | |
apt-get -qqy install unzip && \ | |
apt-get -qqy install git |
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 <Wire.h> | |
// Motor pins | |
int speed_motor1 = 6; | |
int speed_motor2 = 5; | |
int direction_motor1 = 7; | |
int direction_motor2 = 8; | |
// Sensor pins | |
int distance_sensor = A0; |
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 <Wire.h> | |
#include <Bridge.h> | |
#include <YunServer.h> | |
#include <YunClient.h> | |
// Yun server | |
YunServer server; | |
void setup() { | |
// Join i2c bus (address optional for master) |
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
sequence' :: Monad m => [m a] -> m [a] | |
sequence' [] = return [] | |
sequence' (x:xs) = do | |
value <- x | |
values <- sequence' xs | |
return (value : values) | |
forM' :: Monad m => [a] -> (a -> m b) -> m [b] | |
forM' xs f = sequence' $ map f xs |
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
instance Functor (Either a) where | |
fmap f (Right x) = Right (f x) | |
fmap f (Left x) = Left x |