Skip to content

Instantly share code, notes, and snippets.

@johnwahba
johnwahba / leetcode_etl.rb
Last active October 6, 2023 01:22
Create an sqlite db of your leetcode visits and submissions to track progress
# Script runs on mac. Would need to be adapted to run on windows.
require 'sqlite3'
require 'json'
require 'zip'
require 'tmpdir'
require 'find'
# Function to unzip the file
def unzip_file(file, destination)
// Turn all HTML <a> elements into client side router links, no special framework-specific <Link> component necessary!
// Example using the Next.js App Router.
import { useRouter } from 'next/navigation';
import { useEffect } from 'react';
function useLinkHandler() {
let router = useRouter();
useEffect(() => {
let onClick = e => {
@kconner
kconner / macOS Internals.md
Last active May 6, 2024 11:47
macOS Internals

macOS Internals

Understand your Mac and iPhone more deeply by tracing the evolution of Mac OS X from prelease to Swift. John Siracusa delivers the details.

Starting Points

How to use this gist

You've got two main options:

@fabianuribe
fabianuribe / A-twitter-search-box-hack.js
Last active November 23, 2022 11:03
George's Twitter Search Box Hack Challenge
const fetchHeaders = {
accept: "*/*",
"accept-language": "en-US,en;q=0.9",
authorization:
"Bearer AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA", // This will expire, you can get a new one by inspecting the network requests on twitter.com
"cache-control": "no-cache",
pragma: "no-cache",
"sec-ch-ua":
'"Google Chrome";v="107", "Chromium";v="107", "Not=A?Brand";v="24"',
"sec-ch-ua-mobile": "?0",
// ==UserScript==
// @name @chaoticvibing Twitter Blue Nerd - twitter.com
// @namespace Violentmonkey Scripts
// @match *://*.twitter.com/*
// @grant none
// @version 1.9.1
// @author @chaoticvibing - GH @busybox11
// @description 11/9/2022, 11:45:28 PM
// @updateURL https://gist.githubusercontent.com/busybox11/53c76f57a577a47a19fab649a76f18e3/raw/twitterblue-nerd.js
// @downloadURL https://gist.githubusercontent.com/busybox11/53c76f57a577a47a19fab649a76f18e3/raw/twitterblue-nerd.js
@Widdershin
Widdershin / ssr.md
Last active May 1, 2024 17:36
The absurd complexity of server-side rendering

In the olden days, HTML was prepared by the server, and JavaScript was little more than a garnish, considered by some to have a soapy taste.

After a fashion, it was decided that sometimes our HTML is best rendered by JavaScript, running in a user's browser. While some would decry this new-found intimacy, the age of interactivity had begun.

But all was not right in the world. Somewhere along the way, we had slipped. Our pages went uncrawled by Bing, time to first meaningful paint grew faster than npm, and it became clear: something must be done.

And so it was decided that the applications first forged for the browser would also run on the server. We would render our HTML using the same logic on the server and the browser, and reap the advantages of both worlds. In a confusing series of events a name for this approach was agreed upon: Server-side rendering. What could go wrong?

In dark rooms, in hushed tones, we speak of colours.

@huytd
huytd / wordle.md
Last active May 2, 2024 12:13
Wordle in less than 50 lines of Bash

image

How to use:

./wordle.sh

Or try the unlimit mode:

@0xallie
0xallie / checkm8_downgrade.md
Last active February 2, 2024 08:47
Guide for downgrading checkm8 devices
@stonar96
stonar96 / Anti-Xray.md
Last active March 4, 2024 15:16
Recommended Paper Anti-Xray settings by stonar96

❗ This has been moved to the official PaperMC docs ❗

Link: https://docs.papermc.io/paper/anti-xray

Help: https://discord.gg/papermc






Recommended Paper Anti-Xray settings by stonar96

General

Anti-Xray can be configured per world in the paper.yml configuration file. To understand how per world configuration works please read this first. Note that after changing any settings for Anti-Xray you have to restart your server. Executing the /reload command (you should never do this) won't apply the settings to worlds that are already loaded.

@PatheticMustan
PatheticMustan / Discord Tag Rerolling.md
Last active May 26, 2023 04:04
My notes on Discord tag re-rolling.

Discord Tag Rolling

When many users want to use a username that's taken, most software platforms solve this by just forcing them to choose another username. Discord has an interesting solution to this problem: giving people random 4 digit tags as well as their usernames! This allows for many users to have the same username while allowing each person to have a unique username that's easy to remember.

Some notes:

  • Discord's tag system makes it possible to have 9_999 people with the same username, but they limit people from using popular names at a certain point.
  • Discord's Nitro subscription system allows users to change their tag to any untaken tag. Their tags are randomized once their Nitro subscription ends.
  • There is a rate limit of 2 name/tag changes per hour.