Skip to content

Instantly share code, notes, and snippets.

Avatar
🌑

Kamil Ogórek kamilogorek

🌑
View GitHub Profile
View sorted-watch-later.js
// 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) => {
View yt-watch-later-duration.js
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;
View log_leaking_4-6-6.txt
npm run test-leaking
> sentry-jest-leak-repro@1.0.0 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)
View standing-desk-timer.go
package main
import (
"fmt"
"os"
"os/exec"
"strconv"
"time"
)
View ex1.go
func ExtractStacktrace(err error) *Stacktrace {
// https://github.com/pkg/errors
// Packages definitions:
// type Frame []uintptr
// type StackTrace []Frame
type stackTracer interface {
StackTrace() errors.StackTrace
}
View 1939.js
const express = require("express");
const Sentry = require("@sentry/node");
const api = express();
Sentry.init({
dsn: "http://whatever@sa.com/12",
environment: "development",
beforeSend(event) {
console.log("beforeSend", event.user.id);
View async-flush.js
const Sentry = require("@sentry/node");
const DELIVERY_TIME = process.argv[2];
const TIMEOUT = process.argv[3];
console.log(`\nDelivery time: ${DELIVERY_TIME / 1000}s`);
console.log(`Timeout: ${TIMEOUT / 1000}s`);
// @ignore-start Helper function
async function sleep() {
View broken-filter.js
window.GoogleCdn = {}
window.GoogleCdn.inject = function () {
internalMethod()
}
function internalMethod () {
throw new Error('dupa')
}
View mirko-vim.js
const entrySelector = "#itemsStream > .entry";
const entries = document.querySelectorAll(entrySelector);
const outlineStyle = "2px solid rgba(108, 176, 221, 0.8)";
const activeClassName = "vimLikeActive";
document.addEventListener("keypress", evt => {
if (document.activeElement !== document.body) return;
if (evt.key === "j") return down();
if (evt.key === "k") return up();
});
View external-lib.js
function externalLibrary (date) {
throw new Error(`externalLibrary method broken: ${date}`);
}
externalLibrary(Date.now());
You can’t perform that action at this time.