Skip to content

Instantly share code, notes, and snippets.

View nicoverbruggen's full-sized avatar

Nico Verbruggen nicoverbruggen

View GitHub Profile
@nicoverbruggen
nicoverbruggen / mirror.md
Last active April 1, 2024 08:35
Use different Ubuntu mirror on WSL

First, take a look at: https://launchpad.net/ubuntu/+archivemirrors

Then, pick a mirror closeby. For example, for me it's: ftp.belnet.be

As such, you can now run:

sudo sed -i "s/archive.ubuntu.com/<your-mirror-here>/" /etc/apt/sources.list && sudo apt update
@nicoverbruggen
nicoverbruggen / example.php
Created August 30, 2023 09:46
Thinking about an abstraction for accessing PHP attributes
<?php
use NicoVerbruggen\Attributes\ExampleAttribute;
use NicoVerbruggen\Objects\SampleObject;
$object = new SampleObject();
// Global helper style
get_attribute(ExampleAttribute::class, $object);
@nicoverbruggen
nicoverbruggen / RetrieveGitHubData.php
Created May 31, 2022 21:15
How to retrieve GitHub stargazer and downloads data via a Command
<?php declare(strict_types=1);
namespace App\Console\Commands;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;
use Illuminate\Console\Command;
@nicoverbruggen
nicoverbruggen / upgrade.sh
Created April 4, 2022 07:55
Homebrew upgrade PHP
!/bin/sh
# If you are getting issues w/ broken dependents: try `brew reinstall apr-util`
# Alternatively, check linkage here: `brew linkage php`
# Disable Valet
valet stop
# Upgrade PHP
# brew update && brew upgrade php php@8.0 php@7.4
@nicoverbruggen
nicoverbruggen / commands.sql
Last active March 27, 2022 22:34
WSL 2.x and MySQL Server
# Allow access to SQL
UPDATE mysql.user SET plugin='mysql_native_password' WHERE User='root'
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root'
# You should now have access via: `mysql -u root -p` using the password `root`
# Allow access via any host
CREATE USER 'root'@'%' IDENTIFIED BY 'root';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%';
@nicoverbruggen
nicoverbruggen / composer-swap.sh
Last active November 22, 2021 16:38
Easily swap in dependencies linked in a directory (./packages); filled in with examples I use
#!/bin/sh
# This script swaps out a production version of the packages with a local development version (or back).
echo "Removing vendor/nicoverbruggen/atlas-core..."
rm -rf ./vendor/nicoverbruggen/atlas-core
echo "Removing vendor/nicoverbruggen/gatekeeper..."
rm -rf ./vendor/nicoverbruggen/gatekeeper
# We’ll create a backup file that we can simply restore when we have to roll back the dependencies to a production version.
FILE=./composer.json.bak
@nicoverbruggen
nicoverbruggen / .my.cnf
Last active April 18, 2020 19:37
Dump database file
[mysqldump]
user=root
password=INSERT_PASSPHRASE_HERE
@nicoverbruggen
nicoverbruggen / guide.md
Last active June 2, 2019 10:13
Handy repositories for managing a clean Windows 10 installation

Windows 10 Clean Installation Procedure

Post-Installation

  • Run the Windows 10 debloater script.
    • Download the latest version's zip.
    • Right-click on "Windows10DebloaterGUI.ps1"
    • Select "Run with Powershell"
    • Follow the instructions as provided in the repository to complete the cleanup
@nicoverbruggen
nicoverbruggen / commit-msg
Created February 18, 2015 14:15
Git hook that checks if you reference an issue in your commit
#!/usr/bin/env ruby
message_file = ARGV[0]
message = File.read(message_file)
$regex = /#(\d+)/
if !$regex.match(message)
puts "[POLICY] Please reference an issue in your commit."
exit 1
end
@nicoverbruggen
nicoverbruggen / Tips.md
Created March 16, 2014 12:50
Cordova Android optimizations

Hello

Just like my other gist, I'll add all kinds of tweaks and fixes for Cordova android builds here.

Android platform optimizations and customization

Icons

Place your icons in the /platforms/android/res/drawable* folders. (As icon.png.) Remember to respect DPI rules.