Skip to content

Instantly share code, notes, and snippets.

@plitto007
plitto007 / mongo-docker-compose.yml
Created July 3, 2025 19:18
Demo Mongo deploy with docker compose
services:
mongo:
image: mongo:7.0.9
restart: always
container_name: demo_mongo
ports:
- '27017:27017'
volumes:
- mongo-data:/data/db
environment:
services:
redis:
image: redis:7.0
restart: always
ports:
- '6379:6379'
command: redis-server --requirepass "demo"
volumes:
- redis-data:/data
@plitto007
plitto007 / kafka-docker-compose.yml
Created April 10, 2025 19:30
Kafka docker demo
services:
zookeeper:
image: bitnami/zookeeper:3.8.1
hostname: zookeeper
ports:
- "2181:2181"
environment:
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000
ALLOW_ANONYMOUS_LOGIN: yes
@plitto007
plitto007 / jwt_token.py
Created March 4, 2025 08:38
Encode/Decode JWT token in python
# Created by mvp
# pip install PyJWT
import datetime
import jwt
SECRET = "<Some key here>"
def encode_auth_token(data, exp_secs=86400):
@plitto007
plitto007 / ssh-keygen.txt
Created March 4, 2025 07:14
SSH Key gen
# Use one in these way:
* ssh-keygen -t ed25519 -C "[email protected]"
If you are using a legacy system that doesn't support the Ed25519 algorithm, use:
* ssh-keygen -t rsa -b 4096 -C "[email protected]"
@plitto007
plitto007 / postgresql-docker-compose.yml
Created February 13, 2025 09:18
Simple PostgreSql deploy with docker compose
services:
db:
image: postgres:17.2-bookworm
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=postgres
ports:
- "5433:5432"
restart: always
@plitto007
plitto007 / py_whois.py
Created January 21, 2025 09:14
python whois
# pip install python-whois
import whois
def get_domain_info(domain):
try:
# Query the domain information
domain = whois.whois(domain)
print(domain)
# print(f"Domain Name: {domain.domain_name}")
@plitto007
plitto007 / pdf2image.py
Created January 17, 2025 08:15
Convert PDF to Images in Python
# pip install pymupdf
import os
import fitz # PyMuPDF
def pdf_to_images(pdf_path, output_folder, zoom=1.0):
"""
Convert PDF pages to images with a zoom scale.
@plitto007
plitto007 / barcode_gen.py
Created January 17, 2025 04:36
Create bar code using python
# pip install python-barcode
# pip install "python-barcode[images]"
from io import BytesIO
from barcode import EAN13
from barcode.writer import ImageWriter
# Write to a file-like object:
rv = BytesIO()
@plitto007
plitto007 / py-gitignore
Created April 22, 2024 16:39 — forked from MOOOWOOO/py-gitignore
python pycharm gitignore
# Created by .ignore support plugin (hsz.mobi)
### Python template
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so