Skip to content

Instantly share code, notes, and snippets.

View andrewpetrochenkov's full-sized avatar
🔍

Andrew P andrewpetrochenkov

🔍
View GitHub Profile
@andrewpetrochenkov
andrewpetrochenkov / docker network.sh
Last active June 2, 2025 12:37
docker network #docker
docker network create NAME # docker network rm NAME
docker network ls
docker network inspect NAME
docker network inspect bridge --format='{{range .IPAM.Config}}{{.Gateway}}{{end}}'
@andrewpetrochenkov
andrewpetrochenkov / docker-buildkitd.sh
Last active June 2, 2025 13:44
docker buildkitd #docker #buildkitd
docker network create buildnet # docker network rm buildnet
# buildkitd - BuildKit daemon
docker rm -f buildkitd 2> /dev/null
docker run -d --name buildkitd --network buildnet \
moby/buildkit:latest \
sh -c 'printf "[registry.\"registry:5000\"]\nhttp = true\ninsecure = true\n" > buildkitd.toml && buildkitd --config buildkitd.toml --allow-insecure-entitlement security.insecure'
# network test:
# docker exec -it buildkitd ping registry
@andrewpetrochenkov
andrewpetrochenkov / docker-buildx.sh
Last active June 2, 2025 12:44
docker buildx #docker
# restart buildx builder (required after docker daemon.json edit and restart/etc)
docker buildx rm mybuilder
docker buildx create --name mybuilder --driver docker-container --use
docker buildx ls # mybuilder* default builder
@andrewpetrochenkov
andrewpetrochenkov / brew-install-docker.sh
Last active May 31, 2025 10:32
brew install docker #brew #docker #macos
brew install --cask --appdir=~/Applications --verbose docker
brew install docker-buildx
brew install docker-compose
brew install docker-compose-cli
brew install docker-completion
brew install docker-compose-completion
brew install docker-machine-completion
@andrewpetrochenkov
andrewpetrochenkov / replace-spaces-to-tabs.sh
Last active April 29, 2025 12:09
replace spaces to tabs #indentation #formatting #makefile #replace #sed #spaces #tabs #text-processing
find . -name 'Makefile' -exec sed -i '' -E 's/^ /\t/' {} +
@andrewpetrochenkov
andrewpetrochenkov / squid-brew-restart.sh
Created April 23, 2025 14:55
squid restart #squid #proxy
brew services stop squid
rm /opt/homebrew/var/run/squid.pid
brew services start squid
# test
brew services list | grep squid
curl -x http://127.0.0.1:3128 -v https://example.com
cat /opt/homebrew/var/logs/access.log
@andrewpetrochenkov
andrewpetrochenkov / git-push.sh
Last active April 14, 2025 11:53
git push #git
git push --all "$(git remote -v | awk '{print $1}' | uniq)"
git push -f --all "$(git remote -v | awk '{print $1}' | uniq)"
@andrewpetrochenkov
andrewpetrochenkov / python-requirements.txt.sh
Last active April 14, 2025 11:01
python requirements.txt #python #requirements.txt
# pipreqs (pip install pipreqs)
pipreqs --no-follow-links --force --print .
pipreqs --no-follow-links --force --print . | awk -F= '{print $1}' | grep -v ^configurations | grep -v ^$ > requirements.txt
sort --ignore-case -u -o requirements.txt{,}
# requirements.txt requirements.txt
python3 -m pip install -r requirements.txt
python3 -m pip install --break-system-packages -r requirements.txt
python3 -m pip --isolated install -r requirements.txt
@andrewpetrochenkov
andrewpetrochenkov / pip-install-editable.sh
Created April 14, 2025 10:54
pip install -e . #pip #python
find . -type d -name "*.egg-info" -exec rm -fr {} \;
pip install -e .
@andrewpetrochenkov
andrewpetrochenkov / pip-uninstall.sh
Created April 14, 2025 10:52
pip uninstall package #pip #python
python3 -m pip uninstall -y "$(python3 setup.py --name)"