Skip to content

Instantly share code, notes, and snippets.

View joshxyzhimself's full-sized avatar

joshxyzhimself joshxyzhimself

  • Philippines
View GitHub Profile
@gpluscb
gpluscb / instant-glicko-2.md
Last active April 29, 2023 02:20
So You Want to Use Glicko-2 for Your Game's Ratings

I wrote this article right after I published the first version of instant-glicko-2. It is meant to document how to implement a Glicko-2 algorithm that allows for instant feedback after games.

So You Want To Use Glicko-2 For Your Game's Ratings

Great! Glicko-2 is a very cool rating system. And a popular choice too! Lichess, CS:GO, and

@haproxytechblog
haproxytechblog / haproxy-config-2-0.cfg
Created June 13, 2019 20:41
HAProxy 2.0 configuration
#
# This is the ultimate HAProxy 2.0 "Getting Started" config
# It demonstrates many of the features available which are now available
# While you may not need all of these things, this can serve
# as a reference for your own configurations.
#
# Have questions? Check out our community Slack:
# https://slack.haproxy.org/
#
@disintegrator
disintegrator / https-during-dev.macos.sh
Last active April 23, 2024 22:41
Use Caddy, mkcert and dnsmasq to expose your development server over HTTPS
brew install caddy mkcert nss dnsmasq
mkcert -install
mkcert '*.app.test' '*.cdn.test'
# rename the certs and move them under /usr/local/etc/caddy/certs
cat <<EOF > /usr/local/etc/caddy/Caddyfile
*.app.test:443, *.cdn.test:443 {
@casamia918
casamia918 / node.js) ENOENT, no such file or directory when using fs.createWriteStream.md
Last active May 21, 2022 19:18
node.js) ENOENT, no such file or directory when using fs.createWriteStream

If you are facing the "ENOENT, no such file or directory" error message when using fs.createWriteStream, check your file name again.

In my case, the last character is not the last character of file name, but carrage return (\r)

I lost 3 hours to find this simple answer. So I leave this memo.

@devloco
devloco / download-pdf.js
Last active January 10, 2024 11:09
Download a PDF via POST with Fetch API
let fnGetFileNameFromContentDispostionHeader = function (header) {
let contentDispostion = header.split(';');
const fileNameToken = `filename*=UTF-8''`;
let fileName = 'downloaded.pdf';
for (let thisValue of contentDispostion) {
if (thisValue.trim().indexOf(fileNameToken) === 0) {
fileName = decodeURIComponent(thisValue.trim().replace(fileNameToken, ''));
break;
}
@ColonelBundy
ColonelBundy / Node.JS 8.9.4 - V8 6.1.534.50
Last active September 12, 2023 15:54
Promise vs Callback vs Async/await benchmark 2018
Doxbee sequential
benchmarking ./doxbee-sequential/async-bluebird.js
{"time":428,"mem":60.38671875,"errors":0,"lastErr":null}
benchmarking ./doxbee-sequential/async-es2017-native.js
{"time":591,"mem":98.82421875,"errors":0,"lastErr":null}
benchmarking ./doxbee-sequential/async-es2017-util.promisify.js
{"time":479,"mem":69.7734375,"errors":0,"lastErr":null}
benchmarking ./doxbee-sequential/callbacks-baseline.js
{"time":149,"mem":29.99609375,"errors":0,"lastErr":null}
@guettli
guettli / ssh-tunnel@.service
Created December 22, 2017 11:40
Reliable persistent SSH-Tunnel via systemd (not autossh)
# Reliable persistent SSH-Tunnel via systemd (not autossh)
# https://gist.github.com/guettli/31242c61f00e365bbf5ed08d09cdc006#file-ssh-tunnel-service
[Unit]
Description=Tunnel for %i
After=network.target
[Service]
User=tunnel
ExecStart=/usr/bin/ssh -o "ExitOnForwardFailure yes" -o "ServerAliveInterval 60" -N tunnel@%i
@StevenACoffman
StevenACoffman / _MicroService Proxy Gateway Solutions.md
Last active September 28, 2023 14:54
Microservice Proxy/Gateway Solutions

MicroService Proxy Gateway Solutions

Kong, Traefik, Caddy, Linkerd, Fabio, Vulcand, and Netflix Zuul seem to be the most common in microservice proxy/gateway solutions. Kubernetes Ingress is often a simple Ngnix, which is difficult to separate the popularity from other things.

Github Star Trend:

Github Star History for Kong vs traefik vs fabio vs caddy vs Zuul

This is just a picture of this link from March 2, 2019

Originally, I had included some other solution

@atoponce
atoponce / gist:07d8d4c833873be2f68c34f9afc5a78a
Last active March 19, 2024 17:24 — forked from tqbf/gist:be58d2d39690c3b366ad
Cryptographic Best Practices

Cryptographic Best Practices

Putting cryptographic primitives together is a lot like putting a jigsaw puzzle together, where all the pieces are cut exactly the same way, but there is only one correct solution. Thankfully, there are some projects out there that are working hard to make sure developers are getting it right.

The following advice comes from years of research from leading security researchers, developers, and cryptographers. This Gist was [forked from Thomas Ptacek's Gist][1] to be more readable. Additions have been added from