Skip to content

Instantly share code, notes, and snippets.

View CHTJonas's full-sized avatar
🆗
Weird flex but HTTP 200

Charlie Jonas CHTJonas

🆗
Weird flex but HTTP 200
View GitHub Profile
#!/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
#!/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 December 14, 2019 13:39
Full method delegation in Ruby 3
def foo(*args, **kwargs, &block)
target(*args, **kwargs, &block)
end
@CHTJonas
CHTJonas / UniFi Tunnelbroker.md
Last active April 26, 2022 00:49
Tunnelbroker config for UniFi Security Gateway

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 July 24, 2019 15:31
Rails tests to verify that CVE-2015-9284 is mitigated.
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 June 19, 2019 13:42
Fully RFC822 compliant email regex
(?:(?:\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)
#!/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 February 9, 2018 18:41
oh-my-zsh git plugin aliases
Alias Command
g git
ga git add
gaa git add --all
gapa git add --patch
gua git add --

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: