Skip to content

Instantly share code, notes, and snippets.

View iktakahiro's full-sized avatar

Takahiro Ikeuchi iktakahiro

View GitHub Profile

mraa

LED (Lチカ)

>>> import mraa
>>> led = mraa.Gpio(6) # 初期化
>>> led.dir(mraa.DIR_OUT) # 出力対象としてセット
0
>>> led.getPin() # ピン番号を取得

Publisher

送信

from time import sleep
import paho.mqtt.client as mqtt

host = 'v157-7-84-147.z1d11.static.cnode.jp'
port = 1883

AWS API-Gateway と LCD を組み合わせて利用する

import time
import requests
import pyupm_i2clcd as lcd

# requests モジュールでAPIからGET
r = requests.get('https://d6h35jv1q8.execute-api.us-east-1.amazonaws.com/production/weather').json()

スイッチとLEDを連動

import mraa
import time

class Counter(object):
    count = 0

c = Counter()
@iktakahiro
iktakahiro / file0.txt
Last active May 11, 2016 12:26
JavaScript のモダン開発環境を求めて 〜 前編・Riot.js 導入まで ref: http://qiita.com/iktakahiro/items/b0bcb37a61293b36af9e
# nodebrew のインストール
brew install nodebrew
# Node.js のインストール
mkdir -p ~/.nodebrew && cd ~/.nodebrew
nodebrew install-binary stable # stable は v4.2.1 などでも可
# PATH を登録し、アクティブにする
echo 'export PATH=$HOME/.nodebrew/current/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
@iktakahiro
iktakahiro / file0.txt
Last active October 22, 2015 12:18
EJS と gulp を利用した HTML の生成 ref: http://qiita.com/iktakahiro/items/8569ff9ec0158e518393
npm -g install gulp
npm install ejs gulp gulp-ejs gulp-plumber --save-dev
@iktakahiro
iktakahiro / file0.txt
Created December 4, 2015 04:45
Babel 6 + ES6 + Mithril + MSX + gulp ref: http://qiita.com/iktakahiro/items/f39ed7629b593063792d
npm install babel-plugin-mjsx --save-dev
type Member struct {
Number int64 `db:"number"`
Name string `db:"name"`
}
members := []Member{}
members = append(members, Member{10, "Lionel"})
members = append(members, Member{9, "Luis"})
fmt.Println(members) // [{101 Lionel true} {102 Luis false}]
@iktakahiro
iktakahiro / Solidity
Created December 29, 2015 18:05
Solidity Example - record of reading
contract proofOfBook {
mapping(string => uint) books;
mapping(address => Log) logs;
struct Log {
string isbn;
uint date;
uint rate;
}
@iktakahiro
iktakahiro / file0.js
Last active September 25, 2017 09:28
gulp-ejs 2.0.0 で .html ファイルを出力する場合拡張子の指定が必須に ref: http://qiita.com/iktakahiro/items/5a6228a880a0a1321a39
import ejs from 'gulp-ejs';
gulp.task('ejs', () => {
var json = JSON.parse(fs.readFileSync("./src/html/_layout/var.json"));
gulp.src(['./src/html/_page/**/*.ejs'])
.pipe(ejs(json, {"ext": ".html"})) // "ext" の値を指定
.pipe(gulp.dest('./dist/html/'));
});