Skip to content

Instantly share code, notes, and snippets.

View teru01's full-sized avatar

Teruya Ono teru01

  • Ubie, Inc.
  • Tokyo, JP
View GitHub Profile
const makeImage = (elFile, file) => {
const elImage = document.createElement('img');
elFile.appendChild(elImage);
const reader = new FileReader();
reader.addEventListener('load', (e) => {
elImage.src = e.target.result;
});
reader.readAsDataURL(file);
};
int fibonacci(int n, int *p){
if(n == 0) {
p[0] = 0;
return p[0];
}else if(n == 1){
p[1] = 1;
return p[1];
}else{
p[n] = fibonacci(n-1, p) + fibonacci(n-2, p);
return p[n];
@teru01
teru01 / server.py
Last active January 15, 2018 08:32
from bottle import Bottle, run, post, request, redirect
import wiringpi as wp
app = Bottle()
state = 0
stdict = {0:"turn off", 1:"turn on"}
wp.wiringPiSetupGpio()
wp.pinMode(2, 1)
@app.route('/')