Skip to content

Instantly share code, notes, and snippets.

View hellvesper's full-sized avatar

Vitaly hellvesper

View GitHub Profile
#include <Arduino.h>
#include <ESP8266WiFi.h>
void printMacAddress();
void listNetworks();
void printEncryptionType(int thisType);
void setup() {
//Initialize serial and wait for port to open:
Serial.begin(115200);
void analogWrite(uint32_t ulPin, uint32_t ulValue)
{
#if defined(HAL_DAC_MODULE_ENABLED) && !defined(HAL_DAC_MODULE_ONLY)
uint8_t do_init = 0;
#endif
PinName p = digitalPinToPinName(ulPin);
if (p != NC) {
#if defined(HAL_DAC_MODULE_ENABLED) && !defined(HAL_DAC_MODULE_ONLY)
if (pin_in_pinmap(p, PinMap_DAC)) {
if (is_pin_configured(p, g_anOutputPinConfigured) == false) {
#include <Arduino.h>
#include <Wire.h> // I2C library
#include "ccs811.h" // CCS811 library
#if defined(ESP32)
#include <WiFiMulti.h>
WiFiMulti wifiMulti;
#define DEVICE "ESP32"
#elif defined(ESP8266)
#include <ESP8266WiFiMulti.h>
ESP8266WiFiMulti wifiMulti;
@hellvesper
hellvesper / keyboard_test.swift
Created February 20, 2022 10:43
keyboard kernel events
import Foundation
import Cocoa
//@NSApplicationMain
class ApplicationDelegate: NSObject, NSApplicationDelegate {
// @IBOutlet var window: NSWindow!
// @IBOutlet private var text: NSTextField!
private var timer: Timer?
private var eventStrings: [String] = []
private var counter: UInt64 = 0
@hellvesper
hellvesper / hetzner.sh
Last active May 3, 2023 09:18
Replication TrueNAS's apple time machnine snapshots with hetzner's cloud storage box [draft]
#!/bin/sh
LAST_LOCAL_SNAPSHOT=`zfs list -t snapshot | sort -r | egrep '^.+aapltm-[0-9]+' -o -m 1`
LAST_REMOTE_SNAPSHOT=`rclone ls storagebox:/home/ | sort -k 2 -r | grep aapltm -m 1 | xargs | cut -d ' ' -f 2 | cut -d '.' -f 1`
DATASET_PREFIX=`zfs list -t snapshot | grep aapltm -m 1 | cut -d ' ' -f 1 | cut -d '@' -f 1`
LOCAL_SNAPSHOT_POSTFIX=`echo $LAST_LOCAL_SNAPSHOT | cut -d '@' -f 2`
RCLONE_REMOTE="storagebox"
RCLONE_REMOTE_SNAPSHOT_PATH="/home/"
echo "LAST_LOCAL_SNAPSHOT:$LAST_LOCAL_SNAPSHOT"
echo "LAST_REMOTE_SNAPSHOT:$LAST_REMOTE_SNAPSHOT"