Skip to content

Instantly share code, notes, and snippets.

@fdanielsen
fdanielsen / email.html
Last active May 10, 2024 14:50
Very basic HTML email base
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<title>[subject]</title>
<style type="text/css">
/* E-mail Reset */
#outlook a{padding:0;}
@tbranyen
tbranyen / canvas.js
Created February 2, 2012 18:07
Lightweight canvas wrapper.
// Basic Usage:
//
// var main = new Canvas({ elem: "canvas" }, function(options) {
// // Instantiate anything specific here...
// // Main draw loop
// this.draw = function() {
//
// };
// });
//
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