Skip to content

Instantly share code, notes, and snippets.

View mmeyer2k's full-sized avatar

mmeyer2k

View GitHub Profile
@mmeyer2k
mmeyer2k / boom.php
Created March 16, 2025 08:00
Laravel queue fork bomb
$fn = function ($fn) {
dispatch(fn() => $fn($fn));
dispatch(fn() => $fn($fn));
};
dispatch(fn() => $fn($fn));
@mmeyer2k
mmeyer2k / zfs.md
Last active November 19, 2024 01:30
ZFS cheatsheet

zfs cheatsheet

vdevs

Create zpool with initial vdev

zpool create poolX mirror /dev/sdY /dev/sdZ

Add vdev to zpool

zpool add poolX mirror /dev/sdY /dev/sdZ
@mmeyer2k
mmeyer2k / 0-docker-pihole-doh.md
Last active August 26, 2023 07:15
Docker + pihole + cloudflared secure private DNS over DoH

Create a docker based PiHole server that writes only to memory.

Features

  • fully supports ipv6
  • portable and private dns server
  • no sensitive data written to disk
  • uses cloudflare doh as upstream dns source

Steps

  1. tweak and save the docker-compose.yml file
@mmeyer2k
mmeyer2k / Vagrantfile
Last active June 23, 2022 09:34
Add zsh to on vagrant provision
config.vm.provision "shell" do |s|
s.name = "Install oh-my-zsh"
s.privileged = false
s.inline = <<-SHELL
sudo apt install -y zsh
wget -O ~/.zshrc https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/templates/zshrc.zsh-template
sudo chsh -s /bin/zsh vagrant
SHELL
end
@mmeyer2k
mmeyer2k / secure_array_shuffle.php
Created April 19, 2022 18:15
Secure array_shuffle
<?php
function array_shuffle_secure(array $input): array {
$output = [];
while ($arr) {
$arr = array_values($arr);
$char = random_int(0, count($arr) - 1);
$output[] = $arr[$char];
unset($arr[$char]);
@mmeyer2k
mmeyer2k / wireguard.md
Last active October 6, 2020 22:07
Wireguard server setup steps
apt install wireguard
echo 'net.ipv4.ip_forward=1' > /etc/sysctl.d/99-wireguard.conf
wg genkey | sudo tee /etc/wireguard/privatekey | wg pubkey | sudo tee /etc/wireguard/publickey
sysctl --system
wg-quick up wg0
systemctl enable wg-quick@wg0
@mmeyer2k
mmeyer2k / gist:3ebdb11e0bc66b28b073de2b15714ea6
Last active May 13, 2019 09:55
Archive a webpage to zip
#!/usr/bin/env php
<?php
# read blog posting about this snippet
# https://...
if (!isset($argv[1])) {
exit(1);
}
@mmeyer2k
mmeyer2k / essentials.sh
Last active April 15, 2019 07:54
Essential diagnostic programs for any ubuntu machine
apt install -y nload htop iotop tcptrack dstat multitail nmap hping3
@mmeyer2k
mmeyer2k / hashwords.php
Created March 22, 2018 20:56
hashwords
<?php
static $words = [
'also',
'area',
'away',
'back',
'bank',
'base',
'bash',
@mmeyer2k
mmeyer2k / rot128.php
Created February 22, 2018 08:58
A ROT128 binary encoder
<?php
$rot128 = function (string $input) {
foreach (str_split($input) as $i => $a) {
$input[$i] = chr((ord($a) + 128) % 256);
}
return $input;
};