Skip to content

Instantly share code, notes, and snippets.

View disafronov's full-sized avatar

Dmitrii Safronov disafronov

View GitHub Profile
@disafronov
disafronov / dotsecrets
Last active December 20, 2025 11:17
Sync one's ~/.dotsecrets with git & stow
#!/usr/bin/env sh
set -eu
# Base directories for encrypted and decrypted secrets
REPO_DIR="$HOME/.dotsecrets"
DECRYPTED_DIR="$HOME/.dotsecrets.decrypted"
# Age encryption keys
AGE_KEY="$HOME/.age.key"
AGE_PUB="$HOME/.age.pub"
@disafronov
disafronov / dotfiles
Last active December 20, 2025 11:17
Sync one's ~/.dotfiles with git & stow
#!/usr/bin/env sh
set -eu
# Base directory for dotfiles repository
REPO_DIR="$HOME/.dotfiles"
# Determine action (pull or push) and flags
ACTION=""
FORCE=""
for arg in "$@"; do
@disafronov
disafronov / neovide
Last active December 13, 2025 01:22
#!/usr/bin/env bash
NEOVIDE="neovide.real"
SOCKET="${XDG_RUNTIME_DIR:-/tmp}/neovide"
if [ -S "$SOCKET" ]; then
# Если есть аргументы — открываем их в существующем Neovim
if [ "$#" -gt 0 ]; then
nvim --server "$SOCKET" --remote-tab "$@"
name: Mirror source branch
"on":
schedule:
- cron: '0 3 * * *'
workflow_dispatch:
permissions:
contents: write
#!/bin/sh
IP="192.168.2.2" # server IP
MAC="50:EB:F6:50:3E:AE" # MAC address for WOL
INTERFACE="br-lan" # network interface for ping/etherwake
INTERFACE_RESTART="lan1" # interface to restart
MAX_FAILS=4 # 4 * 5 min = 20 min
STATE="/tmp/server-monitor.state" # temp file for fail counter
LOG_TAG="server-monitor" # logger tag
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 \