Skip to content

Instantly share code, notes, and snippets.

View dizlexic's full-sized avatar
:atom:
Never forget what they took from us.

Daniel Moore dizlexic

:atom:
Never forget what they took from us.
View GitHub Profile
@dizlexic
dizlexic / 499-nginx.conf
Created April 9, 2025 17:07
A very minimal edit of the fail2ban nginx bad request to handle 499 (it was an emergency, edit your nginx config instead)
# Fail2Ban filter to match hung up requests to nginx
#
[Definition]
# The request often doesn't contain a method, only some encoded garbage
# This will also match requests that are entirely empty
failregex = ^<HOST> - \S+ \[\] "[^"]*" 499
datepattern = {^LN-BEG}%%ExY(?P<_sep>[-/.])%%m(?P=_sep)%%d[T ]%%H:%%M:%%S(?:[.,]%%f)?(?:\s*%%z)?
@dizlexic
dizlexic / pint.json
Last active March 15, 2025 08:38
pint.json base pint configuration.
{
"preset": "laravel",
"rules": {
"array_syntax": {
"syntax": "short"
},
"blank_line_after_namespace": true,
"blank_line_after_opening_tag": true,
"blank_line_between_import_groups": true,
"cast_spaces": {
@dizlexic
dizlexic / MakeUser.php
Created November 19, 2024 14:41
Laravel make user with roles command (expects spatie/laravel-permissions)
<?php
namespace App\Console\Commands;
use App\Models\Role;
use App\Models\User;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Hash;
use function Laravel\Prompts\multiselect;
@dizlexic
dizlexic / nvm_demo.sh
Created June 14, 2024 09:03
bash snippet how to use nvm in a bash script (assumes you have a .nvmrc in the dir so nvm use is dynamic)
#!/bin/bash
NVM_VERSION="v0.39.7"
if [ ! -d ~/.nvm ]; then
curl "https://raw.githubusercontent.com/nvm-sh/nvm/${NVM_VERSION}/install.sh" | bash
fi
source ~/.nvm/nvm.sh
source ~/.profile
@dizlexic
dizlexic / .eslintrc
Created June 14, 2024 02:57
Eslint with trailing comma
{
"plugins": [
],
"env": {
"node": true
},
"parserOptions": {
"ecmaVersion": 2023
@dizlexic
dizlexic / zz-init-wp-db.sh
Created February 6, 2024 19:21
A helper script for wordpress database setup with environment variables. Used originally with docker
#!/bin/bash
# $WP_USER
# $WP_PASSWORD
# $WP_USER_EMAIL
# $SITE_DOMAIN
echo "** Creating default DB and users"
mysql -u root -p"$MYSQL_ROOT_PASSWORD" <<EOF
class UpgradeDetails: SKSpriteNode {
init(for upgrade: Upgrade, at point: CGPoint, of size: CGSize) {
// can purchase flag
let canPurchase = GameData.shared.canPurchaseUpgrade(upgrade: upgrade)
super.init(texture: nil,
color: canPurchase ? .magenta : .gray,
size: size)
name = "UpgradeDetails"
#!/bin/bash
# -*- mode: sh; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# vim: et sts=4 sw=4
# SPDX-License-Identifier: LGPL-2.1+
# Modified version of steamos-devmode
set -euo pipefail
# a file that gets removed when the image changes