Skip to content

Instantly share code, notes, and snippets.

@blixt
blixt / prng.js
Last active January 14, 2024 07:01
A very simple, seedable JavaScript PRNG. NOTE: Please read comments on why this is not a good choice.
// NOTICE 2020-04-18
// Please see the comments below about why this is not a great PRNG.
// Read summary by @bryc here:
// https://github.com/bryc/code/blob/master/jshash/PRNGs.md
// Have a look at js-arbit which uses Alea:
// https://github.com/blixt/js-arbit
/**
@phiresky
phiresky / motioninterpolation.vpy
Last active June 4, 2024 05:19
Realtime motion interpolating 60fps playback in mpv
# vim: set ft=python:
# see the README at https://gist.github.com/phiresky/4bfcfbbd05b3c2ed8645
# source: https://github.com/mpv-player/mpv/issues/2149
# source: https://github.com/mpv-player/mpv/issues/566
# source: https://github.com/haasn/gentoo-conf/blob/nanodesu/home/nand/.mpv/filters/mvtools.vpy
import vapoursynth
core = vapoursynth.get_core()
@ebramanti
ebramanti / uncle_bob_scribe_oath.md
Last active December 20, 2022 14:54
Uncle Bob Scribe's Oath

Uncle Bob - Scribe's Oath

  1. I will not produce harmful code.
    • I will not intentionally write code with bugs.
    • This means: Do your best.
  2. I will not produce code that's not my best.
  3. I will provide with each release a quick, testable & repeatable proof that the code works.
  4. I will not avoid release that will impede progress.
    • Short term rapid releases
  5. I will fearlessly and relentlessly improve the quality of code.
  • I will never make the code worse.
@tzmfreedom
tzmfreedom / pg_notify.php
Last active March 8, 2023 23:09
postgresql notify/listen sample
<?php
$db = new PDO(
"pgsql:dbname=postgres host=localhost port=5432", 'postgres', 'postgres', [
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
]
);
$db->exec('LISTEN hoge');
@girst
girst / load-balance.sh
Last active March 8, 2024 13:26
Simple Linux Load Balancing with `iproute2`
#!/bin/bash
# Load balance multiple internet connections. Requires iproute2, awk and grep.
# (C) 2016 Tobias Girstmair, isticktoit.net, GPLv2
# Also useful: speedometer -l -r eth1 -t eth1 -m $(( 1024 * 1024 * 3 / 2 ))
# Not much user error checking is done - only pass working network connections
# script needs root to work and at least two interfaces to be useful
[ $EUID -eq 0 -a $# -ge 2 ] || {
echo "Usage (as root): $0 iface1[:weight1] iface2[:weight2] ..." >&2
@zmts
zmts / tokens.md
Last active July 25, 2024 07:03
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Last major update: 25.08.2020

  • Что такое авторизация/аутентификация
  • Где хранить токены
  • Как ставить куки ?
  • Процесс логина
  • Процесс рефреш токенов
  • Кража токенов/Механизм контроля токенов
@tyilo
tyilo / docker-compose.yml
Created January 14, 2018 23:12
docker: ipsec vpn server + mitmproxy
version: "3"
services:
vpn:
image: hwdsl2/ipsec-vpn-server
env_file:
- ./vpn.env
ports:
- "500:500/udp"
- "4500:4500/udp"
@Yoric
Yoric / Binary AST benchmarks.csv
Last active February 23, 2020 15:44
Binary AST benchmarks
Parsing benchmark duration (ms) Text (ideal syntax parsing heuristics) Text (full parsing) Pure syntax parsing Binary Binary vs ideal syntax parsing heuristics Binary vs full parsing Binary vs pure syntax parsing
frameworks/angular.1.6.5 1106 1061 1240 671 0.61 0.63 0.54
frameworks/backbone.1.3.3 135 138 105 76 0.56 0.55 0.72
frameworks/bootstrap.4.1.0 242 242 198 150 0.62 0.62 0.76
frameworks/chart.2.7.2 844 852 703 533 0.63 0.63 0.76
frameworks/ember.2.18.2 2583 2392 2155 1673 0.65 0.70 0.78
frameworks/foundation.6.4.3 659 652 544 427 0.65 0.65 0.78
frameworks/jquery.3.3.1 644 521 415 322 0.50 0.62 0.78
frameworks/moment.2.22.1 283 292 233 184 0.65 0.63 0.79
frameworks/react-dom.production.16.3.2 493 498 409 294 0.60 0.59 0.72