Skip to content

Instantly share code, notes, and snippets.

View janstuemmel's full-sized avatar

Jan Stümmel janstuemmel

View GitHub Profile
@janstuemmel
janstuemmel / ssh-reverseproxy_webdev.md
Last active January 27, 2019 17:12
SSH reverse prox for web development

SSH Reverse Proxy

ssh -nN -R <remote-port>:localhost:<local-port> <username>@<server-ip-or-hostname>

Explanation

  • <remote-port> Any free port on your remote server, e.g. 9999
  • `` The port your local webserver is listening to, e.g. 8080
#!/bin/sh
# USAGE: execute with e.g.: BAZ=hello ./script.sh 5 1
#
## Variables
#
FOO=foo
${BAR:-bar} # default value "bar" for BAR, can be set from outside the script
echo $FOO $BAR # prints: foo bar
@janstuemmel
janstuemmel / README.md
Last active December 22, 2019 17:29
Parcel bundler and postcss modules

Parcel Bundler + module stylesheets

Setup

npm i -D postcss-modules
// ./.postcssrc
@janstuemmel
janstuemmel / totp-expires.js
Last active December 21, 2022 00:28
When does a 2fa (totp) token expire...
const period = 30;
const epoch = Math.floor(Date.now() / 1000.0);
const expires = (Math.ceil(epoch / period) * period) - epoch;
console.log(expires);