Skip to content

Instantly share code, notes, and snippets.

View denpamusic's full-sized avatar

Denis Paavilainen denpamusic

View GitHub Profile
@denpamusic
denpamusic / diagnostics.py
Last active August 7, 2024 22:19
Collects ecoMAX device data and dumps it to the json file for diagnostics.
"""Collects device data and dumps it to the JSON file."""
import asyncio
import json
import sys
from typing import Any, Final, Optional, Union
from pyplumio import (
SerialConnection,
TcpConnection,
@denpamusic
denpamusic / ecomax.py
Last active April 24, 2022 15:30
ecomax.py file from official ecoNET 300 firmware
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
import threading
import traceback
from operator import attrgetter
import logging
import datetime
import struct
import zlib
@denpamusic
denpamusic / radsens.h
Last active March 26, 2022 22:57
Custom ESPHome component for RadSens Board by ClimateGuard
#include "esphome.h"
#include "RadSensBoard.h"
class RadSens_Sensor : public PollingComponent {
public:
RadSensBoard radSensBoard;
Sensor *radiation_dynamic_sensor = new Sensor();
Sensor *radiation_static_sensor = new Sensor();
Sensor *calibration_value_sensor = new Sensor();
@denpamusic
denpamusic / forward.sh
Last active November 21, 2022 01:48
Script to forward port through vpn tunnel on Ubuntu/Debian.
#!/usr/bin/env bash
WAN_IFACE="eth0"
VPN_IFACE="wg0"
IPTABLES=/usr/sbin/iptables
NP=/usr/sbin/netfilter-persistent
default_drop_forward() {
$IPTABLES -P FORWARD DROP
ffmpeg -rtsp_transport tcp \
-i rtsp://smartiptv:[email protected]:6911/Streaming/Channels/101 \
-i rtsp://smartiptv:[email protected]:6911/Streaming/Channels/201 \
-i rtsp://smartiptv:[email protected]:6911/Streaming/Channels/301 \
-i rtsp://smartiptv:[email protected]:6911/Streaming/Channels/401 \
-filter_complex "
nullsrc=size=1920x1080 [base];
[0:v] setpts=PTS-STARTPTS, scale=960x540 [upperleft];
[1:v] setpts=PTS-STARTPTS, scale=960x540 [upperright];
[2:v] setpts=PTS-STARTPTS, scale=960x540 [lowerleft];
@denpamusic
denpamusic / vg
Last active December 14, 2022 12:07
vpngate.net client for OpenWRT
#!/bin/sh
###
# vpngate.net client for OpenWRT
#
# This script allows to pull server list from vpngate public VPN server registry and filter
# it by country, score, maximum ping and uptime.
#
# Once server that matches requested criteria found, script will setup openvpn
# instance via UCI and perform connection test.
@denpamusic
denpamusic / etc_sysctl.conf
Created October 20, 2019 10:13 — forked from clemensg/etc_sysctl.conf
My FreeBSD /etc/sysctl.conf
# /etc/sysctl.conf
# Clemens Gruber, 2014
#
# Uncomment this to prevent users from seeing information about processes that
# are being run under another UID.
security.bsd.see_other_uids=0
## I/O
@denpamusic
denpamusic / opkg.sh
Created August 18, 2019 23:36
Aliases to commonly used package management tasks for OpenWRT
#!/bin/sh
# /etc/profile.d/opkg.sh
# 'opkg-upgrade' - tries to upgrade every package to the latest version.
alias opkg-upgrade='opkg update; echo; u=$(opkg list-upgradable); [ "x${u}" != "x" ] && (opkg install netifd; echo "${u}" | cut -f1 -d" " | xargs opkg upgrade) || echo Nothing to upgrade.'
# 'opkg-save' - saves list of installed packages to /etc/installed-packages.list,
# which can then be use to reinstall packages with 'opkg-restore'.
# Useful after sysupgrade.
@denpamusic
denpamusic / rc.local
Created April 12, 2019 09:08
Balance interrupts across cpu cores on TP-Link Archer C2600 or similar
# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.
set_smp_affinity() {
local NR=0
local CPU=1
local ETHIRQS=`cat /proc/interrupts | grep "eth[0-9]" | cut -d: -f1`
local PCIIRQS=`cat /proc/interrupts | grep "qcom-pcie-msi" | cut -d: -f1`
local USBIRQS=`cat /proc/interrupts | grep "usb" | cut -d: -f1`
local IRQS="$ETHIRQS $PCIIRQS $USBIRQS"

Keybase proof

I hereby claim:

  • I am denpamusic on github.
  • I am denpa (https://keybase.io/denpa) on keybase.
  • I have a public key whose fingerprint is B371 A23C C449 703F F1BF 0927 9CF6 463C BF75 37E8

To claim this, I am signing this object: