Skip to content

Instantly share code, notes, and snippets.

View imzza's full-sized avatar

Irfan Ullah imzza

View GitHub Profile
@imzza
imzza / keymap.json
Last active October 22, 2025 19:49
Zed Settings
// Zed keymap
//
// For information on binding keys, see the Zed
// documentation: https://zed.dev/docs/key-bindings
//
// To see the default key bindings run `zed: open default keymap`
// from the command palette.
[
{
"context": "Workspace",
@imzza
imzza / snippets.py
Created January 24, 2025 15:23
Jupyter Snippets
import re
from IPython.display import Markdown, clear_output, display
from openai import Stream
def map_citations(content, citations):
pattern = re.compile(r"\[doc(\d+)\]")
segments = pattern.split(content)
doc_numbers = []
@imzza
imzza / .pre-commit-config.yaml
Created January 14, 2025 14:26
Ruff Precommit
default_language_version:
python: python3.12
files: '.py'
default_stages: [commit]
fail_fast: true
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:

Docker compose common services

This file contains detailed instructions for setting up common services such as Portainer, Dozzle, and LocalStack locally using Docker and Docker Compose. It also includes steps to configure LocalStack to work with the AWS CLI and Python SDK (Boto3) as a local replacement for AWS services for testing purposes. For example, you can test services like S3, DynamoDB, SSM, and Secrets Manager. For the full list of supported services, please visit the documentation link.


Table of Contents

@pytest.fixture(scope="session")
def engine() -> Generator[Engine, None, None]:
suffix: str = "test"
parsed_url = urlparse(settings.DATABASE_URL)
database_url = urlunparse(
parsed_url._replace(
path=f"/{parsed_url.path.lstrip('/')}_{suffix}",
query=urlencode(parse_qs(parsed_url.query), doseq=True),
)
)
@imzza
imzza / python-zip.py
Last active October 3, 2023 10:06
Basic Utils
import shutil
from tempfile import mkdtemp, gettempdir
from os import path, makedirs, unlink
def compress_dir(src_dir, dest_path, dest_filename=None, skip_files = ["node_modules", ".git", ".venv"], compression="bz2"):
temp_dir_path = path.join(gettempdir(), path.basename(src_dir))
if path.exists(temp_dir_path): shutil.rmtree(temp_dir_path)
makedirs(temp_dir_path)
compression_map = {
@imzza
imzza / gist:67e1df96baac94d6c748b125b6362761
Created March 6, 2021 06:23 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: πŸ˜„ :smile: πŸ˜† :laughing:
😊 :blush: πŸ˜ƒ :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
πŸ˜† :satisfied: 😁 :grin: πŸ˜‰ :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: πŸ˜€ :grinning:
πŸ˜— :kissing: πŸ˜™ :kissing_smiling_eyes: πŸ˜› :stuck_out_tongue:
@imzza
imzza / create-thumbnail.php
Created October 9, 2020 13:01 — forked from pqina/create-thumbnail.php
Create thumbnails with PHP
<?
// Link image type to correct image loader and saver
// - makes it easier to add additional types later on
// - makes the function easier to read
const IMAGE_HANDLERS = [
IMAGETYPE_JPEG => [
'load' => 'imagecreatefromjpeg',
'save' => 'imagejpeg',
'quality' => 100
@imzza
imzza / nginx.conf
Created October 6, 2020 20:37 — forked from ulyssesr/nginx.conf
Nginx RTMP Setup
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
@imzza
imzza / 2019-https-localhost.md
Created July 26, 2020 18:08 — forked from cecilemuller/2019-https-localhost.md
How to create an HTTPS certificate for localhost domains

How to create an HTTPS certificate for localhost domains

This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.

Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).