Skip to content

Instantly share code, notes, and snippets.

View xgenvn's full-sized avatar

Anh Tu Nguyen xgenvn

View GitHub Profile
@xgenvn
xgenvn / README.md
Created December 6, 2023 16:57 — forked from rubencaro/README.md
Python installation guide

Python installation guide

These are my notes, not a generic solution. They are not meant to work anywhere outside my machines. Update version numbers to whatever are the current ones while you do this.

Install asdf and its python plugin, then install Python

asdf lives in https://github.com/asdf-vm/asdf

Follow its installation instructions, which at the moment of writing were:

@xgenvn
xgenvn / README.md
Created December 6, 2023 12:20 — forked from maelvls/README.md
Ubuntu, libsecret, git-credential-helper

Dealing with secrets

GNOME comes with libsecret. You can use libsecret to store your git credentials:

sudo apt install libsecret-1-0 libsecret-1-dev libglib2.0-dev
sudo make --directory=/usr/share/doc/git/contrib/credential/libsecret
git config --global credential.helper /usr/share/doc/git/contrib/credential/libsecret/git-credential-libsecret
@xgenvn
xgenvn / sample.md
Created December 12, 2022 15:25
FFMPEG BACKGROUND VIDEO AUDIO LOOP
ffmpeg -i 20221211_074437.mp4 -stream_loop -1 -i ai_len_xu_hoa_dao_Anh_Tuyet.mp3 -shortest -map 0:v:0 -map 1:a:0 -y -c:v copy 20221211_074437_dubbed.mp4
ffmpeg -i 20221211_092532.mp4 -stream_loop -1 -i ai_len_xu_hoa_dao_Anh_Tuyet.mp3 -shortest -map 0:v:0 -map 1:a:0 -y -c:v copy 20221211_092532_dubbed.mp4
ffmpeg -i 20221211_104009.mp4 -stream_loop -1 -i ai_len_xu_hoa_dao_Anh_Tuyet.mp3 -shortest -map 0:v:0 -map 1:a:0 -y -c:v copy 20221211_104009_dubbed.mp4
@xgenvn
xgenvn / parse-xlsx.mjs
Created September 9, 2022 09:27
Parse XLSX with headers
import * as XLSX from 'xlsx/xlsx.mjs'
import * as fs from 'fs';
XLSX.set_fs(fs);
function main() {
const opts = {
}
const workbook = XLSX.readFile('excel_multiple_rows.xls', opts)
const first_ws = workbook.Sheets[workbook.SheetNames[0]];
@xgenvn
xgenvn / VirtualBox MacOS Turn off high resolution.md
Created June 17, 2022 05:58
VirtualBox MacOS Turn off high resolution

Display current settings

sudo /usr/libexec/PlistBuddy \
    -c 'print NSHighResolutionCapable' \
    /Applications/VirtualBox.app/Contents/Resources/VirtualBoxVM.app/Contents/Info.plist

Update setting (switch off high resolution for performance)

sudo /usr/libexec/PlistBuddy \
@xgenvn
xgenvn / GUIDE.md
Created May 3, 2022 13:46
Image optimize

Resize

mogrity -resize 1024 *.jpg
mogrity -resize 1024 *.jpeg
mogrity -resize 1024 *.JPG
mogrity -resize 1024 *.JPEG
ls | grep \~ | xarg rm

Optimize JPG

@xgenvn
xgenvn / .gitignore
Created January 11, 2022 14:41 — forked from pdxjohnny/.gitignore
Setting Up k3s for Serverless (knative) on a $5 DigitalOcean Droplet Using k3d
.terraform/
*.pem
*.tf
*.tfstate
*.yaml
*.backup
istio-*/
cert-manager-*/
*.swp
env
@xgenvn
xgenvn / pg dump and restore guide.md
Last active December 21, 2021 16:34
pg dump & restore

Plain text format should work

docker exec -i shared_postgres_instance pg_dump -U postgres -W scons_com_vn_production > ~/backup/scons_com_vn_production.sql
docker exec -i shared_postgres_instance psql -U postgres scons_com_vn_prod -W < ~/backup/scons_com_vn_production.sql

binary format (tar, gzip) won't work using pipe

for backup, cp from container to host

@xgenvn
xgenvn / machine.js
Last active September 17, 2021 12:06
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@xgenvn
xgenvn / System Design.md
Created August 13, 2021 14:42 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?