Skip to content

Instantly share code, notes, and snippets.

View obatiuk's full-sized avatar
🇺🇦
#StandWithUkraine

Oleksii Batiuk obatiuk

🇺🇦
#StandWithUkraine
View GitHub Profile
@SonOfLilit
SonOfLilit / fix_epub_black_bar.sh
Created April 29, 2025 08:31
Fix epub Remarkable black bar issue
#!/bin/bash
set -e # Exit immediately if a command exits with a non-zero status.
# --- Configuration ---
# CSS rule to comment out (adjust if needed, mindful of regex special chars)
TARGET_RULE_TEXT="background-color: inherit;"
# Regex pattern for sed (basic version: handles spaces around colon)
# Using \| as delimiter to avoid escaping slashes in rule
SED_PATTERN='background-color[[:space:]]*:[[:space:]]*inherit;'
@halomakes
halomakes / switchbot-plug-mini-esphome.yml
Last active April 12, 2025 00:18
SwitchBot Plug Mini ESPHome
substitutions:
device_name: switchbot-plug-1
device_description: Energy Monitoring Smart Plug (W1901400)
friendly_name: SwitchBot Plug Mini
esphome:
name: ${device_name}
comment: ${device_description}
platformio_options:
board_build.flash_mode: dio
@socram8888
socram8888 / wg-refresh.sh
Last active May 25, 2025 18:03
Refresh script for CloudFlare Warp on OpenWRT devices
#!/bin/ash
set -euo pipefail
cd $(dirname "$0")
CF_API=https://api.cloudflareclient.com/v0i1909051800
WG_IFACE=cfwarp
regen=true
if [ -e keys.cfg ]; then
@johnnypea
johnnypea / useful-one-liners.sh
Last active November 25, 2025 00:07
Useful one liners
# Run the last command as root
sudo !!
# Serve current directory tree at http://$HOSTNAME:8000/
python -m SimpleHTTPServer
# Save a file you edited in vim without the needed permissions
:w !sudo tee %
# change to the previous working directory
cd -
# Runs previous command but replacing
^foo^bar
@lalten
lalten / README.md
Last active June 18, 2025 14:48 — forked from thomasleveil/README.md
Workaround for oled backlight issues

Works for Thinkpad X1 Yoga 2G (20JDCTO1WW) (and most probably others) with OLED display

First install inotify-tools. Then create a script around inotify that will be launched upon each boot or through autostart.

sudo apt install inotify-tools
cat <<-EO1 | sudo tee /usr/local/bin/xbacklightmon.sh#!/bin/bash
    # https://wiki.archlinux.org/index.php/backlight#sysfs_modified_but_no_brightness_change
    # https://wiki.archlinux.org/index.php/Alienware_13#OLED_screen_brightness
    # https://gist.github.com/lalten/ce5ac0b1cc4b24a24cc44926255b871d

apt install inotify-tools

# ubuntu.daniguardiola.me - start
# fix for yarn global path
export PATH="$(yarn global bin):$PATH"
# fix ~/.local/bin path
export PATH="$HOME/.local/bin:$PATH"
# put android sdk tools on path
@ageis
ageis / YubiKey-GPG-SSH-guide.md
Last active November 30, 2025 16:23
Technical guide for using YubiKey series 4 for GPG and SSH

YubiKey 4 series GPG and SSH setup guide

Written for fairly adept technical users, preferably of Debian GNU/Linux, not for absolute beginners.

You'll probably be working with a single smartcard, so you'll want only one primary key (1. Sign & Certify) and two associated subkeys (2. Encrypt, 3. Authenticate). I've published a Bash function which automates this slightly special key generation process.

@hannesbe
hannesbe / syno-vpn-keepalive.sh
Last active December 11, 2024 23:23
Script to keep VPN alive on Synology DSM. Checks if IP is pingable and if not: disconnect VPN, reconnect VPN & add routes
# syno-vpn-keepalive.sh
# ---
# Script to keep VPN alive on Synology DSM.
# Checks if IP is pingable and if not:
# disconnect VPN, reconnect VPN & add routes
# ---
# Modify vars:
# - CHECKIP: IP to check to be pingable before reconnecting VPN
# - NAME (Synology VPN name),
# - ID (Synology VPN ID), SSH to NAS & run this to find ID
@jwalanta
jwalanta / OpenWrt detect new device and send text message.md
Last active June 25, 2025 01:12
Detect new network devices connecting to OpenWrt and send text message
#!/usr/bin/env bash
# mac-set-hostname.sh - This script will set the local machines name and
# domain information. Two parameters are required: <machine name> <domain name>
# Bash "strict" mode
set -euo pipefail
IFS=$'\n\t'
if [[ $# -lt 2 ]]; then
echo "You must pass 2 parameters, the host name and the domain name."