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 / 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

on node

pip3 install cupy-cuda11x
python3
import cupy as cp
x = [cp.arange(100000000) for _ in range(1000)]
@dogterbox
dogterbox / env.txt
Created June 15, 2023 04:08
Set environment variables from file of key/value pairs
VAR1=1
VAR2=2
VAR3=3
@damico
damico / test-rocm.py
Created April 10, 2023 18:54
Script for testing PyTorch support with AMD GPUs using ROCM
import torch, grp, pwd, os, subprocess
devices = []
try:
print("\n\nChecking ROCM support...")
result = subprocess.run(['rocminfo'], stdout=subprocess.PIPE)
cmd_str = result.stdout.decode('utf-8')
cmd_split = cmd_str.split('Agent ')
for part in cmd_split:
item_single = part[0:1]
item_double = part[0:2]
@dogterbox
dogterbox / git-filter-repo.sh
Created February 23, 2023 06:55
Cleanup files with git-filter-repo
# upgrade git
sudo apt-get install -y python-software-properties software-properties-common
sudo add-apt-repository ppa:git-core/ppa -y
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install git -y
# install git-filter-repo
pip3 install git-filter-repo
pip list --format=freeze > requirements.txt
@dogterbox
dogterbox / direnv-sample.sh
Last active April 3, 2023 06:23
Managing Environments with direnv (.envrc)
# REF: https://stackabuse.com/managing-python-environments-with-direnv-and-pyenv/
# installing
curl -sfL https://direnv.net/install.sh | bash
# with bash
echo 'eval "$(direnv hook bash)"' >> ~/.bashrc
source ~/.bashrc
# with zsh
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
@Williero
Williero / index.html
Created January 14, 2022 23:33 — forked from timothycarambat/index.html
Easy Web3 Meta Mask Login - static HTML and Vanilla JS
<html>
<head>
<title>Web3 Metamask Login</title>
<link href="https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css" rel="stylesheet">
</head>
<body class="flex w-screen h-screen justify-center items-center">
<div class="flex-col space-y-2 justify-center items-center">
<button id='loginButton' onclick="" class="mx-auto rounded-md p-2 bg-purple-500 text-white">
@sxiii
sxiii / remove.sh
Created October 5, 2020 05:35
Docker Swarm - Remove all Down nodes automatically
#!/bin/bash
# Requirements: linux, docker, grep, awk
# This script removes all "Down" (off) nodes from Docker Swarm
# Useful to clean stuff from time to time, if you have auto-joining nodes for example
sudo docker node rm $(sudo docker node ls | grep Down | awk -F" " '{ print $1 }')