Skip to content

Instantly share code, notes, and snippets.

@khiemdoan
khiemdoan / telegram-send.sh
Last active November 29, 2023 04:35
Send message to Telegram in terminal
#!/bin/bash
CHAT_ID=<chat_id>
BOT_TOKEN=<bot_token>
# this 3 checks (if) are not necessary but should be convenient
if [ "$1" == "-h" ]; then
echo "Usage: `basename $0` \"text message\""
exit 0
fi
@khiemdoan
khiemdoan / 00-installer-config.yaml
Created October 10, 2023 02:06
Set static IP for Ubuntu 22.04
# /etc/netplan/00-installer-config.yaml
network:
version: 2
renderer: networkd
ethernets:
eno1:
dhcp4: false
dhcp6: false
addresses:
@khiemdoan
khiemdoan / extended_base_redis_model.py
Last active July 1, 2023 12:51
Base models for RedisOM with expire time
__author__ = 'Khiem Doan'
__github__ = 'https://github.com/khiemdoan'
__email__ = '[email protected]'
from datetime import datetime, timedelta
from typing import Self
from aredis_om import EmbeddedJsonModel as RedisEmbeddedJsonModel
from aredis_om import HashModel as RedisHashModel

With Ubuntu server:

sudo apt install open-vm-tools

With Ubuntu desktop

sudo apt install open-vm-tools open-vm-tools-desktop

Restore postgres database

pg_restore --verbose --clean --no-acl --no-owner --host=localhost --dbname=db_name --username=username latest.dump

Fedora Setup

Update packages

sudo dnf update

Enable linger

Fonts

Download and use Meslo LG M Regular Nerd Font

Meslo.zip

Setup font for Visual Studio Code

"terminal.integrated.fontFamily": "'MesloLGM Nerd Font', 'MesloLGM NF', monospace"
@khiemdoan
khiemdoan / Awesome.md
Last active August 15, 2024 07:22
My own awesome list

Python

  • loguru - Loguru is a library which aims to bring enjoyable logging in Python.
  • more-itertools - More routines for operating on iterables, beyond itertools.
  • pydantic - Data validation using Python type hints.
  • msgspec - A fast serialization and validation library, with builtin support for JSON, MessagePack, YAML, and TOML.
  • SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper.
  • Advanced Alchemy - Advanced Alchemy is a carefully crafted, thoroughly tested, optimized companion library for SQLAlchemy, offering useful and easy-to-use features for your database projects.
  • SQLModel - SQLModel, SQL databases in Python, designed for simplicity, compatibility, and robustness.
  • [Tortoise ORM](https
@khiemdoan
khiemdoan / Solarized Dark.terminal
Created September 18, 2022 18:20
Solarized Dark theme for Terminal.app
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ANSIBlackColor</key>
<data>
YnBsaXN0MDDUAQIDBAUGBwpYJHZlcnNpb25ZJGFyY2hpdmVyVCR0b3BYJG9iamVjdHMS
AAGGoF8QD05TS2V5ZWRBcmNoaXZlctEICVRyb290gAGjCwwTVSRudWxs0w0ODxARElVO
U1JHQlxOU0NvbG9yU3BhY2VWJGNsYXNzTxAoMC4wMzkzODA3MzY2NSAwLjE2MDExNjQ2
MzkgMC4xOTgzMzI3NTY4ABABgALSFBUWF1okY2xhc3NuYW1lWCRjbGFzc2VzV05TQ29s