Skip to content

Instantly share code, notes, and snippets.

@NickSdot
NickSdot / PasswordString.php
Last active December 8, 2022 06:27
This PHP class allows you to generate safe passwords with a length between 16-20 characters. The passwords generated by this class will pass the Laravel `Rules/Password::default() check`, making them suitable for suggesting strong and secure passwords to users. To generate and return a password, simply call: `PasswordString::make()`.
<?php
namespace Base;
class PasswordString
{
const LEGAL_CHARS = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*[]{}()_+-=,.<>?;:|';
public static function make(): string
{
#battery
sudo pmset -b standbydelaylow 300
sudo pmset -b standby 1
sudo pmset -b halfdim 1
sudo pmset -b sms 0
sudo pmset -b disksleep 10
sudo pmset -b standbydelayhigh 600
sudo pmset -b sleep 10
sudo pmset -b autopoweroffdelay 40000
sudo pmset -b hibernatemode 25
@NickSdot
NickSdot / 1_debug_memory_in_laravel_php.md
Last active June 25, 2023 08:17
Debug memory usage in Laravel PHP

I wanted a simple way to debug memory usage in a Laravel or simple PHP project. Something I can just drop into my code without packages, extensions or what not. This little helper does what I need.

Setup

  1. Create a helpers.php (see below) where ever you want.
  2. Add the helper file to your composer.json in the autoload/files section.
"autoload": {
 "files": [
function mysql() {
read -p "Champ, are you aware that you are in production? (y/N): " confirm
if [[ "$confirm" =~ ^[Yy]$ ]]; then
command mysql "$@"
else
echo "Command execution canceled. Next beer is on you."
fi
}

Conventional Commit Messages

See how a minor change to your commit message style can make a difference.

Tip

Have a look at git-conventional-commits , a CLI util to ensure these conventions and generate verion and changelogs

Commit Message Formats

Default