Skip to content

Instantly share code, notes, and snippets.

View dr5hn's full-sized avatar
🪄
Turning ☕ into code | Full Stack Magician 🧙‍♂️✨

Darshan Gada dr5hn

🪄
Turning ☕ into code | Full Stack Magician 🧙‍♂️✨
View GitHub Profile
@dr5hn
dr5hn / RadicleValetDriver.php
Last active July 31, 2025 13:39
Roots Radicle Valet Driver which Supports Multisite with Subdirectory Installation
<?php
namespace Valet\Drivers\Custom;
use Valet\Drivers\BasicValetDriver;
class RadicleValetDriver extends BasicValetDriver
{
/**
* Determine if the driver serves the request.
@dr5hn
dr5hn / snake_game_ai.md
Created July 16, 2025 08:51
Train an AI to play Snake game using Deep Q-Learning - watch it go from terrible to superhuman!

Snake Game AI Project - Complete Learning Roadmap 🐍

🎯 Project Overview & Learning Path

This is a 3-phase project that takes you from zero to AI expert:

  • Phase 1: Learn Pygame & Build Snake (1-2 weeks)
  • Phase 2: Understand AI Concepts (1 week)
  • Phase 3: Build AI that learns to play (1-2 weeks)

Total Time: 3-5 weeks (1-2 hours daily)

# Snake Game AI Project - Complete Learning Roadmap 🐍
## 🎯 Project Overview & Learning Path
This is a **3-phase project** that takes you from zero to AI expert:
- **Phase 1**: Learn Pygame & Build Snake (1-2 weeks)
- **Phase 2**: Understand AI Concepts (1 week)
- **Phase 3**: Build AI that learns to play (1-2 weeks)
**Total Time**: 3-5 weeks (1-2 hours daily)
@dr5hn
dr5hn / gtm.html
Created June 4, 2025 07:25
Google Tag Manager GTM Snippet
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-XXXXXX');</script>
<!-- End Google Tag Manager -->
@dr5hn
dr5hn / ga4.html
Created June 4, 2025 07:24
Google Analytics 4 GA4 Snippet
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXX"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-XXXXXXXXX');
</script>
@dr5hn
dr5hn / mac-tweaks.md
Created September 4, 2024 07:52
Mac Tweaks

Useful Mac Tweaks

Caps lock delay

One of the first things I noticed with my MacBook that really bothered me was the delay before I could turn on or off caps lock when I was typing. If you're typing quickly and want to quickly enable caps lock, you can't by default, and there's no user-facing way to disable this feature. However, there's a quick Terminal command you can use to turn it off.

hidutil property --set '{"CapsLockDelayOverride":0}'

That's it! Once you've run it, it's immediately in effect. Your caps lock delay will now be switched off, so you can type as fast as you want and switch caps lock on and off without getting frustrated about unnecessary delays to your typing.

Disable the changing file type warning

@dr5hn
dr5hn / fix-pys-deprecations.patch
Last active March 13, 2024 12:04
#[ReturnTypeWillChange] Fix Pixelyoursite Deprecation Errors PHP 8.1
diff --git a/vendor_prefix/facebook/php-business-sdk/src/FacebookAds/Object/ServerSide/Event.php b/vendor_prefix/facebook/php-business-sdk/src/FacebookAds/Object/ServerSide/Event.php
index 3373410..1c7c5f3 100644
--- a/vendor_prefix/facebook/php-business-sdk/src/FacebookAds/Object/ServerSide/Event.php
+++ b/vendor_prefix/facebook/php-business-sdk/src/FacebookAds/Object/ServerSide/Event.php
@@ -342,6 +342,7 @@ class Event implements ArrayAccess {
* @param integer $offset Offset
* @return boolean
*/
+ #[\ReturnTypeWillChange]
public function offsetExists($offset) : bool {
@dr5hn
dr5hn / Win10.preset
Created February 5, 2024 11:12 — forked from Log1x/Win10.preset
Recommended Windows 10 Performance Preset
# See: https://github.com/Disassembler0/Win10-Initial-Setup-Script
### Require administrator privileges ###
RequireAdmin
### Privacy Tweaks ###
DisableTelemetry # EnableTelemetry
DisableWiFiSense # EnableWiFiSense
DisableSmartScreen # EnableSmartScreen
DisableWebSearch # EnableWebSearch
@dr5hn
dr5hn / go.mod
Created January 24, 2024 08:43 — forked from caner-cetin/go.mod
World Data Fix Script on Golang
module cityconv
go 1.20
require github.com/jackc/pgx/v5 v5.4.1
require (
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect
golang.org/x/crypto v0.9.0 // indirect
@dr5hn
dr5hn / country-files.js
Created January 5, 2024 16:09 — forked from vis97c/country-files.js
Separate country data from dr5hn/countries-states-cities-database into smaller files
const fs = require("fs/promises");
const path = require("path");
const _ = require("lodash");
/**
* Write file
* @param {string} filePath
* @param {*} data
*/
async function writeFile(filePath, data) {