Skip to content

Instantly share code, notes, and snippets.

View apristen's full-sized avatar

Alex Pristenskiy apristen

View GitHub Profile
@apristen
apristen / docker-comose.yml
Last active February 12, 2024 14:30
PostgreSQL 15.1 inside Docker with IPv6 support.
version: '3.5'
# Tested with:
#
# $sudo docker --version
# Docker version 25.0.3, build 4debf41
#
# $sudo docker-compose --version
# docker-compose version 1.29.2, build 5becea4c
#
@apristen
apristen / easy_prerouting_port_forwarding_example.sh
Created January 4, 2022 16:08
Easy way for TCP and/or UDP ports forwarding from privileged (<1024) to non-privileged (>1024) ports using just iptables PREROUTING.
#!/bin/bash
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 25 -j REDIRECT --to-ports 2525
iptables -t nat -A PREROUTING -p udp -m udp --dport 53 -j REDIRECT --to-ports 5353
@apristen
apristen / how-to-move-repository-from-bitbucket-to-github-with-all-branches-and-commits-example-template.sh.
Last active December 24, 2021 21:50
How to move repo from one git to another with all branches and commits, for example from Bitbucket to GitHub.
# see https://www.devopsschool.com/blog/how-to-move-repository-from-bitbucket-to-github-with-all-branches-and-commits/
# see https://stackoverflow.com/questions/10312521/how-to-fetch-all-git-branches
# git clone user@bitbucket.org:source_project_name/source_repo.git # for SSH
git clone https://user@bitbucket.org/source_project_name/source_repo.git # for HTTPS
cd source_repo
git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
git fetch --all
git pull --all