Skip to content

Instantly share code, notes, and snippets.

View aburaihan-dev's full-sized avatar
🏠
Working from home

Md. Abu Raihan Srabon aburaihan-dev

🏠
Working from home
View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@aburaihan-dev
aburaihan-dev / docker-compose.yaml
Created January 8, 2026 17:03 — forked from bouroo/docker-compose.yaml
pgcat and postgresql replication with docker compose
# Environment variables for PostgreSQL containers
x-default-pg-env: &default-pg-env
# Set the timezone to Asia/Bangkok
TZ: Asia/Bangkok
# Username for the PostgreSQL administrative account
POSTGRESQL_USERNAME: postgres
# Name of the default PostgreSQL database
POSTGRESQL_DATABASE: postgres
# Password for the PostgreSQL administrative account
POSTGRESQL_PASSWORD: mysecretpassword
Install:
https://kienngd.github.io/how-to-use-zram-on-ubuntu-2404/
FixUp:
https://manpages.ubuntu.com/manpages/xenial/man8/zramctl.8.html
https://askubuntu.com/questions/730749/how-to-change-zram-size
Commands:
# swapoff /dev/zram0
@aburaihan-dev
aburaihan-dev / docker-compose.yml
Created August 18, 2024 10:23 — forked from mrzapp/docker-compose.yml
NextCloud setup for Docker (docker-compose) with Collabora, NGINX, Redis and Postgres
version: "3.4"
networks:
example-com--postgres: ~
example-com--redis: ~
services:
# PostgreSQL
postgres:
container_name: example-com--postgres
@aburaihan-dev
aburaihan-dev / 01-netcfg.yaml
Created August 4, 2024 10:29
ubuntu netplan demo config
network:
version: 2
ethernets:
ens33:
dhcp4: no
addresses:
- 192.168.1.10/24
gateway4: 192.168.1.1
nameservers:
addresses:
@aburaihan-dev
aburaihan-dev / check_docker_volume_size.sh
Created December 19, 2023 08:53
This Bash script provides a quick overview of the sizes of Docker volumes using the du (disk usage) command. It iterates through all Docker volumes, retrieves their mountpoints, and calculates and prints their sizes in a human-readable format. Useful for monitoring and managing disk usage in Docker environments.
#!/bin/bash
# Get a list of all Docker volume names
volume_names=$(docker volume ls --quiet)
# Iterate through each volume and print its name and size
for volume_name in $volume_names; do
volume_path=$(docker volume inspect --format '{{ .Mountpoint }}' $volume_name)
volume_size=$(du -sh $volume_path | cut -f1)
echo "Volume: $volume_name, Size: $volume_size"
@aburaihan-dev
aburaihan-dev / cleaner.sh
Last active March 9, 2025 05:01
docker daemon config
#!/bin/bash
# Find and clean large Docker container log files
logs=$(find /var/lib/docker/containers/ -type f -name "*.log")
for log in $logs; do
size=$(du -m "$log" | cut -f1)
if [ $size -gt 10 ]; then
echo "Cleaning up large log file: $log"
truncate -s 0 "$log"
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo curl -L https://raw.githubusercontent.com/docker/compose/1.29.2/contrib/completion/bash/docker-compose -o /etc/bash_completion.d/docker-compose
@aburaihan-dev
aburaihan-dev / gist:5ebc0c65c71572bdf07738a5e30caee1
Last active June 2, 2022 13:43
View Docker container restart policy
# Topic: Is it possible to show the restart policy of a running Docker container
# Reference:
https://stackoverflow.com/questions/43108227/is-it-possible-to-show-the-restart-policy-of-a-running-docker-container
# Solution:
docker ps|grep -v CON|awk '{print $1}'|while read line; do docker inspect -f "{{ .HostConfig.RestartPolicy.Name }}" $line |xargs echo $line ;done