Skip to content

Instantly share code, notes, and snippets.

@M0r13n
M0r13n / doh
Last active May 7, 2024 19:03
Setup Cloudflare as a DoH (DNS over HTTPS) resolver on Mikrotik devices (RouterOS v7.0.2+)
# Temporarily add a normal upstream DNS resolver
/ip dns set servers=1.1.1.1,1.0.0.1
# CA certificates extracted from Mozilla
/tool fetch url=https://curl.se/ca/cacert.pem
# Import the downloaded ca-store (127 certificates)
/certificate import file-name=cacert.pem passphrase=""
# Set the DoH resolver to cloudflare

This script add Categories to Automatically add torrents from per Monitored Folder

👉 This script is in flux, as it may be implemented into qBittorrent in the future.

savecategory expects the user's watch directories to look similar to something like this:

It's based off Docker guide for setting up hard links between virtual volumes (Docker) and machine volumes.

@morph027
morph027 / Caddyfile
Created May 17, 2020 19:16
caddy2 ip filter
intranet.example.com {
@ipfilter {
not remote_ip 192.168.0.0/16
}
route @ipfilter {
# redirect
redir https://example.com/
# or respond
# respond "Access denied" 403 {
# close
let securityHeaders = {
"Content-Security-Policy" : "upgrade-insecure-requests",
"Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload",
"X-Xss-Protection" : "1; mode=block",
"X-Frame-Options" : "DENY",
"X-Content-Type-Options" : "nosniff",
"Referrer-Policy" : "strict-origin-when-cross-origin",
"Feature-Policy" : "accelerometer 'none' ; ambient-light-sensor 'none' ; autoplay 'self' ; camera 'none' ; encrypted-media 'none' ; fullscreen 'self' ; geolocation 'none' ; gyroscope 'none' ; magnetometer 'none' ; microphone 'none' ; midi 'none' ; payment 'self' ; picture-in-picture * ; speaker 'self' ; sync-xhr 'none' ; usb 'none' ; notifications 'self' ; vibrate 'self' ; push 'self' ; vr 'none'",
"Cache-Control" : "public, max-age=0, must-revalidate",
"Content-Type" : "text/html; charset=UTF-8",
@dachinat
dachinat / ufw_allow_countries.sh
Last active March 15, 2024 13:56
Allow certain countries only using UFW (Tested on CentOS 7, Ubuntu 16.04, Ubuntu 18.04)
#!/bin/bash
#title :ufw_allow_countries.sh
#author :JSC Novabyte (novabyte.co)
#date :20/10/2018
#version :0.0.1
#notes :Use root privileges
#usage :$sh ufw_allow_countries.sh
#license :https://opensource.org/licenses/MIT
@colinux
colinux / subtitles-renamer.sh
Created January 27, 2011 23:21
Rename subtitles files according to tv shows names found in a directory
#!/bin/bash
# Renames subtitles files according to tv shows names found in a directory
# Acceped syntaxes for season/episode are: 304, s3e04, s03e04, 3x04 (case insensitive)
#
# Usage:
# Put this gist somewhere in your $PATH, like /usr/local/bin/subtitles-renamer
# Chmod +x it
# cd ~/YourHolidaysTvShowsWithSubtitles
# subtitles-renamer