Skip to content

Instantly share code, notes, and snippets.

View JustinSDK's full-sized avatar
👨‍👩‍👧
Working from home

Justin Lin JustinSDK

👨‍👩‍👧
Working from home
View GitHub Profile
@JustinSDK
JustinSDK / hoc.py
Created July 18, 2016 08:43
Python - High Order Components?
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):
@JustinSDK
JustinSDK / co2_tempature_humdity.ino
Last active September 30, 2015 06:24
自製 CO2、溫溼度感應器
#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
@JustinSDK
JustinSDK / Dockerfile
Last active September 5, 2015 07:36
Dockerfile for caterpillar/rpi-dev-java
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 && \
@JustinSDK
JustinSDK / Dockerfile_for_SSHD_with_Ubuntu_on_RPi2.dockerfile
Last active September 2, 2015 23:36 — forked from Wei1234c/SSHD.armv7.dockerfile
Dockerfile for SSHD with Ubuntu on RPi2
# 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.
@JustinSDK
JustinSDK / Dockerfile_for_Oracle-Java8_with_Ubuntu_on_RPi2.dockerfile
Last active September 2, 2015 22:55 — forked from Wei1234c/Oracle-Java8.armv7.dockerfile
Dockerfile for Oracle-Java8 with Ubuntu on RPi2
# 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.
@JustinSDK
JustinSDK / Dockerfile
Last active September 5, 2015 07:37
Dockerfile for caterpillar/rpi-gradle
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
@JustinSDK
JustinSDK / motoduino.ino
Created July 22, 2015 03:04
Arduino Yún 加 Motoduino 的網路小車(二)
#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;
@JustinSDK
JustinSDK / yun.ino
Created July 22, 2015 03:03
Arduino Yún 加 Motoduino 的網路小車(一)
#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)
@JustinSDK
JustinSDK / ForM.hs
Created February 26, 2015 09:40
〈Haskell Tutorial(31)do 區塊與 <- 綁定〉的習題解答
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
@JustinSDK
JustinSDK / EitherFunctor.hs
Created February 15, 2015 00:55
〈Haskell Tutorial(25)可映射盒中物行為的 Functor〉的解答
instance Functor (Either a) where
fmap f (Right x) = Right (f x)
fmap f (Left x) = Left x