Skip to content

Instantly share code, notes, and snippets.

function fixNotionPadding() {
Array.from(document.querySelectorAll(`[style*="padding-left: 96px"]`)).forEach(el => el.style.padding = 0);
requestAnimationFrame(fixNotionPadding);
}
fixNotionPadding();
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>🔥 Make a photo booth app in about 15 lines of JavaScript</title>
<link rel="icon" href="https://fav.farm/🎥" />
</head>
<body>
@wesbos
wesbos / nuke-bot-tags.js
Created November 29, 2022 19:48
grease monkey script to remove bot tags
// ==UserScript==
// @name Remove Bot Tags
// @version 1
// @grant none
// ==/UserScript==
function nukeEm() {
console.log('Nuke em!');
Array.from(document.querySelectorAll('a[href*="SaveTo"], a[href*="memdotai"]'))
.map(link => {
@TengdaHan
TengdaHan / ddp_notes.md
Last active May 10, 2024 14:48
Multi-node-training on slurm with PyTorch

Multi-node-training on slurm with PyTorch

What's this?

  • A simple note for how to start multi-node-training on slurm scheduler with PyTorch.
  • Useful especially when scheduler is too busy that you cannot get multiple GPUs allocated, or you need more than 4 GPUs for a single job.
  • Requirement: Have to use PyTorch DistributedDataParallel(DDP) for this purpose.
  • Warning: might need to re-factor your own code.
  • Warning: might be secretly condemned by your colleagues because using too many GPUs.
@wesbos
wesbos / service-worker.js
Created March 24, 2022 18:26
Nuke a service worker from inside a service worker
// put this in a file where your service worker used to live, like yourdomain.com/service-worker.js. You can find out this path in the SW dev tools of your browser
self.addEventListener('install', (e) => {
console.log('[Service Worker] Installing Service Worker ...', e);
self.skipWaiting();
});
self.addEventListener('activate', (e) => {
console.log('[ServiceWorker] Activate');
self.registration
@bespoyasov
bespoyasov / removeNotStarredRepls.js
Last active May 10, 2024 14:48
Removes all repls one by one from list on https://repl.it/repls page
/**
* Removes all not starred repls one by one
* from list on https://repl.it/repls page
*
* Open browser console, put code in it
* and hit enter:
*/
const iterationsLimit = 1000
let iterationIndex = 0,
// 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 => {
@aamiaa
aamiaa / CompleteDiscordQuest.md
Last active May 10, 2024 14:48
Complete Recent Discord Quest

Complete Recent Discord Quest

Note

This no longer works in browser!

Note

This no longer works if you're alone in vc! Somebody else has to join you!

How to use this script:

  1. Accept the quest under User Settings -> Gift Inventory
# Have you ever had multiple branches stacked on top of each other waiting for code review
# and need to merge origin/master (or some other change) up the chain through each of them.
# This script will do that!
# Example: merge_through_each master branch_parent branch_child branch_grand_child
run_command () {
echo ""
echo "running: $@"
if ! $@
@bespoyasov
bespoyasov / export-apple-notes.js
Last active May 10, 2024 14:47
Export content from the Apple Notes app.
/**
* Open Script Editor, change the current language to JavaScript, and paste the following code.
* You can also save the script as an app for faster access and run.
*
* By default, password-protected notes' content will be empty.
* For exporting protected notes as well, unlock them first.
*
* Based on: https://macmost.com/export-all-of-the-notes-on-your-mac-using-a-script.html,
* extends it with support for writing non-ASCII characters.
*/