Skip to content

Instantly share code, notes, and snippets.

(setq wl-message-id-use-message-from nil)
(setq wl-message-id-domain "ドメイン名")
#!/bin/zsh
if [ $# -ne 1 ]; then
echo "引数がありません" 1>&2
exit
fi
file="${1##*/}"
dir="${1%/*}"
dir="${dir#./}"
echo $dir
echo $file
@tom-a
tom-a / log.py
Last active December 30, 2019 16:51
# Epsolar TechnologyのTRIRON2210N-DS1-UCSをモニタ。
# 専用ケーブルはRS-485とUSBを相互に変換する。
# プロトコルはmodbusで、ドキュメントは1733_modbus_protocol.pdf
# ドキュメントによると、input registerの0x3100あたりで太陽電池パネルや、
# バッテリーの電圧を読み出せる。
# ただし0x3105はバッテリー充電電流で、
# バッテリーから電流が流れ出していても充電ではないので0になる。
# トータルでバッテリーに流れる電流は、0x331bとox331cから読み出す。
# 2の補数表現なので、Pythonでスマートに解決する方法がわからなかった。
#
/*
Texas Instruments INA226 Control sample
tomozh@gmail.com
2013.09.03 fix power miscalculation bug
2013.03.16 1st release
https://ore-kb.net/archives/150
がベース。計算部分を単純化したり、ambientにデータを投げたり。
const ambient = require('ambient-lib');
const five = require('johnny-five');
const board = new five.Board({
port: '/dev/cuaU0'
});
ambient.connect(00000,'xxxxxxxxxxxxxxx');
board.on('ready', function() {
var multi = new five.Multi({
const ambient = require('ambient-lib');
const SerialPort = require('serialport');
const port = new SerialPort('/dev/cuaU0');
const Readline = require('@serialport/parser-readline');
const parser = new Readline();
port.pipe(parser);
ambient.connect(00000,'xxxxxxxxxxxxxxxx');
parser.on('data', line => {
#include <esp_wifi.h>
#include <Wire.h>
#include "Ambient.h"
WiFiClient client;
Ambient ambient;
const unsigned int PERIOD = 300; // 秒
const unsigned int uS_TO_S_FACTOR = 1000000;
const ambient = require('ambient-lib');
const exec = require('child_process').exec;
ambient.connect(チャネルID,'ライトキー');
exec("cat /dev/cuaU0 | head -1", (err,stdout,stderr) => {
});
exec("cat /dev/cuaU0 | head -3 | sed '/^$/d' | tail -1", (err,stdout,stderr) => {
console.log(stdout);
ambient.send({d1: stdout}, (err, res, body) => {
if (err) { console.log(err); }
/*
気温測定
LM35Zをアナログポートにつないで測定
ARDUINO UNO用
*/
void setup() {
Serial.begin(9600);
analogReference(INTERNAL);
}
location / {
proxy_pass http://192.168.2.2:8080;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}