Skip to content

Instantly share code, notes, and snippets.

@erakli
erakli / _utils.py
Last active April 8, 2022 21:38
alembic_utils (0.7.7) duplicates problem (https://github.com/olirice/alembic_utils/issues/85)
import pkgutil
import sqlparse
def read_template(path: str) -> str:
# could be changed on `importlib_resources` after Python 3.9+
# ref: https://stackoverflow.com/a/58941536
template_path = f"templates/{path}"
content = pkgutil.get_data(__name__, template_path)
@erakli
erakli / uninstall-fuse-ext2.sh
Last active November 7, 2021 18:16
Uninstalling fuse-ext2
#!/usr/bin/env sh
echo "Checking for admin privileges"
if [[ $(id -u) -ne 0 ]]; then
set -e
echo "Please enter your password"
sudo "$0" "$@"
exit
fi
@erakli
erakli / README.md
Last active November 7, 2021 18:10
Uninstalling OpenZFS On OSX (O3X) v2

After v2 O3X is distributed in pkg. Previously there where dmg releases, where unistall scripts were included.

I failed to find same uninstall scripts for v2, so I fetched older release and modified uninstall-openzfsonosx.sh for recent version. Here it is.

@erakli
erakli / gist.md
Created December 14, 2020 00:34
How to hack encoding of mingw on Windows7
  1. Open file C:\Program Files\Git\mingw64\libexec\git-core\git-sh-setup
  2. Find function cd_to_toplevel ()
  3. Add line export LANG=C.UTF-8 at top of the function

This helps to use pre-commit hooks on Win7 with cyrillic in paths.

@erakli
erakli / dummy-web-server.py
Last active March 22, 2018 19:42 — forked from bradmontgomery/dummy-web-server.py
a minimal http server in python. Responds to GET, HEAD, POST requests, but will fail on anything else.
#!/usr/bin/env python
"""
Very simple HTTP server in python.
Usage::
./dummy-web-server.py [<port>]
Send a GET request::
curl http://localhost