Skip to content

Instantly share code, notes, and snippets.

View mike-pete's full-sized avatar

Mike Peterson mike-pete

  • San Francisco, CA
View GitHub Profile
@mike-pete
mike-pete / directions.ts
Last active April 9, 2025 02:04
Directions Map - useful for direction based traversal
const direction = {
'↑': [-1, 0],
'↗': [-1, 1],
'→': [0, 1],
'↘': [1, 1],
'↓': [1, 0],
'↙': [1, -1],
'←': [0, -1],
'↖': [-1, -1],
} satisfies Record<string, [number, number]>
@aashari
aashari / 00 - Cursor AI Prompting Rules.md
Last active June 1, 2025 10:30
Cursor AI Prompting Rules - This gist provides structured prompting rules for optimizing Cursor AI interactions. It includes three key files to streamline AI behavior for different tasks.

Cursor AI Prompting Framework — Usage Guide

This guide shows you how to apply the three structured prompt templates—core.md, refresh.md, and request.md—to get consistently reliable, autonomous, and high-quality assistance from Cursor AI.


1. Core Rules (core.md)

Purpose:
Defines the AI’s always-on operating principles: when to proceed autonomously, how to research with tools, when to ask for confirmation, and how to self-validate.

@t3dotgg
t3dotgg / try-catch.ts
Last active June 1, 2025 04:06
Theo's preferred way of handling try/catch in TypeScript
// Types for the result object with discriminated union
type Success<T> = {
data: T;
error: null;
};
type Failure<E> = {
data: null;
error: E;
};
@mike-pete
mike-pete / heap.ts
Last active November 17, 2024 17:42
TS Heap
class Heap<T> {
#heap: (T | undefined)[] = [undefined]
#prioritize: (a: T, b: T) => number
constructor(prioritize: (a: T, b: T) => number, toHeapify: T[] = []) {
this.#prioritize = prioritize
this.#heap = [undefined, ...toHeapify]
this.#heapify()
}
const x = {
a:{
b:{
c:'neat'
}
}
}
const loop = (object, path) => {
let index = 0
@mike-pete
mike-pete / GitHub-RSA-Key.md
Last active November 28, 2024 17:12
GitHub Key
  1. Use git bash to generate ssh key ssh-keygen -t rsa -C "[email protected]"

You need to set a password to avoid issues. When you are setting your key password, nothing will show in the terminal when you enter your password, this is normal, don't panic!

  1. Print out the pub key cat ~/.ssh/id_rsa.pub
  2. Copy that key and add it to https://github.com/settings/keys (New SSH key)
  3. Test to make sure everything is peachy ssh -T [email protected]
@aal89
aal89 / 100kb.txt
Last active March 17, 2025 06:25
100kb in text
90008179737137449057850374296041230231448818231836430412891860501369559957934170566478171795337452573291424987820066966816786
11421932734664050282853577818350442368737025841021682351565157149258626742693172908157392514275953021340373789403811298198112
98078491418506031705393320777252539769380080434092015114759613380134199900073766190656627700475488778765198284763526475740644
27316250203873295755542616481830176762741844790191881961666387319684382599128392790817587468185935956109594742996822851456430
69484825595272003071580933663162309410919484264168162456415987660087356646694839288039098048397766765190012006438103559476605
88069969501403804546943579852833051109937002040256969349389081744254318024154760523379227341047257631357870025582656575655762
80287299653975203684260833623532172260301953877104948974634491969795223647429108528213960088039791160860481243853022341993839
24991718535415280310113584497118196223057217585054424117851185779066465713336737557959912721815816999403404005977799509009387
9410563589763257
@sundowndev
sundowndev / GoogleDorking.md
Last active June 1, 2025 14:50
Google dork cheatsheet

Google dork cheatsheet

Search filters

Filter Description Example
allintext Searches for occurrences of all the keywords given. allintext:"keyword"
intext Searches for the occurrences of keywords all at once or one at a time. intext:"keyword"
inurl Searches for a URL matching one of the keywords. inurl:"keyword"
allinurl Searches for a URL matching all the keywords in the query. allinurl:"keyword"
intitle Searches for occurrences of keywords in title all or one. intitle:"keyword"
@bcnzer
bcnzer / cloudflareworker-verifyjwt.js
Last active July 2, 2024 10:18
Sample Cloudflare worker that gets the JWT, ensures it hasn't expired, decrypts it and returns a result
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
})
// Following code is a modified version of that found at https://blog.cloudflare.com/dronedeploy-and-cloudflare-workers/
/**
* Fetch and log a request
* @param {Request} request
*/
@aprilmintacpineda
aprilmintacpineda / Using Multiple SSH keys - Beginner Friendly.md
Last active May 13, 2025 21:24
Beginner Friendly: Using Multiple SSH keys

How to follow this guide

The problem

I have one computer and two different github accounts. One is for work, the other is for my personal stuff. I can't use the same ssh key twice, so I have to use different ssh key for each of my accounts. How do I do that? How do I switch between these ssh keys?