Skip to content

Instantly share code, notes, and snippets.

View mmeyer2k's full-sized avatar

mmeyer2k

View GitHub Profile
@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;
};
@mmeyer2k
mmeyer2k / phpunit4circle.sh
Last active November 3, 2021 21:33
circle.ci parallelism for phpunit
#!/bin/sh
# circle.ci parallelism appends the subset of files to run in the container
# to the end of the test command. phpunit does not automatically parse files
# appended to the argument like this:
#
# phpunit --some-args 'testSomething1.php' 'testSomething2.php'
#
# this script parses arguments and individually dispatches calls to phpunit
#
@mmeyer2k
mmeyer2k / ocp.php
Last active August 29, 2015 14:07 — forked from ck-on/ocp.php
<?php
/*
OCP - Opcache Control Panel (aka Zend Optimizer+ Control Panel for PHP)
Author: _ck_ (with contributions by GK, stasilok)
Version: 0.1.6
Free for any kind of use or modification, I am not responsible for anything, please share your improvements
* revision history
0.1.6 2013-04-12 moved meta to footer so graphs can be higher and reduce clutter
0.1.5 2013-04-12 added graphs to visualize cache state, please report any browser/style bugs