Skip to content

Instantly share code, notes, and snippets.

View soulmachine's full-sized avatar

Frank Dai soulmachine

View GitHub Profile
@soulmachine
soulmachine / jwt-expiration.md
Last active April 9, 2024 04:12
How to deal with JWT expiration?

First of all, please note that token expiration and revoking are two different things.

  1. Expiration only happens for web apps, not for native mobile apps, because native apps never expire.
  2. Revoking only happens when (1) uses click the logout button on the website or native Apps;(2) users reset their passwords; (3) users revoke their tokens explicitly in the administration panel.

1. How to hadle JWT expiration

A JWT token that never expires is dangerous if the token is stolen then someone can always access the user's data.

Quoted from JWT RFC:

@soulmachine
soulmachine / nfs-proxmox.md
Last active March 22, 2024 20:54
Launch a NFS server on Proxmox

Method 1: NFS server on LXC container

Create a priviledged LXC container with:

mount=nfs,nesting=1

apt update

apt install nfs-kernel-server

@soulmachine
soulmachine / cloudSettings
Last active May 13, 2022 00:40
Visual Studio Code Settings Sync, for Node.js, TypeScript, Python, Go, C++ and Rust. Install this extension https://marketplace.visualstudio.com/items?itemName=Shan.code-settings-sync, fill in this gist ID, then everything will be installed automatically
{"lastUpload":"2022-03-23T11:50:25.185Z","extensionVersion":"v3.4.3"}
@soulmachine
soulmachine / README.md
Last active March 24, 2022 01:09
Visual Code Settings for Go, Rust, Solidity and Python. Install this extension https://marketplace.visualstudio.com/items?itemName=Shan.code-settings-sync and fill in this gist ID, then you're all set

vscode settings for Go Rust, Solidity and Python

Each language should have the following 3 components:

  1. The language server.
  2. The formatter.
  3. The linter.

Each component has a binary and a vscode extension.

@soulmachine
soulmachine / README.md
Created October 22, 2021 03:15
vscode for C/C++, using vscode-clangd

vscode for C/C++

This gist is my vscode configuratons for C/C++.

@soulmachine
soulmachine / README.md
Created October 22, 2021 03:13
vscode for C/C++, using the official vscode-cpptools extension.

vscode for C/C++

This gist is my vscode configuratons for C/C++.

@soulmachine
soulmachine / microk8s.md
Created February 16, 2021 02:40
Kubernetes

Install MicroK8s on Linux

sudo snap install microk8s --classic

Check the status while Kubernetes starts

microk8s status --wait-ready

Turn on the services you want

@soulmachine
soulmachine / debian-nodejs.md
Last active April 30, 2020 07:04
Install NodeJS on Debian 10
adduser node
usermod -aG sudo node

Create a new file /etc/sudoers.d/node:

node ALL=(root) NOPASSWD:ALL
@soulmachine
soulmachine / mongodb.md
Last active February 12, 2020 00:11
MongoDB

Install MongoDB on Debian 10:

sudo apt-get install gnupg
wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | sudo apt-key add -

echo "deb http://repo.mongodb.org/apt/debian buster/mongodb-org/4.2 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.2.list


sudo apt-get update