Skip to content

Instantly share code, notes, and snippets.

View hellvesper's full-sized avatar

Vitaly hellvesper

View GitHub Profile
@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"
@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
#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;
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 <ESP8266WiFi.h>
void printMacAddress();
void listNetworks();
void printEncryptionType(int thisType);
void setup() {
//Initialize serial and wait for port to open:
Serial.begin(115200);
#include <Arduino.h>
#include <Wire.h>
void setup()
{
Wire.begin(4, 5);
Serial.begin(115200);
while (!Serial)
; // Leonardo: wait for serial monitor
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <WiFiUdp.h>
#include <NTPClient.h>
#include "power.h"
// #include <SPI.h>
#include "LedControl.h"
#define RMS_CALIBRATION 1.21; // Sin Wave Form Factor pi/2√2 ≈ 1.11
@hellvesper
hellvesper / multiple_ssh_setting.md
Created July 10, 2018 10:05 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
Agnes en_US # Isn't it nice to have a computer that will talk to you?
Albert en_US # I have a frog in my throat. No, I mean a real frog!
Alex en_US # Most people recognize me by my voice.
Alice it_IT # Salve, mi chiamo Alice e sono una voce italiana.
Allison en_US # Hello, my name is Allison. I am an American-English voice.
Alva sv_SE # Hej, jag heter Alva. Jag är en svensk röst.
Amelie fr_CA # Bonjour, je m’appelle Amelie. Je suis une voix canadienne.
Anna de_DE # Hallo, ich heiße Anna und ich bin eine deutsche Stimme.
Ava en_US # Hello, my name is Ava. I am an American-English voice.
Bad News en_US # The light you see at the end of the tunnel is the headlamp of a fast approaching train.
<?php
/**
* Created by PhpStorm.
* User: vesper
* Date: 15/08/2017
* Time: 14:21
*/
function progression($x = 4, $n = 0, $count = 3) {
$x = $x + (2 * (3 ** $n));