Skip to content

Instantly share code, notes, and snippets.

View yokoyama-flogics's full-sized avatar

Atsushi Yokoyama yokoyama-flogics

View GitHub Profile
@yokoyama-flogics
yokoyama-flogics / sentence-transformer-embedding-similarity-analysis.md
Last active December 3, 2024 07:21
Sentence Transformer Embedding Similarity Analysis

あなたのPCで簡単AI。文章の意味を数値化して類似度を解析しよう

自分の PC に Python などをインストールしないで実行するには

以下の方法を使うと、(最新のウェブブラウザさえあれば)御自分の PC に何もインストールせずに動作を確認できます。

Google Colab で動かす場合

@yokoyama-flogics
yokoyama-flogics / powermeter_grafana_dashboard.json
Created August 11, 2023 09:10
A sample dashboard for Grafana
{
"__inputs": [
{
"name": "DS_ELASTICSEARCH_POWER_METER",
"label": "Elasticsearch power_meter",
"description": "",
"type": "datasource",
"pluginId": "elasticsearch",
"pluginName": "Elasticsearch"
}
@yokoyama-flogics
yokoyama-flogics / powermeter.py
Created August 11, 2023 08:55
Obtain power consumption data of a smart plug (Tuya) and put the data to Elasticsearch (also also MQTT)
import json
import time
from datetime import datetime
import paho.mqtt.publish as publish
import schedule
import tinytuya
from elasticsearch import Elasticsearch
ELASTIC_HOSTS = ["node1", "node2"]
# Copyright 2023, Atsushi Yokoyama, Firmlogics
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright