Skip to content

Instantly share code, notes, and snippets.

@TakuroFukamizu
TakuroFukamizu / m5sesame.ino
Created August 25, 2019 05:25
Control SESAME mini by M5Stack
#include <M5Stack.h>
#include <WiFi.h>
#include <WiFiMulti.h>
#include <HTTPClient.h>
#include <ArduinoJson.h>
#define WIFI_SSID "YOUR WIFI SSID"
#define WIFI_PASS "YOUR WIFI PASS"
#define SESAME_TOKEN "YOUR API KEY"
#define SESAME_DEVICE_ID "YOUR SESAME ID"
#include <M5Atom.h>
// M5AtomのGroveコネクタ
#define DIR_PIN 32
#define STEP_PIN 26
void setup() {
M5.begin(true, false, true);
// EasyStepper(A3967, A4988) の制御ピン
@TakuroFukamizu
TakuroFukamizu / boot.py
Last active July 20, 2019 00:46
networking sample script for Sipeed M1w dev boards
import network, socket, time, sensor
import gc
import os
import lcd, image
from machine import UART
from Maix import GPIO
from board import board_info
from fpioa_manager import fm
@TakuroFukamizu
TakuroFukamizu / boot.py
Created May 9, 2019 09:17
maixpy machine vison sample with recording video
import sensor
import image
import video
import lcd
import KPU as kpu
lcd.init()
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
@TakuroFukamizu
TakuroFukamizu / Dockerfile
Created November 15, 2018 18:53
tensorflow-gpu構築済みのdockerでtensorflowを含むPipfileを動かすときのバッドノウハウ
# install dependencies
COPY Pipfile Pipfile.lock ./
# RUN set -x; \
# pipenv install --system --verbose
# こうやりたいけど、tensorflow-gpuよりpipenvで入るtensorflowが優先されてしまうのでNG
RUN set -x; \
pipenv lock -r > requirements.txt; \
sed -i.bak '/^tensorflow/d' requirements.txt; \
@TakuroFukamizu
TakuroFukamizu / prefcode.ja.json
Last active May 31, 2018 18:05
Japanese Prefecture Code
[
{ "code": 1, "title": "北海道" },
{ "code": 2, "title": "青森県" },
{ "code": 3, "title": "岩手県" },
{ "code": 4, "title": "宮城県" },
{ "code": 5, "title": "秋田県" },
{ "code": 6, "title": "山形県" },
{ "code": 7, "title": "福島県" },
{ "code": 8, "title": "茨城県" },
{ "code": 9, "title": "栃木県" },
@TakuroFukamizu
TakuroFukamizu / .babelrc
Last active May 17, 2018 12:21
webpack4-node-babel
{
"presets": [
[
"env",
{
"modules": false
}
],
"es2017"
]
@TakuroFukamizu
TakuroFukamizu / ip_access_control_in_bottle.py
Created March 19, 2018 12:15
Access Control with client IP Address for bottle.py
from bottle import route, hook, run, request, HTTPResponse
ipac_list = [ "127.0.0.1", "999.999.999.999" ] # safe ip addresses here.
@hook('before_request')
def before_request():
remote_addr = request.environ.get('REMOTE_ADDR')
if remote_addr not in ipac_list:
print(request.environ['PATH_INFO'], " -> /error_403")
request.environ['PATH_INFO'] = '/error_403'
@TakuroFukamizu
TakuroFukamizu / update-version.js
Created March 17, 2018 10:31
"npm version" like update command.
"use strict";
const fs = require('fs');
// $ node update-version.js build
/*
$ node update-version.js build
update version from 1.6.9 to 1.6.10
$ node update-version.js minor
update version from 2.0.0 to 2.1.0
@TakuroFukamizu
TakuroFukamizu / counter.sh
Created May 6, 2017 04:46
counter in bash
#!/bin/bash
# countlogファイルに現在のカウント数を書き出し、スクリプトを呼ぶたびにカウントアップする
txt=`cat countlog`
echo $txt
res=$(( txt + 1 ))
# countlogを使用した処理。ここではREST APIのcall
curl -X GET "http://hostname/someapi?count=$res"