Skip to content

Instantly share code, notes, and snippets.

import copy
from tqdm import tqdm
# ODリストを取得する
def getODs(list):
results = []
# 並び順の候補を取得する
for o in removeDuplicates(getOrders(list)):
# 経路を作成
@nikotan
nikotan / lean.py
Last active December 30, 2019 08:47
idea = idea0
while idea is not None:
idea = learn(measure(build(idea)))
@nikotan
nikotan / 1ClickToIfttt_lambda.py
Last active January 4, 2019 10:02
Python script for AWS lambda to forward AWS IoT 1-Click event to IFTTT
import json
import os
import urllib.request
import logging
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
def lambda_handler(event, context):
@nikotan
nikotan / BLETagMonitor_lambda.py
Last active May 26, 2018 23:08
Python script for server side of IoT BOT to monitor BLE tags (for AWS lambda)
# -*- coding: utf-8 -*-
from datetime import datetime, timedelta, timezone
import boto3
from boto3.session import Session
from boto3.dynamodb.conditions import Key
TIMEOUT_SEC = 180
def lambda_handler(event, context):
@nikotan
nikotan / BLETagMonitor_esp32.ino
Last active January 1, 2019 10:08
IoT BOT to monitor BLE tags using ESP32
#include <codecvt>
#include <string>
#include <cassert>
#include <locale>
#include <esp_system.h>
#include <rom/rtc.h>
#include <EEPROM.h>
#include <WiFi.h>
@nikotan
nikotan / esp8266_PostMonitor.ino
Created April 30, 2018 08:10
IoT BOT to monitor mailbox using ESP8266 and tilt switch
#include <ESP8266WiFi.h>
#include <WiFiClientSecure.h>
#define DEBUG
#define PIN_LED 4
#define SSID "{your_ssid}"
#define PASSWORD "{your_password}"
#define IFTTT_HOST "maker.ifttt.com"
#define IFTTT_PATH "/trigger/{your_event}/with/key/{your_key}"
@nikotan
nikotan / nikobot.lua
Last active April 9, 2016 14:38
LINE BOT API sample code on webscript.io (with Microsoft Translator Text API)
-- setting
local mstr_cid = 'client_id for microsoft translator text api'
local mstr_secret = 'client_secret for microsoft translator text api'
local line_id = 'Channel ID for LINE BOT API'
local line_secret = 'Channel Secret for LINE BOT API'
local line_mid = 'MID for LINE BOT API'
-- function: mstr
function mstr(text, cid, secret)
local lom = require 'lxp.lom'
@nikotan
nikotan / main.cpp
Created August 16, 2011 11:49
face detection sample code for OpenCV
#include <opencv/cv.h>
#include <opencv/highgui.h>
#include <opencv/ml.h>
void doMosaic(IplImage* in, int x, int y,
int width, int height, int size);
int main (int argc, char **argv)
{
int i, c;
@nikotan
nikotan / dbfile.pl
Created April 22, 2011 12:00 — forked from sugyan/dbfile.pl
#!/usr/bin/env perl
use strict;
use warnings;
use File::HomeDir;
use Path::Class qw(dir);
use DBI;
my $home = File::HomeDir->my_home;