Skip to content

Instantly share code, notes, and snippets.

View gartenfeld's full-sized avatar

David Rosson gartenfeld

View GitHub Profile
@gartenfeld
gartenfeld / jwt_user.js
Last active May 3, 2020 15:09
User decoder
const server = {}; // ...
const cookieParser = require('cookie-parser');
const jwt = require('jsonwebtoken');
server.express.use(cookieParser());
server.express.use((req, res, next) => {
const { token } = req.cookies;
if (token) {
const { userId } = jwt.verify(token, process.env.APP_JWT_SECRET);
req.userId = userId;
@gartenfeld
gartenfeld / mac_dictionary.sh
Created July 12, 2020 12:56
Search for word patterns
egrep ".*word$" /usr/share/dict/words
@gartenfeld
gartenfeld / download_section_metadata.sh
Last active June 14, 2024 11:28
Downloading section JSON data
# First, set up ssh for Puhti
# Use ssh-copy-id to add your key
ssh-copy-id [email protected]
# This way, you don't have to type your password for every command
# Make a .txt file with one file name (relative) per line
# Copy this file to remote
scp ./download_list.txt [email protected]:.
# Log in