Skip to content

Instantly share code, notes, and snippets.

@suzukiken
suzukiken / gist:1863d89c12013427e72c
Last active August 29, 2015 14:23
post-ifttt-maker.py
import requests
requests.post("http://maker.ifttt.com/trigger/button_pressed/with/key/YOUR_SECRET_KEY", json={"value1": "Hello world."})
@suzukiken
suzukiken / gist:83ecc611e9ccafad56e6
Created October 31, 2015 08:15
Amazon Lambda reads S3 bucket information and update IoT Thing's status
import os
import sys
import json
root = os.environ["LAMBDA_TASK_ROOT"]
sys.path.insert(0, root)
import boto3
s3 = boto3.client('s3')
@suzukiken
suzukiken / gist:0a432167040107bf4a5c
Created October 31, 2015 08:48
ThingShadowEcho.ino additional code.
// print Count and Time
int cntst = delta.indexOf("\"Count\":");
if (cntst != -1) {
cntst += strlen("\"Count\":");
int cnted = delta.indexOf(",");
if (cnted == -1) {
cnted = delta.indexOf("}");
}
String cnt = delta.substring(cntst, cnted);
Serial.println("Count: " + cnt);
@suzukiken
suzukiken / gist:69910480f99077d292ea
Created November 7, 2015 09:18
s3-lambda-iot-yun-continued-json
"state": {
"desired": {
"Count": バケットの中のオブジェクトの数,
"Time": アップロードされたオブジェクトの変更日時
}
}
@suzukiken
suzukiken / gist:720f465317a9a5dad40c
Created November 7, 2015 09:20
s3-lambda-iot-yun-continued-LAMBDA_TASK_ROOT
import os
import sys
root = os.environ["LAMBDA_TASK_ROOT"]
sys.path.insert(0, root)
@suzukiken
suzukiken / sms.py
Last active September 25, 2021 12:18
Sending / Receiving SMS using Raspberry Pi, Soracom Air SIM and ABIT AK-020
# coding: utf-8
'''Sending / Receiving SMS using Raspberry Pi, Soracom Air SIM and ABIT AK-020
'''
import time
import serial
import re
@suzukiken
suzukiken / pressure-chart.html
Last active August 31, 2016 10:52
A chart of atmospheric pressure measured with Bosch BME280 using Milkcocoa and Charts.js
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8">
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.2.1/Chart.js"></script>
<script src="https://cdn.mlkcca.com/v0.6.0/milkcocoa.js"></script>
<title>ESPr-BME280</title>
</head>
<body>
@suzukiken
suzukiken / multiple-chart.html
Created August 31, 2016 11:03
Draw chart of pressure, humidity, temperature and light measured by Bosch BME280. Milkcocoa for storing data and Charts.js for draw charts.
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8">
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.2.1/Chart.js"></script>
<script src="https://cdn.mlkcca.com/v0.6.0/milkcocoa.js"></script>
<title>ESPr-BME280</title>
</head>
<body>
str = '''
from machine import Pin
import utime
from m5stack import lcd, buttonA
pinout = Pin(5, Pin.OUT)
def onA():
for i in range(0, 2):
pinout.value(1)
@suzukiken
suzukiken / gist:79177cf0af6eedb5c73216ef09ccd3c0
Created March 21, 2021 08:39
Sample create table sql for Athena
CREATE EXTERNAL TABLE IF NOT EXISTS table_name (
Item struct <
id:struct <
S:string
>,
address:struct <
M:struct <
zip:struct <
S:string
>,