Skip to content

Instantly share code, notes, and snippets.

@NeoCat
NeoCat / esp8266-amg8833.ino
Last active March 1, 2023 16:39
ESP8266 + AMG8833 WebSocket-based Viewer
View esp8266-amg8833.ino
// ESP8266 Pins
// 4(SDA) --- AMG8833 SDA
// 5(SCL) --- AMG8833 SCL
// 13 --- LED (Anode) via 100ohm
#include <pgmspace.h>
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <WebSocketsServer.h>
@NeoCat
NeoCat / LibHook.h
Created December 25, 2011 13:48
Hook hidden symbol call (x86_64)
View LibHook.h
#include <string.h>
#include <dlfcn.h>
#include <err.h>
#include <errno.h>
#include <sys/mman.h>
#define LIB_PATH "libc.so.6"
template <class RET, class... ARGV>
class LibHook {
@NeoCat
NeoCat / ESP32_JJY_Emulator.ino
Created July 23, 2020 22:07
JJY Emulator using M5Stick-C
View ESP32_JJY_Emulator.ino
#include <M5StickC.h>
#include <WiFi.h>
#include <Time.h>
const char ssid[] = "<YOUR SSID>";
const char pass[] = "***********";
#define GPIO_PIN 10 /* JJY擬似信号を出力するピン */
#define LEDC_BASE_FREQ 60000.0 /* JJY擬似信号の周波数 */
@NeoCat
NeoCat / honeywell_set_temp.sh
Last active August 22, 2022 14:17
Set temperature of honeywell Wi-Fi thermostat by shell script
View honeywell_set_temp.sh
#!/bin/bash
# Usage: ./honeywell_settmp.sh [-c|-h|-o] [<temp(F)>|schedule]
# Example: ./honeywell_settmp.sh -h 72 # set HEAT: temp=72F
# ./honeywell_settmp.sh -c schedule # set COOL: follow shceduled temp
# ./honeywell_settmp.sh -o # turn system OFF
######## Settings ########
LOGIN="YOUR_MAIL_ADDRESS"
PASSWORD="YOUR_PASSWORD"
@NeoCat
NeoCat / LoRaGPSGateway.ino
Created April 9, 2022 09:39
LoRa GPS Node & Gateway Sample for Arduino MKR WAN 1310 (freq. = 923MHz used in Japan)
View LoRaGPSGateway.ino
#include <ChaCha.h>
#include <SPI.h> // include libraries
#include <LoRa.h>
const long frequency = 923E6; // LoRa Frequency
byte message[64];
int msg_len = 0;
struct {
@NeoCat
NeoCat / ESP32_http_solenoid_driver.ino
Last active September 15, 2020 17:00
Wireless Analog Terminal Bell using M5Stick-C
View ESP32_http_solenoid_driver.ino
#include <WiFi.h>
#include <WebServer.h>
#define OUTPUT_PIN 26
char ssid[] = "YOUR-WIFI-SSID";
char pass[] = "YOUR-WIFI-PASSWORD";
WebServer server(80);
void setup() {
@NeoCat
NeoCat / SmartMeter.ino
Last active May 26, 2020 18:21
スマートメーターから瞬時電力を取得して7セグに表示するArduino用スケッチ
View SmartMeter.ino
#include <SoftwareSerial.h>
// Detail: http://d.hatena.ne.jp/NeoCat/20160110/1452407542
//-----------------------------------------------------------
// Configurations
//-----------------------------------------------------------
// B-route ID and Password (PANA authentication)
#define ID "0000XXXXXXXXXXXXXXXXXXXXXXXXXXXX"
@NeoCat
NeoCat / ESP32_SendKeystroke.ino
Last active October 4, 2019 00:27
ESP32 Arduino Send Keystroke as BLE Keyboard
View ESP32_SendKeystroke.ino
#include <M5StickC.h>
#include <BleKeyboard.h>
BleKeyboard bleKeyboard;
void setup() {
Serial.begin(115200);
Serial.println("Starting ...");
M5.begin();
@NeoCat
NeoCat / data.txt
Created May 8, 2019 22:59
Solve ПАСЬЯНС puzzle in EXAPUNKS
View data.txt
r10 r8 b8 r6 h c c b7 r7
d b8 s d b6 b9 r9 b10 b10
c b9 r10 r7 c r8 h r6 d
s r9 d h s h b7 b6 s
@NeoCat
NeoCat / 0001-Adds-NAPT-and-port-mapping-functionality-to-esp8266-.patch
Last active March 8, 2019 15:33
Patch to add NAPT and port mapping functionality to esp8266
View 0001-Adds-NAPT-and-port-mapping-functionality-to-esp8266-.patch
From 1dfbeab6f4ca7287e27c31a9f90ddec3343a18d5 Mon Sep 17 00:00:00 2001
From: NeoCat <neocat@neocat.jp>
Date: Thu, 13 Oct 2016 22:19:22 +0900
Subject: [PATCH] Adds NAPT and port mapping functionality to esp8266 lwip
esp8266 can handle 2 network interfaces (Wifi client and softAP)
simultaneously in the WIFI_AP_STA mode.
Currently IP_FORWARD is implemented in lwip to forward packets
between 2 interfaces, but static routing must be setup manually.
This patch adds IP_NAPT config option to enable esp8266 to use