Skip to content

Instantly share code, notes, and snippets.


Jamie York ziadoz

View GitHub Profile
ziadoz /
Last active Jul 5, 2020
PHP/Laravel Nginx HTTP2/SSL Configuration
server {
listen 80;
listen [::]:80 ipv6only=on;
return 301$request_uri;
ziadoz / Caddyfile
Created Jul 5, 2020
Laravel Caddy v2 Caddyfile
View Caddyfile {
root * /var/www/vhosts/
php_fastcgi unix//var/run/php/php7.4-fpm.sock
encode zstd gzip
ziadoz /
Created Jun 8, 2020
MySQL 8 Installation - Ubuntu 18.04 / 20.04 LTS
#!/usr/bin/env bash
echo PURGE | sudo debconf-communicate mysql-community-server
sudo apt purge mysql-client mysql-server
sudo debconf-set-selections <<< "mysql-community-server mysql-community-server/root-pass password $password"
sudo debconf-set-selections <<< "mysql-community-server mysql-community-server/re-root-pass password $password"
sudo debconf-set-selections <<< "mysql-community-server mysql-server/default-auth-override select Use Legacy Authentication Method (Retain MySQL 5.x Compatibility)"
ziadoz / closure_mock.php
Created May 22, 2020
PHPUnit Mocking Closures
View closure_mock.php
// Closure can't be mocked because it's a final class.
// Mock another class instead and add __invoke to it.
$mockClosure = $this->getMockBuilder(\stdClass::class)
ziadoz / VBoxHardening.log
Created May 18, 2020
WSL Vagrant Issues
View VBoxHardening.log
3f80.3c98: Log file opened: 6.1.8r137981 g_hStartupLog=0000000000000088 g_uNtVerCombined=0xa047bb00
3f80.3c98: \SystemRoot\System32\ntdll.dll:
3f80.3c98: CreationTime: 2020-05-12T19:15:35.370039500Z
3f80.3c98: LastWriteTime: 2020-05-12T19:15:35.406940600Z
3f80.3c98: ChangeTime: 2020-05-12T20:48:51.077790500Z
3f80.3c98: FileAttributes: 0x20
3f80.3c98: Size: 0x1e8460
3f80.3c98: NT Headers: 0xd8
3f80.3c98: Timestamp: 0xb29ecf52
3f80.3c98: Machine: 0x8664 - amd64
ziadoz /
Last active May 26, 2020
Export iCloud Tabs/URLs to CSV
#!/usr/bin/env bash
alias icloud_tabs='sqlite3 -header -csv ~/Library/Safari/CloudTabs.db "select ctd.device_name, ct.title, ct.url from cloud_tabs as ct inner join cloud_tab_devices as ctd on ctd.device_uuid = ct.device_uuid order by device_name asc, position asc"'
# Output to CSV file:
icloud_tabs > icloud_tabs.csv
# Unique CSV:
sort -u icloud_tabs.csv -o icloud_tabs_unique.csv
# Merge CSVs:
ziadoz / ut3_bonus_packs.txt
Last active Apr 7, 2020
Unreal Tournament 3 - Community Bonus Pack (CBP) 1 - 5 Downloads
View ut3_bonus_packs.txt
Community Bonus Pack
Homepage Download Links:
CBP 1 - 4 Installer, Zip, PS3 :
CBP 1 Installer, Zip, PS3:
CBP 1 Installer:
CBP 2 Installer, Zip, PS3:
ziadoz /
Created Mar 11, 2020
Extract Images From PDF / Build PDF From Images / Remove PDF White Margins (Ubuntu)
#!/usr/bin/env bash
# Extract images from a PDF:
sudo apt-get install poppler-utils
pdfimages -all input.pdf images/image
# Build PDF from images:
sudo apt install img2pdf
img2pdf --output d.pdf images/image*.jpg
ziadoz / extract-favicon-images.php
Created Mar 4, 2020
Extract PNG Images From Favicon ICO Images in PHP Using ImageMagick
View extract-favicon-images.php
// Extract favicon images from file path.
$faviconFile = __DIR__ . '/bbc.ico'
file_put_contents($faviconFile, file_get_contents(''));
$imagick = new Imagick();
$imagick->writeImages(__DIR__ . '/bbc-extracted.png', false);
// Extract favicon images from string.
ziadoz / Kernel.php
Last active Mar 3, 2020
Register Doctrine Mongo ODM Symfony Commands with Laravel (v6.0) Artisan
View Kernel.php
// app/Console/Kernel.php
namespace App\Console;
use Doctrine\ODM\MongoDB\Tools\Console\Command\ClearCache\MetadataCommand;
use Doctrine\ODM\MongoDB\Tools\Console\Command\{GenerateHydratorsCommand, GeneratePersistentCollectionsCommand, GenerateProxiesCommand, QueryCommand};
use Doctrine\ODM\MongoDB\Tools\Console\Command\Schema\{CreateCommand, DropCommand, ShardCommand, UpdateCommand, ValidateCommand};
use Doctrine\ODM\MongoDB\Tools\Console\Helper\DocumentManagerHelper;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;