Skip to content

Instantly share code, notes, and snippets.


PatrickJS PatrickJS

View GitHub Profile
PatrickJS / haproxy.config
Created Jan 25, 2021 — forked from bwiggs/haproxy.config
HAProxy Config File Example
View haproxy.config
#debug # uncomment to enable debug mode for HAProxy
mode http # enable http mode which gives of layer 7 filtering
timeout connect 5000ms # max time to wait for a connection attempt to a server to succeed
timeout client 50000ms # max inactivity time on the client side
timeout server 50000ms # max inactivity time on the server side
backend legacy # define a group of backend servers to handle legacy requests

%GetOptimizationStatus return a set of bitwise flags instead of a single value, to access the value, you need to take the binary representation of the returned value. Now, for example, if 65 is returned, the binary representation is the following:

(65).toString(2).padStart(12, '0');
// 000001000001

Each binary digit acts as a boolean with the following meaning:

PatrickJS / expired-map.ts
Last active Aug 31, 2020
this doesn't work in cloudflare workers where time doesn't change
View expired-map.ts
export class ExpireMap extends Map {
expiring = new Map()
constructor(private _millis: number, private _getTime = this._getTime) {
public set<T, V>(key: T, value: V): V {
const expire = this.getTime() + this._millis
this.expiring.set(key, expire)
super.set(key, value)
View deno-lru.ts
export class LRU extends Map {
constructor(private max: number) {
* Attemps to retrieve a value from the cache
* @param key The key of the entry to return from the cache
* @returns the value associated to the input key or undefined

Keybase proof

I hereby claim:

  • I am patrickjs on github.
  • I am patrickjs ( on keybase.
  • I have a public key ASBn2MGzPQqMCt802JVdIQZ4jMYLE-gPnJ4uBCai7-XQxgo

To claim this, I am signing this object:

View map-lru.ts
class LRU extends Map {
m = 10;
get(k) {
let i = super.get(k);
if (i) {
super.set(k, i);
return i;
PatrickJS / utils.ts
Created Aug 9, 2020
View utils.ts
let matches = null;
export function matchesSelector(element: Element, selector: string): boolean {
if (!matches) {
const elProto = Element.prototype as any;
matches = elProto.matches || elProto.matchesSelector || elProto.mozMatchesSelector ||
elProto.msMatchesSelector || elProto.oMatchesSelector || elProto.webkitMatchesSelector;
return, selector);
PatrickJS / zoom-bombing.php
Created Apr 3, 2020 — forked from nekromoff/zoom-bombing.php
Zoom bombing - identify Zoom existing meeting IDs
View zoom-bombing.php
Identify existing meetings/meeting IDs on call app
License: Public domain. Use for pranking only. Any other use prohibited.
$ch = curl_init();
View little-vdom.js
export const h=(t,p,...c)=>({t,p,c,k:p&&p.key})
export const render=(e,d,t=d.t||(d.t={}),p,r,c)=>
// arrays
// components{children:e.c,...e.p},e.s=t.s||{},t=>
// create notes
e.d=t.d||(e.t?document.createElement(e.t):new Text(e.p)),
// diff props