Skip to content

Instantly share code, notes, and snippets.

Avatar
🆗
Weird flex but HTTP 200

Charlie Jonas CHTJonas

🆗
Weird flex but HTTP 200
View GitHub Profile
View unbound-reload.sh
#!/bin/bash
set -euo pipefail
rm -f /dev/shm/unbound.cache
trap "rm -f /dev/shm/unbound.cache" EXIT INT TERM HUP QUIT ILL TRAP BUS SEGV
/usr/sbin/unbound-checkconf
umask 0077
touch /dev/shm/unbound.cache
View membership-bootstrap.sh
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "This script should be run as root"
exit 1
fi
# Install build dependencies
apt install -y build-essential libssl-dev libreadline-dev zlib1g-dev libmariadb-dev
@CHTJonas
CHTJonas / delegation.rb
Created Dec 14, 2019
Full method delegation in Ruby 3
View delegation.rb
def foo(*args, **kwargs, &block)
target(*args, **kwargs, &block)
end
@CHTJonas
CHTJonas / UniFi Tunnelbroker.md
Last active Apr 26, 2022
Tunnelbroker config for UniFi Security Gateway
View UniFi Tunnelbroker.md

UniFi Tunnelbroker Configuration

This GitHub Gist details the manual configuration needed on a UniFi controller to enable IPv6 tunneling with Hurricane Electric's Tunnelbroker service.

Setup

This is what works for me personally. Stuff you'll need to do to adapt this to your ends:

  • Replace "local-ip" with your USG's public IPv4 address.
  • Replace "remote-ip" with the address of your Tunnelbroker tunnel server.
  • Replace "address" with the IPv6 address that your are allocated.
@CHTJonas
CHTJonas / omniauth_csrf_test.rb
Created Jul 24, 2019
Rails tests to verify that CVE-2015-9284 is mitigated.
View omniauth_csrf_test.rb
require 'test_helper'
# Make sure that https://nvd.nist.gov/vuln/detail/CVE-2015-9284 is mitigated
class OmniauthCsrfTest < ActionDispatch::IntegrationTest
setup do
ActionController::Base.allow_forgery_protection = true
OmniAuth.config.test_mode = false
end
test "should not accept GET requests to OmniAuth endpoint" do
@CHTJonas
CHTJonas / regex.txt
Created Jun 19, 2019
Fully RFC822 compliant email regex
View regex.txt
(?:(?:\r\n)?[ \t])*(?:(?:(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t]
)+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:
\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(
?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[
\t]))*"(?:(?:\r\n)?[ \t])*))*@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\0
31]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\
](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+
(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:
(?:\r\n)?[ \t])*))*|(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z
|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)
View roombooking-bootstrap.sh
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "This script should be run as root"
exit 1
fi
# Install system utilities to make our lives easier
apt install -y mosh byobu wget curl htop nano vim
apt install -y software-properties-common apt-transport-https
@CHTJonas
CHTJonas / zsh-git-aliases.md
Created Feb 9, 2018
oh-my-zsh git plugin aliases
View zsh-git-aliases.md
Alias Command
g git
ga git add
gaa git add --all
gapa git add --patch
gua git add --
View keybase.md

Keybase proof

I hereby claim:

  • I am chtjonas on github.
  • I am chtjonas (https://keybase.io/chtjonas) on keybase.
  • I have a public key ASCVsroYPKaUXGQqyGc3q_33ENOCwjsqOvvg-s1DSF39uAo

To claim this, I am signing this object: