Skip to content

Instantly share code, notes, and snippets.

View jlxip's full-sized avatar
🏴‍☠️

jlxip jlxip

🏴‍☠️
View GitHub Profile
@jlxip
jlxip / gist:40d8ceff6e29f051ef566531d20ed3ea
Created February 20, 2024 17:56
Fix dates on photos from exported Telegram chats
#!/bin/bash -eu
find . -type f | gawk '/_thumb.*\.jpg/ {print}' | tr '\n' '\0' | xargs -0 rm
find . -type f -name '*.jpg' | \
gawk '{
match($0, /@([0-9]+)-([0-9]+)-([0-9]+)_([0-9]+)-([0-9]+)-([0-9]+)\.jpg/, arr)
print "touch -d", arr[3] "-" arr[2] "-" arr[1] "T" arr[4] ":" arr[5] ":" arr[6], $0
}' | bash -
@jlxip
jlxip / µlfs_runtime_module_minimization.sh
Created April 21, 2023 20:32
From 49.4 MB to 13.8 MB of a compressed µlfs hdd.img
#!/bin/bash -eu
# µlfs runtime module minimization
IMG=hdd.img
# Check (due to bash -e)
which zerofree
# Mount the image
LOOP="$(sudo losetup --partscan --show --find $IMG)"
@jlxip
jlxip / µlfs.sh
Last active April 24, 2023 12:04
µlfs: the simplest Linux From Scratch. Part of a series of posts: https://jlxip.net/blog
#!/bin/bash -eu
# µlfs
IMGSZ=128M
KERNEL_VARIANT=linux-virt
KERNEL_FILE=vmlinuz-virt
# ----- IMG FILE -----
# Generate img file
IMG=hdd.img
This is рython2.7
Contents start here:
#!/usr/bin/env python2.7
# -*- encoding: utf-8 -*-
import sys, hashlib, base64, os
if __name__ == '__main__':
with open(sys.argv[1], 'rb') as f:
# Source: http://www.asciiworld.com/-Death-Co-.html
skull = ' uuuuuuu\n uu$$$$$$$$$$$uu\n uu$$$$$$$$$$$$$$$$$uu\n u$$$$$$$$$$$$$$$$$$$$$u\n u$$$$$$$$$$$$$$$$$$$$$$$u\n u$$$$$$$$$$$$$$$$$$$$$$$$$u\n u$$$$$$$$$$$$$$$$$$$$$$$$$u\n u$$$$$$" "$$$" "$$$$$$u\n "$$$$" u$u $$$$"\n $$$u u$u u$$$\n $$$u u$$$u u$$$\n "$$$$uu$$$ $$$uu$$$$"\n "$$$$$$$" "$$$$$$$"\n u$$$$$$$u$$$$$$$u\n u$"$"$"$"$"$"$u\n uuu $$u$ $ $ $ $u$$ uuu\n u$$$$ $$$$$u$u$u$$$ u$$$$\n $$$$$uu "$$$$$$$$$" uu$$$$$$\nu$$$$$$$$$$$uu """"" uuuu$$$$$$$$$$\n$$$$"""$$$$$$$$$$uuu uu$$$$$$$$$"""$$$"\n """ ""$$$$$$$$$$$uu ""$"""\n uuuu ""$$$$$$$$$$uuu\n u$$$uuu$$$$$$$$$uu ""$$$$$$$$$$$uuu$$$\n $$$$$$$$$$"""" ""$$$$$$$$$$$"\n "$$$$$" ""$$$$""\n $$$" $$$$"\n'
def printSkull():