Skip to content

Instantly share code, notes, and snippets.

@mike-moreau
mike-moreau / nginx.conf
Last active September 26, 2025 21:54
Allow only cloudflare IP addresses to prevent firewall bypass (Laravel Forge)
# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/www.example.com/before/*;
geo $realip_remote_addr $cloudflare_ip {
default 0;
103.21.244.0/22 1;
103.22.200.0/22 1;
103.31.4.0/22 1;
104.16.0.0/13 1;
104.24.0.0/14 1;
@mike-moreau
mike-moreau / nginx.conf
Last active September 26, 2025 20:05
Reduce Bot Traffic with nginx.conf
server {
# Block traffic with no user agent - see comments
# if ($http_user_agent = "") {
# return 403;
# }
# Block traffic with - user agent
if ($http_user_agent = "-") {
return 403;
}
@mike-moreau
mike-moreau / nginx.conf
Created September 16, 2025 18:36
Block access to admin.php by IP address in NGINX (Laravel Forge)
# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/www.example.com/before/*;
server {
location /admin {
allow 123.456.789.001; # your ip here
deny all;
try_files $uri $uri/ /index.php?$query_string;
@mike-moreau
mike-moreau / query.sql
Created September 11, 2025 01:56
Sort MySQL tables by their size
SELECT
table_schema as `Database`,
table_name AS `Table`,
round(((data_length + index_length) / 1024 / 1024), 2) `Size in MB`
FROM information_schema.TABLES
ORDER BY (data_length + index_length) DESC
@mike-moreau
mike-moreau / config
Created July 9, 2025 18:51
mac ssh config file examples
# ~/.shh/config
# Defaults for all hosts
Host *
UseKeychain yes
AddKeysToAgent yes
Host github.com
IdentityFile ~/.ssh/id_github
@mike-moreau
mike-moreau / nginx.conf
Created July 1, 2025 14:16
Creating a redirect from a Laravel Forge site using nginx config only
# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/oldsite.com/before/*;
server {
http2 on;
listen 443 ssl;
listen [::]:443 ssl;
server_name oldsite.com;
server_tokens off;
root /home/forge/oldsite.com/public;
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
@mike-moreau
mike-moreau / prose.css
Created March 12, 2025 15:36
TailwindCSS 4 Typography Plugin Replacement Utility
@layer base {
:root {
--tw-prose-body: var(--color-gray-900);
--tw-prose-headings: var(--color-brand-blue);
--tw-prose-lead: var(--color-gray-900);
--tw-prose-links: var(--color-brand-cyan-a11y-any);
--tw-prose-bold: var(--tw-prose-body);
--tw-prose-counters: var(--tw-prose-body);
--tw-prose-bullets: var(--color-brand-gold);
--tw-prose-hr: var(--color-gray-400);
@mike-moreau
mike-moreau / biome.json
Created January 10, 2025 17:52
Biome Config File
{
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
"vcs": {
"enabled": false,
"clientKind": "git",
"useIgnoreFile": false
},
"files": {
"ignoreUnknown": false,
"ignore": []
@mike-moreau
mike-moreau / layout.twig
Created December 16, 2024 19:46
Non-blocking web font rendering for performance based on Craft CMS .env vars
{# Non-blocking Web Fonts - check to ensure display:swap is also used #}
{% if getenv('ADOBE_FONTS_URL') %}
<link rel="preconnect" href="https://use.typekit.net" crossorigin>
<link rel="preconnect" href="https://p.typekit.net" crossorigin>
<link rel="preload" href="{{ getenv('ADOBE_FONTS_URL') }}" as="style">
<link rel="stylesheet" href="{{ getenv('ADOBE_FONTS_URL') }}" media="print" onload="this.media = 'all'" />
<noscript>
<link rel="stylesheet" href="{{ getenv('ADOBE_FONTS_URL') }}">
</noscript>
{% endif %}