Skip to content

Instantly share code, notes, and snippets.

import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.animation.animateColorAsState
import androidx.compose.animation.core.tween
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
# Maintainer: Jakub Hajek, jakub.hajek@cometari.com
#
# docker stack deploy -c stack-elastic.yml elastic
#
# The stack creates Elasticsearch cluster consiting of
# - 3 dedicated master nodes in order to keep quorum
# - 4 dedicated data nodes to manage CRUD,
#
# Docker compose file to easily deploy Elasticsearch cluster 7.x on Docker Swarm cluster.
@plitto007
plitto007 / jwtRS256.sh
Created October 23, 2023 09:53 — forked from ygotthilf/jwtRS256.sh
How to generate JWT RS256 key
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
cat jwtRS256.key
cat jwtRS256.key.pub
@plitto007
plitto007 / instagram_media_id.py
Created January 18, 2024 21:03
Retrieve Instagram media_id from url and vice versa
# This is Python port of this Javascript method:
# https://github.com/notslang/instagram-id-to-url-segment/blob/master/lib/index.coffee
url = "https://www.instagram.com/p/B8iwlG9pXHI/"
# ----> use regexp to extract code from url
code = "B8iwlG9pXHI"
charmap = {
'A': '0',
'B': '1',
@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
@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 / 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 / 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 / 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 / ssh-keygen.txt
Created March 4, 2025 07:14
SSH Key gen
# Use one in these way:
* ssh-keygen -t ed25519 -C "your_email@example.com"
If you are using a legacy system that doesn't support the Ed25519 algorithm, use:
* ssh-keygen -t rsa -b 4096 -C "your_email@example.com"