Skip to content

Instantly share code, notes, and snippets.

View mugifly's full-sized avatar
🏠
Working from home

Masanori Ohgita mugifly

🏠
Working from home
View GitHub Profile
@mugifly
mugifly / image-predict-on-tfjs-node.js
Last active January 7, 2024 16:11
Image Prediction on tfjs-node (with model made by Teachable Machine Image)
const tf = require('@tensorflow/tfjs-node');
const Jimp = require('jimp');
// Directory path for model files (model.json, metadata.json, weights.bin)
// NOTE: It can be obtained from [Export Model] -> [Tensorflow.js] -> [Download my model]
// on https://teachablemachine.withgoogle.com/train/image
const MODEL_DIR_PATH = `${__dirname}`;
// Path for image file to predict class
const IMAGE_FILE_PATH = `${__dirname}/example.jpg`;
airi-totoki 十時愛梨 passion
akane-hino 日野茜 passion
aki-yamato 大和亜季 cool
anasutashia アナスタシア cool
anzu-futaba 双葉杏 cute
arisu-tachibana 橘ありす cool
asuka-ninomiya 二宮飛鳥 cool
ayame-hamaguchi 浜口あやめ passion
chie-sasaki 佐々木千枝 cool
chieri-ogata 緒方智絵里 cute
@mugifly
mugifly / morninp.md
Last active December 28, 2020 03:52
Unofficial CLI command for mornin'+ (mornin' plus) smart curtain.

morninp.py

Unofficial CLI command for mornin'+ (mornin' plus) smart curtain.

Requirements: Python 3, bluepy 3.2+, pycryptodome 3.6+


@mugifly
mugifly / esp-signal-lights.ino
Created April 26, 2019 02:22
ESP8266 + Triple Signal Lights
// ESP8266 + 積層信号灯 (3色)
// https://gist.github.com/mugifly/
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
#include <timer.h>
// 設定 - Wi-Fi
#define WLAN_SSID "XXXXXX"
@mugifly
mugifly / esp-1wire-temp-sensor-with-hassio.ino
Last active March 17, 2019 14:34
ESP8266 + DS18B20 One-Wire Temperature Sensor (Works with Hass.io)
// ESP8266 + DS18B20 One-Wire Temperature Sensor (Works with Hass.io)
// https://gist.github.com/mugifly/8e5a0aa81ca4a2485b2c2b46e0968fc6
#include <ESP8266WiFi.h>
#include <WiFiClientSecure.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include <timer.h>
@mugifly
mugifly / ghome-notifier-server.js
Last active March 27, 2019 10:07
Simplest API Server for Google Home Notifier
/**
* Simplest API Server for Google Home Notifier
* https://gist.github.com/mugifly/22af0d55ccf4099becd44165f6500196/
* Thanks for https://github.com/noelportugal/google-home-notifier
**/
'use strict';
// Language to speak
@mugifly
mugifly / mag.md
Last active June 3, 2019 14:56
A simplest and unofficial client command for leafee mag (IoT sensor for doors and windows)

mag.py

A simplest and unofficial client command for leafee mag

Installation

It tested on Raspberry Pi Zero W with Raspbian Stretch.

$ sudo apt-get install python-pip libglib2.0-dev bluez-tools
$ sudo pip install bluepy
@mugifly
mugifly / switchbot-cmd.md
Last active February 10, 2022 23:58
Simplest Switchbot Command

switchbot-cmd.py

Simplest Switchbot Command

Installation

It tested on Raspberry Pi Zero W with Raspbian Stretch.

$ sudo apt-get install python-pip libglib2.0-dev bluez-tools
$ sudo pip install bluepy
@mugifly
mugifly / start-netconsole-capture.sh
Created December 18, 2016 16:45
Netconsole capturing script
#!/bin/bash
ip=` ip --oneline --family inet address show dev wlp8s0 | cut -d' ' -f7 | cut -d '/' -f1`
echo "-- Watching on ${ip}:6666 --"
nc -u -l -p 6666
@mugifly
mugifly / img-conv-for-slack-emoji
Last active July 26, 2022 18:45
Image Converter for Slack Emoji (128px) - Required: ImageMagick.
#!/bin/bash
set -e
echo -e "Image Converter for Slack Emoji\nNOTICE: The image will be overwritten."
if [ $# -lt 1 ]; then
echo "USAGE:"
echo -e " ${0} IMG_FILE [IMG_FILE...]\n"
echo "IMG_FILE:"