Skip to content

Instantly share code, notes, and snippets.

@davcx
davcx / esp32_internal_hall.ino
Created May 8, 2019 20:19 — forked from xxlukas42/esp32_internal_hall.ino
Arduino source code for ESP32 internal temperature sensor and hall sensor
void setup() {
Serial.begin(115200);
}
void loop() {
int measurement = 0;
measurement = hallRead();
@davcx
davcx / install-docker.sh
Created December 12, 2020 22:31 — forked from sethbergman/install-docker.sh
Install Docker CE on Linux Mint 19
#!/usr/bin/env bash
# https://docs.docker.com/install/linux/docker-ce/ubuntu/
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
sudo apt-get update
sudo apt-get install docker-ce
# https://docs.docker.com/compose/install/
@davcx
davcx / lost_witness_ratio.sh
Last active January 28, 2022 21:49 — forked from inigoflores/lost_witness_ratio.sh
Pisces - Get the lost witness ratio due to network problems
#!/bin/bash
echo "Checking the logs..."
total=$(grep -hE 'miner_onion_server:decrypt:{[0-9]+,[0-9]+} sending witness at RSSI' /home/pi/hnt/miner/log/console.log* |wc -l)
lost=$(cat /home/pi/hnt/miner/log/console.log* |grep "max retry" |wc -l)
delivered=$(grep -hE 'successfully sent witness to challenger' /home/pi/hnt/miner/log/console.log* | wc -l)
percentage=$(echo "print(round($lost/$total*100,2))" | python3)
echo "Witnesses";
echo "---------------------------------------";
echo "Total received = $total";
@davcx
davcx / wireguard.conf
Created August 31, 2022 21:05 — forked from nealfennimore/wireguard.conf
Wireguard VPN - Forward all traffic to server
# ------------------------------------------------
# Config files are located in /etc/wireguard/wg0
# ------------------------------------------------
# ---------- Server Config ----------
[Interface]
Address = 10.10.0.1/24 # IPV4 CIDR
Address = fd86:ea04:1111::1/64 # IPV6 CIDR
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE; ip6tables -A FORWARD -i wg0 -j ACCEPT; ip6tables -t nat -A POSTROUTING -o eth0 -j MASQUERADE # Add forwarding when VPN is started
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE; ip6tables -D FORWARD -i wg0 -j ACCEPT; ip6tables -t nat -D POSTROUTING -o eth0 -j MASQUERADE # Remove forwarding when VPN is shutdown