Skip to content

Instantly share code, notes, and snippets.

View xgenvn's full-sized avatar

TuNA 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 / blackd.service
Last active November 18, 2023 18:40
BlackD Formatter as service
# /etc/systemd/system/blackd.service
# sudo systemctl start blackd
# sudo systemctl enable blackd
# sudo systemctl status blackd
[Unit]
Description=Black Formatter Service
[Service]
ExecStart=/home/brian/bin/miniconda3/bin/blackd --bind-host=127.0.0.1
@xgenvn
xgenvn / Fix sleep awake issues ubuntu 20.04.md
Created September 7, 2020 15:07
Fix sleep awake issues ubuntu 20.04
  • Symstom: NVIDIA 440.100, GPU 1060, Ubuntu 20.04
  • Solution: Edit /etc/default/grub
GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" #
GRUB_CMDLINE_LINUX="nouveau.modeset=0 acpi_osi=! acpi_osi=\"Windows 2015\" acpi_backlight=vendor mem_sleep_default=deep acpiphp. disable=1" GRUB_CMDLINE_LINUX="nouveau.blacklist=1 acpi_rev_override=1 acpi_osi=Linux nouveau.modeset=0 pcie_aspm=force drm.vblankoffdelay=1 scsi_mod.use_blk_mq=1 nouveau.runpm=0 mem_sleep_default=deep"
@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 \
  1. Run on a terminal
 ssh -D 1337 -q -C -N <user>@ip -v
  1. Firefox:
  • Install FoxyProxy
  • Enter new configuration:
    • type: socks5
  • host: localhost
@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