Skip to content

Instantly share code, notes, and snippets.

View ichux's full-sized avatar
🏠
Working from home

Chukwudi Nwachukwu ichux

🏠
Working from home
View GitHub Profile
# important libraries
from flower.utils import strtobool
from pip._internal.utils.misc import strtobool
from setuptools._distutils.util import strtobool
docker inspect rabbitmq | jq -r '.[0].NetworkSettings.Networks["testing-network"].Gateway'
docker save -o playwright_image.tar mcr.microsoft.com/playwright/python:v1.49.0-noble-amd64
docker load -i playwright_image.tar
docker pull mcr.microsoft.com/playwright/python:v1.49.0-noble-amd64
command: tail -f /dev/null
command: sleep indinity
# logs location
docker inspect --format='{{.LogPath}}' container-id
import Xlib.display
RED_COLOUR = (0, 0, 255)
THICKNESS = 2
def get_mouse_position():
pd = Xlib.display.Display().screen().root.query_pointer()._data
return pd["root_x"], pd["root_y"]
if MOUSE:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""nginx config file formatter/beautifier with no additional dependencies.
Originally published under https://github.com/1connect/nginx-config-formatter,
then moved to https://github.com/slomkowski/nginx-config-formatter.
"""
import argparse
@ichux
ichux / md-pdf.sh
Last active November 7, 2024 04:40
#!/bin/bash
# sudo apt install -y pandoc texlive-latex-base texlive-xetex
# Script: md_to_pdf.sh
# Description: Convert Markdown files to PDF using pandoc.
# Function to display usage
usage() {
echo "Usage: $0 [-o output_directory] file1.md [file2.md ...]"
exit 1
#!/bin/bash
echo "- lazydocker installation"
LAZYDOCKER_VERSION=$(curl -s "https://api.github.com/repos/jesseduffield/lazydocker/releases/latest" | grep -Po '"tag_name": "v\K[0-9.]+')
curl -Lo lazydocker.tar.gz "https://github.com/jesseduffield/lazydocker/releases/latest/download/lazydocker_${LAZYDOCKER_VERSION}_Linux_x86_64.tar.gz"
tar -xvzf lazydocker.tar.gz> /dev/null 2>&1 && rm lazydocker.tar.gz
mv lazydocker /usr/local/bin/lazydocker && chmod a+x /usr/local/bin/lazydocker
echo "+ lazydocker installation"
import os
from redis import ConnectionPool, Redis
# Setup Redis connection pool
POOL = ConnectionPool(
host=os.getenv("REDIS_HOST"),
port=os.getenv("REDIS_PORT"),
db=os.getenv("REDIS_DB"),
password=os.getenv("REDISCLI_AUTH"),
import itsdangerous
import jwt
def start_encoding(salt, secret_key, **kwargs):
sz = itsdangerous.Serializer(salt=salt, secret_key=secret_key)
return jwt.encode({"enc": sz.dumps(kwargs)}, secret_key, algorithm="HS256")
def end_decoding(salt, secret_key, response):