Skip to content

Instantly share code, notes, and snippets.

View KenHV's full-sized avatar

KenHV KenHV

View GitHub Profile
@Xunnamius
Xunnamius / cloudflare.conf
Last active October 6, 2024 21:46
Fail2ban action.d for Cloudflare meant to replace the version that ships with fail2ban currently. This updated version of the action uses Cloudflare's 2023 v4 API (free tier WAF + free tier WAF lists) to ban hostile IPs.
# This version works with CF WAF (using zone rulesets) and obsoletes previous
# versions. This works will all CF account types. This action depends on curl
# and jp and will add/remove IPs from the $known_hostile_ips list. Creating the
# WAF rules need only be done once per zone. Creating the list need only be done
# once per account.
#
# Author: Bernard Dickens III (Xunnamius)
#
# Inspired by work from: Mike Rushton
# https://github.com/fail2ban/fail2ban/blob/master/config/action.d/cloudflare.conf
@colemar
colemar / #wg-peer.md
Last active September 8, 2024 17:01
Manage Wireguard peers (IPv4 only)

Manage Wireguard peers (IPv4 only)

List, add or delete Wireguard peers. Also show client configuration for already added peers.

wg-peer [add|show <peer>|del <peer>|list]

where:

  • a[dd] add a new peer
@arter97
arter97 / firewall.sh
Last active September 7, 2024 07:01
ipset firewall for crontab
#!/bin/bash
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
exec > /dev/kmsg 2>&1
TMP=/tmp/ipsum.txt
until wget --spider https://raw.githubusercontent.com/stamparm/ipsum/master/ipsum.txt > /dev/null 2>&1; do
echo "Waiting for GitHub to be accessible"
@painor
painor / FastTelethon.py
Last active September 10, 2024 16:35
This will increase the download/upload speed when using telethon
# copied from https://github.com/tulir/mautrix-telegram/blob/master/mautrix_telegram/util/parallel_file_transfer.py
# Copyright (C) 2021 Tulir Asokan
import asyncio
import hashlib
import inspect
import logging
import math
import os
from collections import defaultdict
from typing import Optional, List, AsyncGenerator, Union, Awaitable, DefaultDict, Tuple, BinaryIO
@njmyers
njmyers / local.conf
Last active December 17, 2022 05:50
Use apple fonts as defaults for fontconfig users
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<!-- pixel alignment rgba -->
<!-- check it here http://www.lagom.nl/lcd-test/subpixel.php -->
<match target="font">
<edit name="rgba" mode="assign">
<const>rgb</const>
</edit>
</match>