Skip to content

Instantly share code, notes, and snippets.

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

SAITO, Tetsuya 3110

🏠
Working from home
View GitHub Profile
@3110
3110 / wifi_qrcode_generator.py
Created June 13, 2024 15:09
Wi-Fi接続用のQRコードを生成する
import qrcode
import argparse
VALID_ENCRYPTIONS = ["WEP", "WPA", "WPA2"]
DEFAULT_SIZE = 300
def generate_wifi_qrcode(ssid, password, filename, encryption="WPA2", size=DEFAULT_SIZE):
# 暗号化方式の検証
if encryption not in VALID_ENCRYPTIONS:
raise ValueError(f"無効な暗号化方式です: {encryption}。有効な値は {', '.join(VALID_ENCRYPTIONS)} です。")
; AutoHotKey 2.0で「]YYYYMMDD」と入力し,領域選択してCtrl+Cでクリップボードにコピーすると,YYYY年MM月DD日(曜日)に変換して置き換える
#Requires AutoHotkey v2.0
OnClipboardChange DateTranslatorCB
DateTranslatorCB(dataType)
{
if (dataType = 1 && RegExMatch(A_Clipboard, "^\](\d{4})(\d{2})(\d{2})$", &match))
{
DateStr := FormatTime(match[1] match[2] match[3], "yyyy年MM月dd日(ddd)")
A_Clipboard := DateStr
@3110
3110 / m5atoms3-mac-address.cpp
Last active January 12, 2023 13:36
ATOMS3のMACアドレスをQRコードと文字列で表示する
#include <M5AtomS3.h>
const size_t ETH_ALEN = 6;
const uint16_t SPACING = 4;
const uint8_t FONT = 1;
const uint8_t FONT_HEIGHT = 8;
const uint8_t QR_VERSION = 1;
uint8_t macAddr[ETH_ALEN] = {0};
char macStr[ETH_ALEN * 3 + 1] = {0};
@3110
3110 / lovot-study-with-audio-menu
Created July 22, 2021 12:54
LOVOT Studyに音声再生と同時にスクリプトを実行できる「音声再生」メニューを追加する
// ==UserScript==
// @name Start LOVOT Study with audio
// @namespace https://github.com/3110
// @version 0.3
// @description LOVOT Studyでオーディオを再生すると同時にスクリプトを実行する
// @author Tetsuya SAITO
// @match https://play.lovot.life/
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// @grant none
@3110
3110 / amazon-lover.js
Last active October 13, 2022 15:17
Amazonが出荷元になっている商品ページを表示する
// ==UserScript==
// @name Amazon Lover
// @namespace https://github.com/3110
// @version 0.5
// @include https://www.amazon.co.jp/*
// @run-at document-start
// @description Remove all parameters in URL and add the parameter m=AN1VRQENFRJN5 to URL
// @author SAITO, Tetsuya <saito.tetsuya@gmail.com>
// @grant none
// ==/UserScript==
@3110
3110 / atom-ble-keyboard-send-string.ino
Last active December 10, 2022 18:54
ATOM Lite/MatrixをBLEキーボードにして,特定の文字列を送付する。
/*
* ATOM Lite/MatrixをBLEキーボードにして,特定の文字列を送付する。
*
* 例えば,決まったWi-FiのSSIDに対するパスワードを送るといった用途に使えます。
*
*/
#include <BleKeyboard.h> // https://github.com/T-vK/ESP32-BLE-Keyboard
#include <M5Atom.h>
@3110
3110 / Core2_RTC_with_NTP.ino
Last active June 3, 2021 15:49
NTPを使ってM5Stack Core2のRTCを設定する
#include <M5Core2.h>
#include <WiFi.h>
const char* SSID = "SSID";
const char* PASSWORD = "SSID Password";
const char* NTP_SERVER = "ntp.jst.mfeed.ad.jp";
const char* TZ = "JST-9";
const uint8_t FONT_NUMBER = 2; // 16px ASCII Font
const uint8_t FONT_SIZE = 16;
@3110
3110 / atom-lite-screen-saver-killer-with-keyboard.ino
Last active July 12, 2020 04:41
ATOM Liteでスクリーンセーバーを起動しないようにする(BLEキーボード版)
/*
* ATOM LiteをBLEキーボードにして,定期的にキーを送ることで
* スクリーンセーバーを起動しないようにする。
*
* KILL_INTERVAL_SEC: 定期的にキーを送る頻度(秒)
* KILL_KEY: 定期的に送るキー
*
* ATOM Liteのボタンを押すことで,SEND_KEYに設定されたキーを
* 送る。
*
@3110
3110 / atom-ble-keyboard.ino
Last active May 3, 2024 15:32
ATOM Lite/MatrixをBLEキーボードにする
/*
* ATOM Lite/MatrixをBLEキーボードにするサンプルプログラム
*
* 送信するキーを変更するにはSEND_KEYの値を変更してください。
*
* コンパイルにはESP32 BLE Keyboard library(https://github.com/T-vK/ESP32-BLE-Keyboard)が必要です。
* 事前にインストールしておいてください。
*/
#include <BleKeyboard.h> // https://github.com/T-vK/ESP32-BLE-Keyboard
@3110
3110 / atom-lite-screen-saver-killer-with-mouse.ino
Last active April 18, 2023 00:36
ATOM Liteでスクリーンセーバーを起動しないようにする(BLEマウス版)
/*
ATOM Lite を BLE マウスにして,定期的にマウスカーソルを
動かすことでスクリーンセーバーを起動しないようにする。
https://github.com/T-vK/ESP32-BLE-Mouse を Arduino IDE に
インストールしておくこと。
1. ATOM Liteにプログラムを書き込む。
2. プログラムを起動する。
3. ATOM Lite BLE Mouseとペアリングする。