Skip to content

Instantly share code, notes, and snippets.

View rene-d's full-sized avatar
🤘
Let There Be Rock

rene-d rene-d

🤘
Let There Be Rock
  • Thales
  • France
View GitHub Profile
@rene-d
rene-d / flashimg.py
Last active October 27, 2024 07:43
Command-line tool to write a disk image on a USB device with macOS.
#!/usr/bin/env python3
"""
Command-line tool to write a disk image on a USB device with macOS.
Exactly like [etcher](https://etcher.balena.io), [rpi-imager](https://github.com/raspberrypi/rpi-imager),
[rufus.ie](https://rufus.ie), [UNetbootin](https://unetbootin.github.io), etc.
No frills, no freaks, much simple and so more efficient.
Unix has the right tool for over 50 years: [`dd`](https://en.wikipedia.org/wiki/Dd_(Unix)). Sorry folks and
@rene-d
rene-d / conso.py
Last active October 17, 2024 13:27
#!/usr/bin/env python3
# apt-get install -y python3-venv python3-pandas python3-humanfriendly
# python3 -venv --system-site-packages --symlinks .venv
# .venv/bin/pip install git+https://github.com/wookayin/python-imgcat
import argparse
import configparser
from ftplib import FTP
#!/usr/bin/env bash
# https://en.wikipedia.org/wiki/ANSI_escape_code
print_colors()
{
# Print column headers.
printf "%-4s " '' ${bgs[@]}
echo
#!/usr/bin/env python3
from curses import wrapper
from math import pi, sin, cos
def bresenham(x0, y0, x1, y1):
"""
Bresenham's line algorithm.
Yield integer coordinates on the line from (x0, y0) to (x1, y1).
#!/usr/bin/env python3
"""
Read terminal properties and imgcat in Python.
References:
https://en.wikipedia.org/wiki/ANSI_escape_code
https://iterm2.com/documentation-escape-codes.html
https://iterm2.com/documentation-images.html
"""
@rene-d
rene-d / chromiumcache.py
Last active June 5, 2023 18:27
Chromium-like browsers cache viewer (Linux, macOS)
#!/usr/bin/env python3
# Chromium-like browsers cache viewer (Linux, macOS)
import argparse
import binascii
import struct
from datetime import datetime
from pathlib import Path
import traceback
@rene-d
rene-d / mac_utf8_insanity.md
Created April 29, 2023 07:02 — forked from JamesChevalier/mac_utf8_insanity.md
Unicode on Mac is insane. Mac OS X uses NFD while everything else uses NFC. This fixes that.

convmv manpage

Install convmv if you don't have it

sudo apt-get install convmv

Convert all files in a directory from NFD to NFC:

convmv -r -f utf8 -t utf8 --nfc --notest .

#!/usr/bin/env python3
from tkinter import Tk, Canvas, Frame, BOTH
from typing import List
import random
root = Tk()
root.geometry("600x600")
f = Frame()
@rene-d
rene-d / dog.py
Last active October 23, 2022 08:39
#!/usr/bin/env python3
# The Dog problem
# https://en.wikipedia.org/wiki/Pursuit_curve
import subprocess
from tkinter import Tk, Canvas, Frame, BOTH
import numpy as np
from PIL import Image
from pathlib import Path
@rene-d
rene-d / README.md
Last active September 16, 2022 04:30
Serve an ISO image in a HTTP server.

tl-iso-server.py

Serve an ISO image in a HTTP server. Designed for use with TeX Live, but should work for any ISO image.

Very suitable for offline and non-root environments, especially if you cannot mount -o loop the image.

Requirements