Skip to content

Instantly share code, notes, and snippets.

View bradleyhodges's full-sized avatar

Bradley bradleyhodges

View GitHub Profile
@l4r-s
l4r-s / confetti.tsx
Last active October 14, 2026 02:03
Next.js Confetti Component - Add falling confetti animation to your Next.js app, just like the background on https://confettisaas.com. Perfect for celebratory events or adding a fun, festive touch to your website.
"use client";
import Confetti from "react-confetti";
import { useState, useEffect } from "react";
export default function ConfettiComponent() {
const [dimensions, setDimensions] = useState({ width: 0, height: 0 });
const [isSafari, setIsSafari] = useState(false);
useEffect(() => {
@GlitchWitch
GlitchWitch / rtl8156-ubuntu.md
Last active November 14, 2025 02:23
Setup the RTL8156 USB2.5G Ethernet Adapter on Ubuntu 20.04
@ygotthilf
ygotthilf / jwtRS256.sh
Last active September 28, 2026 12:13
How to generate JWT RS256 key
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
cat jwtRS256.key
cat jwtRS256.key.pub
@olimortimer
olimortimer / cloudflare_check.php
Last active January 1, 2021 11:52
PHP: Check IP is CloudFlare
<?php
function cidr_match($ip) {
foreach(file('https://www.cloudflare.com/ips-v4') as $cidr) {
list($subnet, $mask) = explode('/', $cidr);
if ((ip2long($ip) & ~((1 << (32 - $mask)) - 1) ) == ip2long($subnet)) {
return true;
@rolandinsh
rolandinsh / gist:3510701
Created August 29, 2012 11:04
Do Not Track (DNT) detect with PHP code
function get_smc_dnt() {
/*
* Do Not Track for privacy.
* When this feature is enabled, webpage should exclude all tracking tools,
* like Google Analytic and advertising networks
*/
// returns TRUE if DNT is on and is equal to 1,
// returns FALSE if DNT is unset OR not equal to 1
return (isset($_SERVER['HTTP_DNT']) && $_SERVER['HTTP_DNT'] == 1);
}