| // npx jscodeshift --parser=ts add-import-extensions.js src/ | |
| module.exports = function(fileInfo, api) { | |
| const j = api.jscodeshift; | |
| const root = j(fileInfo.source); | |
| root.find(j.ImportDeclaration).forEach(path => { | |
| const source = path.value.source; | |
| if (source.value.startsWith('.') && !source.value.endsWith('.js')) { | |
| source.value += '.js'; |
| 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 |
| 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") | |
| ); |
| // 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) => { |
| # 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}"`) |
| #!/usr/bin/env bash | |
| fn() { | |
| echo "Return is just placeholder exit code, rely on command instead" | |
| return 1 | |
| } | |
| i=1 | |
| while true; do |
| 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; |
| 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) |
| package main | |
| import ( | |
| "fmt" | |
| "os" | |
| "os/exec" | |
| "strconv" | |
| "time" | |
| ) |