Skip to content

Instantly share code, notes, and snippets.

⊂(◉‿◉)つ b̡͉̙̞͙͔͔̺̉͌̽̽͂̿͂͝erstend͔͝

berstend̡̲̫̹̠̖͚͓̔̄̓̐̄͛̀͘ berstend

⊂(◉‿◉)つ b̡͉̙̞͙͔͔̺̉͌̽̽͂̿͂͝erstend͔͝
  • Berlin, Germany
View GitHub Profile
View hcaptcha.ts
import { IncomingMessage, RequestListener, ServerResponse } from "http"
import { createServer, Server } from "https"
import puppeteer, {
} from "puppeteer-core"
import { Page } from "./types"
import Cookie = Protocol.Network.Cookie
berstend / chromiumVersion.js
Last active Mar 27, 2021
Parse chrome/chromium version from user agent string and semver compare
View chromiumVersion.js
const chromiumVersion = (() => {
const compare = (newVer = "", oldVer = "") => {
const oldParts = oldVer.split(".");
const newParts = newVer.split(".");
for (let i = 0; i < newParts.length; i++) {
const a = ~~newParts[i]; // parse int
const b = ~~oldParts[i]; // parse int
if (a > b) return 1;
if (a < b) return -1;
berstend /
Last active Jan 25, 2022
Mass unfollow users on Instagram (no app needed)
  • Go to your profile on (sign in if not already)
  • Click on XXX following for the popup with the users you're following to appear
  • Open Chrome Devtools and Paste the following into the Console and hit return:
(async function(){
  const UNFOLLOW_LIMIT = 800
  const delay = (ms) => new Promise(_ => setTimeout(_, ms))
  const findButton = (txt) => [...document.querySelectorAll("button").entries()].map(([pos, btn]) => btn).filter(btn => btn.innerHTML === txt)[0]
berstend / graphiql_dark_0.11.11.css
Created Nov 4, 2019
Dark mode for GraphiQL extracted from Dark Reader
View graphiql_dark_0.11.11.css
[data-darkreader-inline-bgcolor] {
background-color: var(--darkreader-inline-bgcolor) !important;
[data-darkreader-inline-bgimage] {
background-image: var(--darkreader-inline-bgimage) !important;
[data-darkreader-inline-border] {
border-color: var(--darkreader-inline-border) !important;
[data-darkreader-inline-border-bottom] {
berstend /
Created Mar 5, 2019
Make a monorepo with existing repos
#!/usr/bin/env bash
# Before:
# (Assuming you standard branch is development in the mono repo)
# git checkout -b add-services
repoList="api backend-service frontend"
serviceDir=services # local directory to pull the other repos in
berstend / foobar.yaml
Created Jan 22, 2019
Restart (rolling updates) pods recurringly on GKE
View foobar.yaml
kind: Role
namespace: default
name: restart-pods
- apiGroups:
- extensions
- apps
berstend / bayesian_ranking.js
Created Dec 16, 2018
Given star ratings and votes, calculate bayesian estimate ratings to sort by popularity (taking number of votes into consideration)
View bayesian_ranking.js
bayesian rating = (v ÷ (v+m)) × R + (m ÷ (v+m)) × C
R = stars for the entry
v = number of votes for the entry
m = minimum votes required to be listed (eg. 10)
C = the mean stars across the whole list (eg. 4.1)
This rating only includes entries that have at least 10 votes.
The bayesian estimate is a statistical technique used to reduce the noise
berstend /
Last active Aug 15, 2018
Prisma GraphQL Introspection Automation (Extract Postgres schema to datamodel.graphql and deploy to prisma server)

Prisma is amazing but unfortunately in it's early days and I got tired of having to manually enter my database info each time I ran prisma introspect.

With a little help of autoexpect this task is now automated.

Hint: On macOS you might need to install expect from brew, as the macOS version doesn't include autoexpect.


Modify script.exp to use your Postgres credentials.

View cssscan.js
This file has been truncated, but you can view the full file.
(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
(function (global){
const csso = require('csso');
const shrthnd = require('shrthnd');
const specificity = require('specificity');
const postcss = require('postcss');
const cssDeclarationSorter = require('css-declaration-sorter');
const postCssMergeLonghand = require('postcss-merge-longhand');
berstend / wf.css
Last active Jul 5, 2018
The edited wf.cs and wf.css files from's bookmarklet.
View wf.css
@-webkit-keyframes slideDown{from{max-height:0}to{max-height:250px}}@-webkit-keyframes fadeIn{from{opacity:0}to{opacity:1}}*{cursor:default!important}.__whatfont_basic{background:transparent;border:0 solid black;border-bottom:0 solid black;border-left:0 solid black;border-right:0 solid black;border-top:0 solid black;border-radius:none;-moz-border-radius:none;-webkit-border-radius:none;bottom:auto;box-shadow:none;-moz-border-radius:none;-webkit-box-shadow:none;clear:none;color:inherit;cursor:auto;float:none;font:inherit;height:auto;left:auto;list-style:none;margin:0;max-height:none;max-width:none;min-height:none;min-width:none;overflow:visible;padding:0;position:static;right:auto;text-align:inherit;text-decoration:none;text-indent:0;text-shadow:inherit;text-transform:none;top:auto;visibility:visible;width:auto;z-index:auto;zoom:1;-webkit-font-smoothing:antialiased}.__whatfont_basic *{color:inherit}.__whatfont_basic a,.__whatfont_basic a:visited .__whatfont_basic a:hover,.__whatfont_basic a:active{color:inherit