Skip to content

Instantly share code, notes, and snippets.

@setaou
setaou / json.py
Last active January 6, 2021 15:12
Custom JSON encoder/decoder that handles datetime.datetime (de)serialisation
# -*- coding: utf-8 -*-
import json
import datetime
import dateutil.parser
import re
iso_datetime_regex = re.compile(r"^(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z)?)|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)?)|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)?)$")
def new_scanstring(s, end, encoding=None, strict=True):
@bendews
bendews / pihole-dnsmasq-cloudflared.conf
Created April 5, 2018 09:17
Ansible Playbook to set up PiHole with DNS-Over-HTTPS via cloudflared
server=127.0.0.1#5053
@erlepereira
erlepereira / DNSMasq_withMalwareBlocking.md
Last active January 22, 2025 23:49
Using DNSMasq as a caching nameserver & add in a malware etc blocking

Assuming a Properly configured DNSMasq

a quickstart for dnsmasq is given at the end if you have not set it up yet.

something like this will add a great regularly updated malware file for it to use. More security and privacy to you! Specifically, this uses https://github.com/StevenBlack/hosts Choose one of the Raw Hosts file from there to use.

To setup DNSMasq, follow the below ...

wget -O- https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts | awk '$1 == "0.0.0.0" { print "address=/"$2"/0.0.0.0/"}' > /etc/dnsmasq.d/malware.conf`
@nitefood
nitefood / README.md
Last active May 8, 2023 00:45
ASN/IP/Route/hostname command line lookup tool to map any network to the corresponding ASN and prefix

This gist has moved to its own repository HERE

See you there!

@luis-puhl
luis-puhl / fucking-fast-tcp-ssh-transfer.sh
Last active February 22, 2023 20:22
Using Gzip, multicore, SSH-tunnel to transfer files faster
#!/bin/bash
# the same, no tunnel.
ssh remote "tar -c /some/stuff | pv | pigz" | pigz -d | tar x
### Let's start by going to the remote with SSH, also leaving a SSH-Tunnel
# you@local:~ $
ssh remote -L 31000:127.0.0.1:31000
### Then we:
@qoomon
qoomon / TravisGitHub.md
Last active September 16, 2024 18:50
Setup GitHub Deploy Keys For Travis
@solarmicrobe
solarmicrobe / add_zerotier.sh
Last active September 13, 2021 17:29
Add zerotier to FreeNAS
#! /usr/bin/env sh
NETWORKS="8056c2e21c000001" # Space seperated list of networks to join, default here is the public network Earth
VERSION=1.2.4
wget http://pkg.freebsd.org/freebsd:11:x86:64/latest/All/zerotier-${VERSION}.txz -O /tmp/zerotier-${VERSION}.txz
pkg add -f /tmp/zerotier-${VERSION}.txz
for n in $NETWORKS; do
zerotier-cli join ${n}
import UIKit
/// High precedence
precedencegroup HighPrecedence { higherThan: BitwiseShiftPrecedence }
/// Exponentiation operator
infix operator **: HighPrecedence
extension CGFloat {
/// Returns base ^^ exp
@lepiaf
lepiaf / unbound.conf
Last active April 3, 2024 21:36
Unbound configuration IPv4 and IPv6
server:
interface: 0.0.0.0
interface: ::0
access-control: 192.168.42.0/24 allow
access-control: 127.0.0.0 allow
access-control: 2001:db8:dead:beef::/48 allow
# unbound optimisation
num-threads: 4