Skip to content

Instantly share code, notes, and snippets.

View disafronov's full-sized avatar

Dmitrii Safronov disafronov

View GitHub Profile
printf '{"auths":{"https://index.docker.io/v1/":{"auth":"%s"}}}' "$(printf 'login:password' | base64)" | base64 | tr -d '\n'
@disafronov
disafronov / interfaces-watchdog
Created April 28, 2025 08:30
Proxmox DHCP watchdog
#!/usr/bin/env bash
restore_dhcp() {
if [ -n "$(grep 'iface vmbr0 inet static' /etc/network/interfaces)" ]; then
sed -e 's|iface\ vmbr0\ inet\ static|iface\ vmbr0\ inet\ dhcp|g' -i /etc/network/interfaces
fi
}
restore_dhcp
ssh-keygen -i -f /tmp/ssh2.pub >> ~/.ssh/authorized_keys
mkdir -p "$HOME/.local/share/glib-2.0/schemas
find $HOME/.local/share/gnome-shell/extensions/ -name '*.gschema.xml' -exec cp "{}" "$HOME/.local/share/glib-2.0/schemas" \;
glib-compile-schemas $HOME/.local/share/glib-2.0/schemas/
@disafronov
disafronov / timeshift.sh
Last active May 9, 2025 20:50
Rsync your Timeshift backup to another drive
#!/usr/bin/env sh
if [ -z "$1" ]; then
echo "Specify Timeshift temp dir!"
exit 1
fi
rsync -avH \
--numeric-ids \
--progress \
@disafronov
disafronov / hygrostat_fan_bathroom.yaml
Created September 10, 2023 21:35
Home Assistant bathroom combo-hygro-thermo-stat
hygrostat_fan_bathroom:
homeassistant:
customize:
climate.fan_bathroom:
friendly_name: "Санузел - Вытяжка - Термостат"
icon: mdi:thermostat-auto
humidifier.fan_bathroom:
friendly_name: "Санузел - Вытяжка - Гигростат"
icon: mdi:thermostat-auto
switch.fan_bathroom:
@disafronov
disafronov / lenovo_legion_82k6-fn-q.sh
Last active March 30, 2023 13:44 — forked from JoveYu/lenovo-fn-q.sh
Linux Lenovo Legion 82K6 Fn+Q Power Mode Script
#!/bin/bash
ACPI_BALANCE="\_SB_.PC00.LPCB.EC0_.VPC0.DYTC 0x000FB001"
ACPI_POWER="\_SB_.PC00.LPCB.EC0_.VPC0.DYTC 0x0012B001"
ACPI_ECO="\_SB_.PC00.LPCB.EC0_.VPC0.DYTC 0x0013B001"
ACPI_MODE="\_SB_.PC00.LPCB.EC0_.SPMO"
MODE=$(sudo sh -c "echo '$ACPI_MODE' > /proc/acpi/call; tr -d '\0' < /proc/acpi/call")
MODE=${MODE:2}
TARGET=$(((MODE+1)%3))
@disafronov
disafronov / syno-vpn-reconnect.sh
Created August 31, 2022 18:55 — forked from rkok/syno-vpn-reconnect.sh
Restart Synology VPN connection
#!/bin/bash
#######################
# Setup:
# 1. Setup a VPN in the Synology web interface
# 2. Log in via SSH
# 3. Take a look at /usr/syno/etc/synovpnclient/openvpn/ovpnclient.conf
# 3. Find your VPN entry and fill in the variables below.
# ID = the CLIENT ID, shown between square brackets, e.g. "[o123456789]"
# CONFNAME = value of "conf_name"
#
@disafronov
disafronov / .gitignore
Last active July 18, 2022 20:57
Git backup monitor with [/root/.profile] snippet and [/etc/cron.daily/backup-addins] file and default [/.gitignore]
# Exclude all
/*
# but essential directories and files
!/.gitignore
!/README.md
#######################################
#######################################
@disafronov
disafronov / machine-id-remove.sh
Last active February 11, 2021 17:49
Reset machine id before create KVM template in Proxmox
#!/usr/bin/env sh
rm -f /var/lib/dbus/machine-id
rm -f /etc/machine-id
#