Skip to content

Instantly share code, notes, and snippets.

View iomz's full-sized avatar

Iori Mizutani iomz

View GitHub Profile
[{"id":"20ea5e9c.df15a2","type":"mqtt-broker","broker":"lain.sfc.wide.ad.jp","port":"1883","clientid":""},{"id":"f82418fa.07dbe8","type":"mqtt in","name":"Subscriber","topic":"gif-iot/data/","broker":"20ea5e9c.df15a2","x":138.5,"y":80,"z":"55f994be.aa066c","wires":[["bd027790.42fd88"]]},{"id":"9419ee6a.6be61","type":"mqtt out","name":"Publisher","topic":"gif-iot/cmd/<OpenBlocks MAC address>/servo","qos":"0","retain":"false","broker":"20ea5e9c.df15a2","x":537.5,"y":80,"z":"55f994be.aa066c","wires":[]},{"id":"bd027790.42fd88","type":"function","name":"2*objectTemp >> angle","func":"return {\n\tpayload: {\n\t\tid: 0,\n\t\tangle: 2*JSON.parse(msg.payload).objectTemp\n\t}\n};","outputs":1,"x":341,"y":80,"z":"55f994be.aa066c","wires":[["9419ee6a.6be61","eb9a908d.14657"]]},{"id":"eb9a908d.14657","type":"debug","name":"","active":true,"console":"false","complete":"false","x":548,"y":120,"z":"55f994be.aa066c","wires":[]}]
@iomz
iomz / transAccelsToAngles.js
Last active August 29, 2015 14:16
accelXY to double servo angles (for Node-RED demo)
/* Parse a string received as MQTT message to a JSON object */
var data = JSON.parse(msg.payload);
/* Extrace attributes stored in the JSON */
var accelX = data.accelX;
var accelY = data.accelY;
/* Compute the Theta and Phi from Acceleration along x/y axis */
var theta = - (Math.asin(accelY));
var phi = Math.asin(accelX/Math.cos(theta));
# download http://scanningtheearth.org/data/[0-9]+
wget -q -O - http://scanningtheearth.org/data | grep "href=\"[0-9]\+\"" | sed "s/^.*href=\"//g" | sed "s/\".*$//g" | xargs -I {} wget -O {}.csv http://scanningtheearth.org/data/{}
## 対象のhtmlをダウンロードして、stdoutからpipeする
#wget -q -O - http://scanningtheearth.org/data |
#
## 数字のみを含むhrefがある行をまず抽出して、その前後をトリムする
#grep "href=\"[0-9]\+\"" | sed "s/^.*href=\"//g" | sed "s/\".*$//g" |
#
## できた数字の列からurlとファイル名をして出力
@iomz
iomz / sfs-hw-grade-extractor.py
Last active April 25, 2016 01:45
For extracting grade from comments in SFC-SFS assignment page
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from HTMLParser import HTMLParser
from re import match, search
from sys import exit, stdout
import csv
class HWParser(HTMLParser):
def __init__(self):
HTMLParser.__init__(self)
@iomz
iomz / mas.md
Last active July 29, 2021 20:35

Terminology and Tooling in Mutli-agent System (MAS)

MAS is a computerized system composed of multiple interacting intelligent agents to solve problems that cannot be solved by a monolithic approach.

The definition of intelligent agents varies between different approaches such as methodic, functional, procedural approaches, algorithmic search, or reinforcement learning.

In this note, I attempt to summarize the terminology and tooling used in one of the MAS approaches; procedural reasoning systems (PRS) based on the belief-desire-intention (BDI) model.

AgentSpeak

AgentSpeak [1] is a programming language to formalize BDI architecture for (cognitive) autonomous agents as an abstraction of one of the implemented PRS, and falls in the logic programming paradigm with horn-clauses.