Skip to content

Instantly share code, notes, and snippets.

View iomz's full-sized avatar
❤️‍🔥

Iori Mizutani iomz

❤️‍🔥
  • University of St.Gallen
  • St.Gallen, Switzerland
  • 16:42 (UTC +02:00)
  • X @iomz
View GitHub Profile
@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.

# 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 / duplicate_dynamodb_table.py
Created March 26, 2014 00:21
Duplicate a table in AWS DynamoDB (for renaming or manual fix)
from boto.dynamodb2.exceptions import ValidationException
from boto.dynamodb2.fields import HashKey, RangeKey
from boto.dynamodb2.layer1 import DynamoDBConnection
from boto.dynamodb2.table import Table
from boto.exception import JSONResponseError
from time import sleep
import sys
if len(sys.argv) != 3:
print 'Usage: %s <source_table_name> <destination_table_name>' % sys.argv[0]
@iomz
iomz / gif-iot-demo.json
Last active May 2, 2019 01:38
gif-iot-demo for Node-RED
[{"id":"20ea5e9c.df15a2","type":"mqtt-broker","broker":"lain.sfc.wide.ad.jp","port":"1883","clientid":""},{"id":"e6455180.19bab","type":"function","name":"pwm1","func":"return {\n\tpayload: {\n\t\tid: 1,\n\t\tangle: Math.floor(msg.payload.pwm1)\n\t}\n};","outputs":1,"x":510,"y":80,"z":"8c26fbba.73d908","wires":[["5df8adb5.a20754","bc0f8744.43f078"]]},{"id":"b0f29aba.4f0d68","type":"function","name":"pwm0","func":"return {\n\tpayload: {\n\t\tid: 0,\n\t\tangle: Math.floor(msg.payload.pwm0)\n\t}\n};","outputs":1,"x":510,"y":40,"z":"8c26fbba.73d908","wires":[["5df8adb5.a20754","bc0f8744.43f078"]]},{"id":"bc0f8744.43f078","type":"mqtt out","name":"openblocks14/servo","topic":"gif-iot/cmd/78:4B:87:AA:9A:74/servo","qos":"0","retain":"false","broker":"20ea5e9c.df15a2","x":811,"y":80,"z":"8c26fbba.73d908","wires":[]},{"id":"df42383c.20bdc8","type":"mqtt in","name":"gif-iot/data/78:A5:04:8C:29:BA","topic":"gif-iot/data/78:A5:04:8C:29:BA","broker":"20ea5e9c.df15a2","x":139.5,"y":40,"z":"8c26fbba.73d908","wires":[["91da0
@iomz
iomz / gist:a0d5f86eceee39e110c0
Created January 25, 2015 07:46
Node-RED: door-demo
[{"id":"68bf71d.f97409","type":"mongodb","hostname":"YOURHOST","port":"00000","db":"YOUR_DB","name":"IBMCloud MongoDB"},{"id":"f8a512bc.075af","type":"websocket-listener","path":"/ws/door","wholemsg":"false"},{"id":"bd385f48.42c7a","type":"debug","name":"device data","active":true,"complete":"true","x":290.83332443237305,"y":147.6666717529297,"z":"5cf8236b.a307dc","wires":[]},{"id":"731fcbfd.8ce034","type":"websocket out","name":"/ws/door","server":"f8a512bc.075af","x":757,"y":183,"z":"5cf8236b.a307dc","wires":[]},{"id":"443b3381.bbc4cc","type":"ibmiot in","authentication":"quickstart","apiKey":"","inputType":"evt","deviceId":"784b87a33025","applicationId":"","deviceType":"+","eventType":"+","commandType":"","format":"json","name":"IBM IoT App In","service":"quickstart","allDevices":"","allApplications":"","allDeviceTypes":true,"allEvents":true,"allCommands":"","allFormats":"","x":95,"y":148,"z":"5cf8236b.a307dc","wires":[["bd385f48.42c7a","136e1892.ec91e7"]]},{"id":"136e1892.ec91e7","type":"function","name":
@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 / stay_over.py
Last active April 24, 2016 16:04
gist: 2383539 in Python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# SFC-SFS "Report for overnight stay" script
# Last modified: 4/12/2016
#
# **Fisrt complete the values below**
# =begin===========================================================
login = "" # Ex. "s58000yf"
passwd = "" # Ex. "yukichifukuzawa" (passwd is hardcoded here)
@iomz
iomz / felica_dump.c
Created April 16, 2013 05:57
Read card ID (IDm) by Pasori reader and send it by socket communication
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
@iomz
iomz / LICENSE.txt
Created July 24, 2012 13:09 — forked from 140bytes/LICENSE.txt
140byt.es -- Click ↑↑ fork ↑↑ to play!
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@iomz
iomz / HadamardMatrixMaker.py
Created July 19, 2012 14:29
Takes an interger n for 2^n x 2^n Hadamard matrix
#!/usr/bin/env python
# Takes an interger n for 2^n x 2^n Hadamard matrix
import numpy as np
import sys
def recursiveKronecker(k, hmat):
if 2**(k-1) == 1:
return hmat
else: