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
def non_repeating(data):
count = {}
# First pass: Count occurrences
for char in data:
count[char] = count.get(char, 0) + 1
# Second pass: Find the first non-repeating character
for char in data:
if count[char] == 1:
def shown(data):
sb = 73
sp = [data[i : i + sb] for i in range(0, len(data), sb)]
print(' = (\n "{}"\n)'.format('"\n "'.join(sp)))
self.app.logger.warning(f"\n\nuser: {user}\n\n")
application.logger.warning(f"\n\nuser: {user}\n\n")
flask db init
flask db migrate -m "models creation"
flask db upgrade
# important libraries
from flower.utils import strtobool
from pip._internal.utils.misc import strtobool
from setuptools._distutils.util import strtobool
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"