Skip to content

Instantly share code, notes, and snippets.


Jamie York ziadoz

View GitHub Profile
ziadoz / Dockerfile
Created Jul 9, 2021
Install glibc on PHP Alpine Docker Image
View Dockerfile
FROM php:8-cli-alpine
# @see: @see:
RUN apk --no-cache add binutils curl \
&& GLIBC_VER=$(curl -s | grep tag_name | cut -d : -f 2,3 | tr -d \",' ') \
&& curl -sL -o /etc/apk/keys/ \
&& curl -sLO${GLIBC_VER}/glibc-${GLIBC_VER}.apk \
&& curl -sLO${GLIBC_VER}/glibc-bin-${GLIBC_VER}.apk \
&& apk add --no-cache \
glibc-${GLIBC_VER}.apk \
ziadoz /
Created Jul 9, 2021
Wait for MySQL to Start
#!/usr/bin/env bash
# Load dot environment file:
export $(cat .env | xargs)
# Wait for MySQL service to start (this could be on the host or in a Docker container):
until mysql -h "$MYSQL_HOST" -P "$MYSQL_PORT" -u "$MYSQL_USER" -p"$MYSQL_PASSWORD" -e '\q'; do
>&2 echo "MySQL container is unavailable - sleeping"
sleep 1
ziadoz / Toggle Armoury Crate.bat
Created Jul 4, 2021
Toggle ASUS Armoury Crate Service
View Toggle Armoury Crate.bat
SET /P state=Start (1) or Stop (0) Armoury Crate?
IF %state% == 1 (ECHO "Starting Armoury Crate..." & NET START ArmouryCrateControlInterface & NET START ArmouryCrateService) ELSE (ECHO "Stopping Armoury Crate..." & NET STOP ArmouryCrateControlInterface & NET STOP ArmouryCrateService)
ECHO "Done."
ziadoz / alpinejs-checkboxes.html
Last active Aug 11, 2021
Alpine JS - Checkboxes With All/None Toggle Links
View alpinejs-checkboxes.html
<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<script src="" defer></script>
We have to use $refs because x-bind:checked updates the HTML not the prop.
ziadoz /
Last active Jun 16, 2021
Bash Script to Generate Random Files (small, medium, large)
# Generate Random Files
# @see:
# Usage: ./ -d /path/to/ouput -s 10 -m 20 - l 5
# Large: <2GB
# Medium: <200MB, <8MB each
# Small: <1MB
ziadoz /
Last active Jun 8, 2021
Laravel Homestead - Increase LLM Volume Size
#!/usr/bin/env bash
# @see:
# @see:
# @see:
# @see:
# @see:
# @see:
# Default LVM volume size is 64GB, this will add 50% of the available disk space (512GB) to it, making it 256GB:
ziadoz /
Last active Jun 4, 2021
Extract VMDK Disk Image on macOS
#!/usr/bin/env bash
# Unzip Vagrant .box file:
tar -xf <box> -C <destination>
# Install 7 Zip:
brew install p7zip
# Extract VMDK:
7z x -y -o<destination> <vmdk>
ziadoz / php80_attributes.php
Last active Jun 18, 2021
Using PHP 8.0 Attributes/Annotations To Decorate Functions
View php80_attributes.php
// Attributes (AKA Annotations).
#[Attribute(Attribute::IS_REPEATABLE | Attribute::TARGET_FUNCTION)]
class CharDecoratorAttribute
public function __construct(protected string $char) // Constructor Property Promotion
public function decorate(Closure $fn): Closure
ziadoz /
Last active Dec 4, 2020
Quick PHP 8.0 Install - Ubuntu 18.04
#!/usr/bin/env bash
LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install -y \
php8.0 php8.0-bcmath php8.0-bz2 php8.0-cgi php8.0-cli php8.0-common php8.0-curl php8.0-dba php8.0-dev \
php8.0-enchant php8.0-fpm php8.0-gd php8.0-gmp php8.0-imap php8.0-interbase php8.0-intl php8.0-ldap \
php8.0-mbstring php8.0-mysql php8.0-odbc php8.0-opcache php8.0-pgsql php8.0-phpdbg php8.0-pspell php8.0-readline \
php8.0-snmp php8.0-soap php8.0-sqlite3 php8.0-sybase php8.0-tidy php8.0-xml php8.0-xsl php8.0-zip
ziadoz /
Last active Oct 14, 2020
Add and Remove Laravel Homestead Root CA to and from the macOS Keychain
sudo security delete-certificate -c "Homestead homestead Root CA" /Library/Keychains/System.keychain 2> /dev/null
sudo security add-trusted-cert -d -r trustRoot -p ssl -k /Library/Keychains/System.keychain ~/Projects/homestead/ca.homestead.homestead.crt 2> /dev/null
function homestead() {
( cd ~/Projects/homestead && vagrant $* )
if [[ "$1" == "destroy" ]]; then
sudo security delete-certificate -c "Homestead homestead Root CA" /Library/Keychains/System.keychain 2> /dev/null