Skip to content

Instantly share code, notes, and snippets.

View afeblot's full-sized avatar

Alexandre Feblot afeblot

View GitHub Profile
@afeblot
afeblot / python-encoding.md
Last active October 4, 2023 15:17
Encoding in Python, once and for all

Encoding in Python, once and for all

Reference

You've all had the following mistake:

UnicodeDecodeError: 'machine' codec can't decode character 'trucmuche' in position x: ordinal not in range(z)

And then, to get out of it, you suffered a lot.

@afeblot
afeblot / gitSearchLargeFiles.py
Last active February 8, 2022 14:53
In a git repo, lists all files larger than a given size, displays in which commit they appear, and which branches these commits are part of.
#! /usr/bin/env python3
sizeLimit = 500*1024 # bytes
import subprocess
import sys
def execute(shellCmd):
return subprocess.check_output(shellCmd, shell=True, encoding='utf8')