Skip to content

Instantly share code, notes, and snippets.

View dogterbox's full-sized avatar
😴
Working from home

Teerapong Taengmuang dogterbox

😴
Working from home
View GitHub Profile
@dogterbox
dogterbox / alert.py
Created October 21, 2024 08:21
LINE Bot Notify
import requests
# generate token from https://notify-bot.line.me/my/
TOKEN = "YOUR_LINE_NOTIFY_TOKEN"
def send_line_notify(message):
url = "https://notify-api.line.me/api/notify"
headers = {
@dogterbox
dogterbox / docker-compose.yaml
Created July 15, 2024 05:07 — forked from joebeeson/docker-compose.yaml
Anchors in docker-compose.yaml
version: "3.4"
x-defaults: &defaults
image: "dask-dev/dask-notebook"
# With lists, each entry requires its own anchor if you
# intend to extend/reuse an entry in concrete services.
configs:
- &configs_condarc
source: "condarc"
@dogterbox
dogterbox / list-img-tag.sh
Created May 16, 2024 03:56
kubectl command for listing docker image tag in target namespace
kubectl get pods -n <namespace> -o jsonpath="{range .items[*]}{.spec.containers[0].name}{': '}{.spec.containers[0].image}{'\n'}{end}" | awk -F: '{printf "%-40s: %s\n", $1, $3}' | sort | uniq
Hex ChainId (Decimal) Network
0x1 1 Ethereum Main Network (Mainnet)
0x3 3 Ropsten Test Network
0x4 4 Rinkeby Test Network
0x5 5 Goerli Test Network
0x2a 42 Kovan Test Network
0xAA36A7 11155111 Sepolia Testnet
0x89 137 Polygon Main Network
0x13881 80001 Mumbai Test Network
0xA86A 43114 Avalanche C-Chain Main Network
@dogterbox
dogterbox / resize-disk.sh
Last active December 19, 2024 08:12
resize, expand ec2 disk size
# clenaup space
sudo rm -f /var/log/*.log
sudo rm -rf /var/log/journal/*
sudo rm -rf /tmp/*
# Resize the Partition
sudo growpart /dev/nvme0n1 1
# Resize the Filesystem
sudo resize2fs /dev/nvme0n1p1
@dogterbox
dogterbox / docker-cleanup-none-tag.sh
Created January 30, 2024 06:31
Docker Cleanup None Tag
docker rmi $(docker images --filter "dangling=true" -q --no-trunc) 2>/dev/null
docker builder prune
@dogterbox
dogterbox / dirsize.sh
Last active February 17, 2025 04:50
size of directory
ls -ad /home/username/.* | xargs -I {} du -sh {} | sort -rh
find . -maxdepth 1 -type d -exec du -sh {} \; 2>/dev/null | sort -rh
@dogterbox
dogterbox / allhistory.sh
Created October 5, 2023 15:29
apt all history logs
#!/bin/bash
REF: https://askubuntu.com/questions/425809/where-are-the-logs-for-apt-get/425884#425884
cd /var/log/apt && cat history.log > ~/allhistory.log && zcat history.log*gz >> ~/allhistory.log && cd
@dogterbox
dogterbox / custom_loguru_format.py
Created July 27, 2023 09:17
custom loguru format
# ref: https://stackoverflow.com/a/71008024
logger_format = (
"<green>{time:YYYY-MM-DD HH:mm:ss.SSS}</green> | "
"<level>{level: <8}</level> | "
"<cyan>{name}</cyan>:<cyan>{function}</cyan>:<cyan>{line}</cyan> | "
"{extra[ip]} {extra[user]} - <level>{message}</level>"
)
logger.configure(extra={"ip": "", "user": ""}) # Default values
logger.remove()

on node

pip3 install cupy-cuda11x
python3
import cupy as cp
x = [cp.arange(100000000) for _ in range(1000)]