Skip to content

Instantly share code, notes, and snippets.

Avatar

Jamie York ziadoz

View GitHub Profile
@ziadoz
ziadoz / backup-restore-mysql-docker-volume.sh
Created Jul 29, 2022
Backup and Restore MySQL Docker Volume
View backup-restore-mysql-docker-volume.sh
#!/usr/bin/env bash
# @see: https://docs.docker.com/storage/volumes/#backup-restore-or-migrate-data-volumes
# @see: https://jareklipski.medium.com/backup-restore-docker-named-volumes-350397b8e362
# @see: https://www.spherex.dev/backing-up-docker-volumes/
# The name of the volume to backup/restore:
VOLUME="my-db"
# Backup the Docker Volume to an archive:
docker run --rm --volume $VOLUME:/var/lib/mysql -v $(pwd):/backup alpine:latest sh -c "tar cvf /backup/$VOLUME.tar /var/lib/mysql"
@ziadoz
ziadoz / laravel_json_polymorphic_columns.php
Created Jun 29, 2022
Laravel - JSON Polymorphic Columns
View laravel_json_polymorphic_columns.php
<?php
if (! Schema::hasColumns('table', ['model_type', 'model_ids'])) {
Schema::table('table', function (Blueprint $table) {
$table->string('model_type');
$table->json('model_ids');
$table->rawIndex('((CAST(model_ids->"$[*]" AS UNSIGNED ARRAY))), model_type', 'model_ids_model_type');
});
}
@ziadoz
ziadoz / Laravel-Container.md
Last active Jun 27, 2022 — forked from zhilinskiy/Laravel-Container.md
Laravel's Dependency Injection Container in Depth
View Laravel-Container.md

Laravel's Dependency Injection Container in Depth

Translations: Korean (by Yongwoo Lee)

Laravel has a powerful Inversion of Control (IoC) / Dependency Injection (DI) Container. Unfortunately the official documentation doesn't cover all of the available functionality, so I decided to experiment with it and document it for myself. The following is based on Laravel 5.4.26 - other versions may vary.

Introduction to Dependency Injection

I won't attempt to explain the principles behind DI / IoC here - if you're not familiar with them you might want to read What is Dependency Injection? by Fabien Potencier (creator of the Symfony framework).

@ziadoz
ziadoz / human-list.html
Created Apr 7, 2022
CSS Only Human Readable List
View human-list.html
<style>
ul.human-list {
list-style: none;
}
ul.human-list li {
display: inline-block;
}
ul.human-list li:not(:last-child):after {
@ziadoz
ziadoz / prs.sh
Last active Jun 29, 2022
GitHub - Get All Your PRs As JSON
View prs.sh
#!/usr/bin/env bash
# Install GH CLI client
brew install gh
# Configure organisation and username variables
ORG="orgname"
USER="username"
# Retrieve pull request JSON
@ziadoz
ziadoz / NoLockScreen.reg
Created Jan 30, 2022
Disable Windows 10 Lock Screen
View NoLockScreen.reg
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Personalization]
"NoLockScreen"=dword:00000001
@ziadoz
ziadoz / mp3-2-m4a.sh
Created Jan 25, 2022
FFMPEG: MP3 to M4A
View mp3-2-m4a.sh
#!/usr/bin/env bash
for file in *.mp3; do ffmpeg -i $file -c:a aac -vn ${file%.mp3}.m4a; done
@ziadoz
ziadoz / git-rename-ext.sh
Created Dec 22, 2021
Git Rename File Extensions
View git-rename-ext.sh
#!/usr/bin/env bash
for file in `find templates -name "*.oldext" -type f -print`; do
git mv "$file" ${file%.oldext}.newext;
done
@ziadoz
ziadoz / fix-nvme-missing-win-10.txt
Created Nov 23, 2021
Fix NVME M.2 Drive Not Showing In Windows 10 (B550, AMD, ASUS)
View fix-nvme-missing-win-10.txt
The Issue
=========
I had an issue on my B550 AMD motherboard where my NVME M.2 (GEN3) drive would show up in the BIOS, but was missing in Windows 10 intermittently. For example, when I first boot the computer up, the drive isn't in Windows, but if I restart Windows the drive appears.
I tried the solutions here, but none of them worked:
- https://www.techpowerup.com/forums/threads/nvme-ssd-not-showing-up-in-windows-on-amd-system.264448/
- https://linustechtips.com/topic/1063692-m2-ssd-showing-up-in-bios-but-not-in-windows-10/
- https://forums.tomshardware.com/threads/m-2-ssd-recognized-but-not-showing-up.2604341/
@ziadoz
ziadoz / google-search-spam-domains.txt
Last active Nov 17, 2021
Google Search Spam Domains
View google-search-spam-domains.txt
Stack Overflow:
- https://newbedev.com/
- https://www.titanwolf.org/
- https://easysavecode.com/
- https://www.codegrepper.com/
- https://www.py4u.net/
- https://lefred.be/
- https://bountify.co/
- https://coderedirect.com/
- https://pretagteam.com/