Skip to content

Instantly share code, notes, and snippets.

Avatar

Jamie York ziadoz

View GitHub Profile
@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/
@ziadoz
ziadoz / LogConsole.php
Created Nov 5, 2021
Automatically Log Laravel Artisan Console Output
View LogConsole.php
<?php
// @see: https://stackoverflow.com/questions/48167834/how-to-remove-all-formatting-from-the-output-of-a-console-command-written-in-php
use Illuminate\Console\Events\CommandFinished;
use Illuminate\Support\Facades\{Event, Log};
use Symfony\Component\Console\Helper\Helper;
Event::listen(function (CommandFinished $event) {
Log::info(
Helper::removeDecoration(
@ziadoz
ziadoz / MemberOfMacro.php
Created Nov 5, 2021
MySQL 8.0 JSON MEMBER OF Laravel Eloquent Macro
View MemberOfMacro.php
<?php
use Illuminate\Database\Query\Builder;
$memberOf = function ($value, string $column, string $path = '$', $boolean = 'and') {
return $this->whereRaw(
sprintf(
'? MEMBER OF(JSON_EXTRACT(%s, "%s"))',
$this->getGrammar()->wrap($column),
$path
),
@ziadoz
ziadoz / fixchars.sh
Last active Oct 29, 2021
Remove Special Characters From macOS Filenames
View fixchars.sh
#!/usr/bin/env bash
# @see: https://superuser.com/questions/617517/remove-all-illegal-characters-from-all-filenames-in-a-given-folder
# The 's/[\:?\\]//g' regular expression removes ?, : and \ characters.
# Dry Run:
find "/path/to/files" -type f -exec rename -n 's/[\:?\\]//g' {} \;
# Execute:
find "/path/to/files" -type f -exec rename 's/[\:?\\]//g' {} \;
@ziadoz
ziadoz / docker-images-save-and-load.sh
Last active Nov 4, 2021
Bash/ZSH Aliases to Save and Load Docker Images
View docker-images-save-and-load.sh
#!/usr/bin/env bash
function save-docker-images() {
DEST="${1:-.}"
mkdir -p "$DEST"
echo "Saving Docker Images:"
for IMAGE in $(docker images --format "{{.Repository}}"); do
docker save "$IMAGE" > "$DEST/$(echo "$IMAGE" | sed -E 's~:|/~_~g').tar"
@ziadoz
ziadoz / docker-compose.yml
Created Oct 9, 2021
Run TwitterDelete using Docker Compose
View docker-compose.yml
version: "3.9"
services:
ruby:
image: ruby:3.0
working_dir: /usr/src/myapp
command: bash -c 'bundle install && ruby twitter_delete.rb --archive=twitter/data/tweet.js --user=<username> --days=7 --olds=99999 --rts=100 --favs=100 --force'
environment:
TWITTER_CONSUMER_KEY: xxx
TWITTER_CONSUMER_SECRET: xxx
TWITTER_ACCESS_TOKEN: xxx
@ziadoz
ziadoz / Dockerfile
Created Sep 30, 2021
Docker - PHP, Composer, Google Chrome and ChromeDriver
View Dockerfile
FROM php:8.0-fpm
# Copy Composer:
COPY --from=composer /usr/bin/composer /usr/bin/composer
# Install PHP extensions:
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
RUN chmod +x /usr/local/bin/install-php-extensions && \
install-php-extensions zip
@ziadoz
ziadoz / Dockerfile
Created Jul 9, 2021
Install glibc on PHP Alpine Docker Image
View Dockerfile
FROM php:8-cli-alpine
# @see: @see: https://stackoverflow.com/a/65969295
RUN apk --no-cache add binutils curl \
&& GLIBC_VER=$(curl -s https://api.github.com/repos/sgerrand/alpine-pkg-glibc/releases/latest | grep tag_name | cut -d : -f 2,3 | tr -d \",' ') \
&& curl -sL https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub -o /etc/apk/keys/sgerrand.rsa.pub \
&& curl -sLO https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VER}/glibc-${GLIBC_VER}.apk \
&& curl -sLO https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VER}/glibc-bin-${GLIBC_VER}.apk \
&& apk add --no-cache \
glibc-${GLIBC_VER}.apk \
@ziadoz
ziadoz / mysql-wait.sh
Created Jul 9, 2021
Wait for MySQL to Start
View mysql-wait.sh
#!/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
done