Skip to content

Instantly share code, notes, and snippets.

View mallardduck's full-sized avatar
🦑
Rockin the suburbs

Dan P. mallardduck

🦑
Rockin the suburbs
View GitHub Profile
@mallardduck
mallardduck / SomeResource.php
Created April 23, 2021 16:17
SpatieTagsInput for filament
public static function form(Form $form)
{
return $form
->schema([
SpatieTagsInput::make('form_tags')
->relationship('tags', 'name')
]);
}
@mallardduck
mallardduck / static.php
Created November 19, 2021 15:34 — forked from ezimuel/static.php
Swoole HTTP static file server example
<?php
// Simple HTTP static file server using Swoole
$host = $argv[1] ?? '127.0.0.1';
$port = $argv[2] ?? 9501;
$http = new swoole_http_server($host, $port);
// The usage of enable_static_handler seems to produce errors
// $http->set([
@mallardduck
mallardduck / HumanDateTimeDiff.php
Created March 20, 2022 19:48
Laravel Human date time diff example
<?php
namespace App\View\Components;
use Carbon\Carbon;
use Illuminate\View\Component;
class HumanDateTimeDiff extends Component
{
public $dateTime;
@mallardduck
mallardduck / script.sh
Last active January 14, 2025 19:09
How to unpack and modify/customize the initrd (using zstd compression)
export LANG=C
TMP=`mktemp -d`
umask 022
mkdir -p $TMP/earlycpio
mkdir $TMP/initramfs
umask 077
cd $TMP/earlycpio
@mallardduck
mallardduck / missyElliott.php
Last active April 22, 2022 23:46
Apply the "Work It" transformation to an Integer with PHP
<?php
function missyElliott(int $id): int {
if ($id > 4294967295) {
throw new \RuntimeException('Maximum integer size is 4_294_967_295');
}
// Int to Binary - ensure at least 32 char long binary string
$binaryInt = str_pad(decbin($id), 32, '0', STR_PAD_LEFT);
// Split into workIt array
$workIt = str_split($binaryInt, 1);
@mallardduck
mallardduck / db.md
Created June 30, 2022 00:55
suse-hackweek-support-matrix
erDiagram

	rancher_releases {
		INTEGER RancherReleaseId
		NVARCHAR Version
	}

	hosted_runtime_versions {
		INTEGER HostedRuntimeVersionId
@mallardduck
mallardduck / supported-avr-chips.md
Created July 9, 2022 19:27
QMK Supported AVR Chips

Current Supported AVR Chips

Type Chipset Total Pins GPIO Pins Usable GPIO Vcc USB
AVR ATmega16U2 / ATmega32U2 32 22 17 5v Native
AVR ATmega16U4 / ATmega32U4 44 26 22 5v Native
AVR AT90USB64 / AT90USB128 64 48 44 5v Native
AVR AT90USB162 32 22 17 5v Native
AVR ATmega32A 44 32 29 5v vUSB
AVR ATmega328P 32 23 15 5v vUSB
version: "3"
# More info at https://github.com/pi-hole/docker-pi-hole/ and https://docs.pi-hole.net/
services:
pihole:
container_name: piholes
image: pihole/pihole:2022.07
network_mode: host # I do this to keep things simple - but could also do macvlan
environment:
TZ: 'America/Detroit' # Update
@mallardduck
mallardduck / 0-twitter-nuke-script.name
Last active November 16, 2023 23:02
Symfony Panther Tweets Deleter
placeholder to control gist title name
@mallardduck
mallardduck / RFC-77847132696872.md
Last active June 12, 2023 16:11
What if there was an RFC style specification for tracking "player game state" of EDH magic the gathering games? Welp I guess this might be kinda what that would be like...

MTG EDH Game State Tracker Specification

Status of this Memo

This document is created purely for entertainment purposes and is not meant to imply any authoratative stance. The memo has been created by a fan of the EDH game format and is not at all associated with the EDH rules committee.

Abstract

This document serves as a specification for the properties of a single player's "Game State" in the context of an EDH Commander Magic: The Gathering game.

The intention of this specification is to provide a comprehensive overview of the game state elements that should be tracked for each player during gameplay. It is important to note that this document is not authoritative and is independent of the EDH Rules Committee.