This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createServer } from "node:net"; | |
import { PGlite } from "@electric-sql/pglite"; | |
const PORT = 5432; | |
const db = new PGlite(); | |
await db.exec(` | |
CREATE TABLE IF NOT EXISTS test ( | |
id SERIAL PRIMARY KEY, | |
name TEXT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function prefixer(prefix) { | |
return function (...data) { | |
console.log( | |
data | |
.map((d) => JSON.stringify(d, null, 2)) | |
.join(" ") | |
.split("\n") | |
.map((line) => `${prefix}${line}`) | |
.join("\n") | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// HOW TO USE: | |
// 0. Get OAuth from https://developers.google.com/youtube/registering_an_application | |
// 1. Go to https://www.youtube.com/feed/library | |
// 2. Paste snippet below in DevTools | |
// 3. Replace `VIDEOS` with copied data | |
// 4. Run script | |
// JSON.stringify( | |
// Array.from(document.querySelectorAll("a.ytd-playlist-video-renderer")) | |
// .map((v) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get videos with: | |
# | |
# const videoElements = Array.from( | |
# document | |
# .querySelector("ytd-playlist-video-list-renderer") | |
# .querySelectorAll("ytd-playlist-video-renderer") | |
# ); | |
# | |
# const links = videoElements | |
# .map((el) => `"${el.querySelector("a").href}"`) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
fn() { | |
echo "Return is just placeholder exit code, rely on command instead" | |
return 1 | |
} | |
i=1 | |
while true; do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var elements = Array.from(document.querySelectorAll(".ytd-playlist-video-list-renderer span.ytd-thumbnail-overlay-time-status-renderer")) | |
var time = elements.map(v => { | |
const [s,m,h] = v.innerText.split(':').reverse().map(x => parseInt(x,10)); | |
return s + (m || 0) * 60 + (h || 0) * 60 * 60; | |
}) | |
var total = time.reduce((acc, v) => acc + v); | |
var h = Math.floor(total / (60 * 60)); | |
var m = Math.floor((total - (h * 60 * 60)) / 60); | |
var s = total%60; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npm run test-leaking | |
> [email protected] test-leaking /Users/kirill/Idea/sentry-jest-leak-repro | |
> jest leaking --maxWorkers=1 --logHeapUsage --detectOpenHandles | |
PASS src/leaking/488.leaking.test.js (60 MB heap size) | |
PASS src/leaking/399.leaking.test.js (55 MB heap size) | |
PASS src/leaking/31.leaking.test.js (55 MB heap size) | |
PASS src/leaking/136.leaking.test.js (57 MB heap size) | |
PASS src/leaking/270.leaking.test.js (68 MB heap size) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"os" | |
"os/exec" | |
"strconv" | |
"time" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func ExtractStacktrace(err error) *Stacktrace { | |
// https://github.com/pkg/errors | |
// Packages definitions: | |
// type Frame []uintptr | |
// type StackTrace []Frame | |
type stackTracer interface { | |
StackTrace() errors.StackTrace | |
} |
NewerOlder