Skip to content

Instantly share code, notes, and snippets.

View nazt's full-sized avatar

Nat nazt

  • Chiang Mai Maker Club
  • Chiang Mai
  • X @nazt
View GitHub Profile
@nazt
nazt / rtcsetup.ino
Last active April 1, 2020 03:40
rtcsetup.ino
void RtcSetup ()
{
Serial.print("compiled: ");
Serial.print(__DATE__);
Serial.println(__TIME__);
Rtc.Begin(21, 23);
RtcDateTime compiled = RtcDateTime(__DATE__, __TIME__);
printDateTime(compiled);
Serial.println();
@nazt
nazt / sdcard-test.ino
Created March 31, 2020 15:33
sdcard-test.ino
#include <mySD.h>
#define LED_BUILTIN 22 //Blink pin
File root;
void setup()
{
Serial.begin(115200);
pinMode(LED_BUILTIN, OUTPUT);
Serial.print("Initializing SD card...");
@nazt
nazt / i2c-scanner.ino
Created March 31, 2020 14:44
i2c-scanner.ino
#include <Wire.h>
void setup()
{
Serial.begin (115200);
//Wire.begin(19, 26);
}
void Scanner ()
{
@nazt
nazt / BLE-esp32-READ|NOTIFY.ino
Created March 23, 2020 07:25
BLE-esp32-READ|NOTIFY.ino
/*
Video: https://www.youtube.com/watch?v=oCMOYS71NIU
Based on Neil Kolban example for IDF: https://github.com/nkolban/esp32-snippets/blob/master/cpp_utils/tests/BLE%20Tests/SampleNotify.cpp
Ported to Arduino ESP32 by Evandro Copercini
Create a BLE server that, once we receive a connection, will send periodic notifications.
The service advertises itself as: 6E400001-B5A3-F393-E0A9-E50E24DCCA9E
Has a characteristic of: 6E400002-B5A3-F393-E0A9-E50E24DCCA9E - used for receiving data with "WRITE"
Has a characteristic of: 6E400003-B5A3-F393-E0A9-E50E24DCCA9E - used to send data with "NOTIFY"
@nazt
nazt / kbideo.out.ino
Created March 3, 2020 12:53
kbideo.out.ino
#include <Arduino.h>
#include <BLEServer.h>
#include <BLEDevice.h>
#include <BLEUtils.h>
#include <BLE2902.h>
// Device Name: Maximum 30 bytes
#define DEVICE_NAME "LINE Things Trial ESP32"
@nazt
nazt / nat.public.key
Created February 28, 2020 07:37
nat.public.key
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDEEWoUO8Nwv3mBS0KM5ZPipJiyU5Oc5SEIA1Yh/FzWnHgt7Y7yeujRGeVqsE1yylBZ0ChQPPx7rT61Ga1v1tpKrhR0DEg3vWGo5YuaNw1lUzRdFvdWodOGvtBeO9J9+AJ10b2LZD/uLc/QG5jHjc6kxPf1CF2Sc57CfDCNjbDF0RevYglaER11OmJe7qt/PEPZK3u+AtBm4+7k4PjI5tmS0tTdPKTx2unthd6SNBWwraoqkuEdgps4vdtW7tz+AguO+ibKq+Qeod96jE81m3hTeE0qShJz4Iu7k9com+1vnTExtnubS7AR0+nJmMxnePtSzVfXugesrN6NWjpBqKit [email protected]
@nazt
nazt / hello_multiprocessing.py
Created February 10, 2020 09:51 — forked from baojie/hello_multiprocessing.py
Python multiprocessing hello world. Split a list and process sublists in different jobs
import multiprocessing
# split a list into evenly sized chunks
def chunks(l, n):
return [l[i:i+n] for i in range(0, len(l), n)]
def do_job(job_id, data_slice):
for item in data_slice:
print "job", job_id, item
@nazt
nazt / influxdb.conf
Last active January 17, 2020 13:30
influxdb.conf
reporting-disabled = false
bind-address = "127.0.0.1:8088"
[meta]
dir = "/var/lib/influxdb/meta"
retention-autocreate = true
logging-enabled = true
[data]
dir = "/var/lib/influxdb/data"
@nazt
nazt / curl.sh
Last active January 7, 2020 16:01
curl.sh
curl --header "Content-Type: application/json" \
--request POST -v \
--data-binary '{"sta_ssid":"xyz","sta_password":"xyz"}' \
http://192.168.4.1/api/wifi/sta
curl -X POST -d "sta_ssid=weerawan&sta_password=87654321" http://192.168.4.1/api/wifi/sta
curl -X POST -d "sta_ssid=ampere&sta_password=espertap" http://192.168.4.1/api/wifi/sta
@nazt
nazt / js.pynb
Last active December 1, 2019 10:46
js.pynb
import ipywidgets as widgets
from IPython.display import Javascript
h = widgets.HTML(value='<div id="myref"></div>')
xd = [
{
'name': 'ID-002',
'data': d2_x,