Skip to content

Instantly share code, notes, and snippets.

View berstend's full-sized avatar
🐋
⊂(◉‿◉)つ b̡͉̙̞͙͔͔̺̉͌̽̽͂̿͂͝erstend͔͝

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

🐋
⊂(◉‿◉)つ b̡͉̙̞͙͔͔̺̉͌̽̽͂̿͂͝erstend͔͝
  • Berlin, Germany
View GitHub Profile
@berstend
berstend / tuning.sh
Created August 19, 2013 13:54
Basic Ubuntu performance tuning
kernel.pid_max = 1000000
#portrange for outgoing connections
#(increase the ephemeral port range)
net.ipv4.ip_local_port_range=1024 65535
# Fixing 'Too many open files', Second useful on nginx+aio workloads
fs.file-max=3262291
fs.aio-max-nr=65536
@berstend
berstend / LinkedOut.js
Last active November 2, 2022 23:28
Withdraw all pending invitations from LinkedIn automatically in bulk. - Or "How I stopped spamming all of my contacts with invitations". This script is super ugly (like what LinkedIn does with your email data) but worked for me. Usage: - Go to https://www.linkedin.com/inbox/invitations/sent - Open DevInspector, paste the script to the console, h…
var INCR = 16; // Number of messages per page
var SENT_URL = '//www.linkedin.com/inbox/invitations/sent?startRow=';
var loMessageLinks = []; // Main array for all contacts
var fetchMessages = function(i, cb) {
console.log('Fetching message page #' + (i+1));
$.get(SENT_URL + (i*INCR), function(data){
var $dom = $(data);
@berstend
berstend / AllowFlashInChromium.md
Last active January 22, 2020 10:21
Allow flash content to run by default in Chromium by using a management policy file

Tested on Ubuntu 14.04 and Chromium 65

Steps

apt-get install chromium-browser adobe-flashplugin

mkdir -p /etc/chromium/policies/managed

vim /etc/chromium/policies/managed/foo_policy.json
@berstend
berstend / wf.css
Last active July 5, 2018 09:11
The edited wf.cs and wf.css files from http://chengyinliu.com/whatfont.html's bookmarklet.
@-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
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');
const extension_styles = `
@berstend
berstend / README.md
Last active August 15, 2018 10:11
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.

Usage

Modify script.exp to use your Postgres credentials.

@berstend
berstend / bayesian_ranking.js
Created December 16, 2018 19:18
Given star ratings and votes, calculate bayesian estimate ratings to sort by popularity (taking number of votes into consideration)
/*
bayesian rating = (v ÷ (v+m)) × R + (m ÷ (v+m)) × C
where:
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
berstend / foobar.yaml
Created January 22, 2019 16:56
Restart (rolling updates) pods recurringly on GKE
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
namespace: default
name: restart-pods
rules:
- apiGroups:
- extensions
- apps
@berstend
berstend / momorepofy.sh
Created March 5, 2019 12:19
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
githubOrg=FOOBAR
repoList="api backend-service frontend"
repoBranch="development"
serviceDir=services # local directory to pull the other repos in