Skip to content

Instantly share code, notes, and snippets.

@SuaYoo
SuaYoo / mv-compress.sh
Last active November 8, 2023 01:51
ffmpeg music video compression for web (Apple/Mac)
# Software encoding, more options, slower
ffmpeg \
-i input.mov \
-hwaccel auto \
-c:v libx264 \
-c:a aac_at \
-b:a 320k \
-crf 17 \
-preset slow \
-movflags +faststart \
@SuaYoo
SuaYoo / web3-storage.js
Last active November 22, 2021 16:15
Encrypt and decrypt JSON files for Web3 Storage (requires Node.js >=15.7)
// node >=15.7.0 required for Blob usage
const { Blob } = require('buffer');
const crypto = require('crypto');
const { Web3Storage } = require('web3.storage');
// Secret env variables
//
// Grab token from https://web3.storage/tokens/
const WEB3_STORAGE_API_KEY = 'my_api_key';
// Encryption secret must have exact length of 32
@SuaYoo
SuaYoo / .env.local
Last active October 15, 2023 11:02
Next.js: Update Auth0 user metadata
AUTH0_ISSUER_BASE_URL='https://YOUR_AUTH0_DOMAIN.auth0.com'
AUTH0_SCOPE='openid read:current_user create:current_user_metadata update:current_user_metadata'
@SuaYoo
SuaYoo / .env.local
Last active March 11, 2024 16:43
Uploading an image with Next.js and Blazeback B2 (AWS S3 alternative)
BACKBLAZE_BUCKET_ID='YOUR_BACKBLAZE_BUCKET_ID'
BACKBLAZE_KEY_ID='YOUR_BACKBLAZE_KEY_ID'
BACKBLAZE_APP_KEY='YOUR_BACKBLAZE_APP_KEY'