Skip to content

Instantly share code, notes, and snippets.

@flexoid
flexoid / auto-dns.sh
Last active February 23, 2021 09:47 — forked from himalay/auto-dns.sh
[Pi-hole auto DNS switch] The script automatically switches the DNS servers between Pi-hole and Cloudflare based on Pi-hole DNS Server status. #pihole #openwrt
#!/bin/sh
# The script automatically changed DNS servers advertised by DHCP based on Pi-hole DNS Server status.
# https://gist.github.com/flexoid/fb2cc01b3ff3ac19659269a9c4c9ae2d
TARGET=192.168.20.112 # Pi-hole
FALLBACK=8.8.8.8,8.8.4.4
function set_fallback_dns() {
echo $(date)
@flexoid
flexoid / borg_backup.sh
Created May 5, 2020 19:42
Borg backup script for Raspberry Pi
#!/bin/sh
# This script is inspired by the automated backup script example from borg site.
# https://borgbackup.readthedocs.io/en/stable/quickstart.html#automating-backups
export BORG_REPO=/var/local/borgbackups/full
export BORG_PASSPHRASE='<***>'
export RSYNC_DEST="backblaze:raspberry-hass"
export TEXTFILE_COLLECTOR_DIR=/var/lib/node_exporter/textfile_collector

OpenWrt LED night mode

This simple script allows to disable all router LEDs (except power-on) at once, or enable them by resetting to default settings.

Can be useful for anyone who doesn't like LEDs blinking in the face at night.

Add something like this to crontab:

0 21 * * * /root/openwrt_leds_control.sh disable_all

0 6 * * * /root/openwrt_leds_control.sh reset

@flexoid
flexoid / kinopoisk-promo-disabler.user.js
Created February 3, 2013 16:07
Удаляет обрамляющую рекламу на кинопоиске, и несколько баннеров.
// ==UserScript==
// @name Kinopoisk Promo Disabler
// @version 0.1
// @author flexoid
// @description Makes kinopoisk page cleaner
// @match http://*.kinopoisk.ru/*
// ==/UserScript==
var body = document.getElementsByTagName("body")[0];
body.removeAttribute("style");