Skip to content

Instantly share code, notes, and snippets.

@Genarito
Genarito / static_encoder.py
Last active May 23, 2025 09:00
Django template tag for encoding images in base64 and rendering with server with Python 3.x
from django import template
from django.contrib.staticfiles.finders import find as find_static_file
import base64
register = template.Library()
def get_file_data(file_path: str) -> bytes:
"""
@param file_path: Path of the file to get the data
@vhermecz
vhermecz / custom_keys_git_ssh
Created June 8, 2020 11:20
Allow configuring multiple ssh deploy keys with git
#!/bin/bash
# Script to use custom ssh keys for various git repositories
# Run without arguments to get usage info.
#
# How it works:
# When used with SSH, git sends the path to the repository in the SSH command.
# @see: https://github.com/git/git/blob/e870325/connect.c#L1268
# We extract this info and search for a key with the name.
# Based on the source, this seems to be used format since v2.0 at least.
# @see: https://github.com/git/git/commit/a2036d7