Skip to content

Instantly share code, notes, and snippets.

@savanne-kham
savanne-kham / boot_arch_linux_live_usb_thinkpad.md
Last active December 9, 2024 20:11
Boot Arch Linux Live USB on Thinkpad
  1. Disconnect power supply then start laptop
  2. Tap F1 during Lenovo splash screen to enter BIOS
  3. In Bios, go to Security then disable Secure Boot
  4. F10 to Save and Exit
  5. Start on usb-hdd temporary or change boot order permanently in Bios
@savanne-kham
savanne-kham / make_linux_live_usb.md
Created December 6, 2024 22:44
Make Arch Linux live usb
$ sudo dd bs=4M if=/path/archlinux-2024.12.01-x86_64.iso of=/dev/sdb1 conv=fsync oflag=direct status=progress && sync
@savanne-kham
savanne-kham / verify_arch_linux_iso_signature.md
Last active December 6, 2024 15:28
Verify Arch Linux ISO signature
@savanne-kham
savanne-kham / firmware_hex_to_bin.md
Created October 17, 2024 07:02
Convert hex firmware to bin firmware

Strips away the metadata overhead (such as memory addresses) from the Intel HEX file and retains only the raw data in the .bin file. This makes firmware file lightweight and suitable for direct loading into memory, such as for use in a bootloader or any firmware updater

$ arm-none-eabi-objcopy.exe -I ihex input.hex -O binary output.bin

Arm GNU Toolchain: https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads

@savanne-kham
savanne-kham / asymmetric_keys_creation_windows.md
Last active August 27, 2024 07:07
How to Generate RSA Public and Private Keys for Asymmetric Cryptography on Windows 10 Using OpenSSL from Git Installation

By default, OpenSSL installed by Git on Windows is located at:

C:\Program Files\Git\usr\bin\openssl.exe

Follow these steps to generate a private and public key pair using OpenSSL.

  1. Create Private Key

Run the following command to generate a 2048-bit RSA private key and save it to private_key.pem:

@savanne-kham
savanne-kham / mount_external_encrypted_hdd.md
Last active October 19, 2023 18:30
Mount external hdd encrypted with LUKS
$ lsblk
$ sudo cryptsetup open /dev/sdb2 vaultdrive
$ mkdir -p /media/data
$ sudo mount /dev/mapper/vaultdrive /media/data
$ ranger /media
@savanne-kham
savanne-kham / genexp-initialization.py
Last active February 23, 2023 21:29
Genexp saves memory and computation by yielding items one by one using the iterator protocol instead of building a whole list and feeding another constructor
symbols = 'ABCDE'
genexp_tuple = tuple(ord(symbol) for symbol in symbols)
print(f"{genexp_tuple}")
import array
# parenthesis around second arg is mandatory for genexp arg
genexp_array = array.array('I', (ord(symbol) for symbol in symbols))
print(f"{genexp_array}")
@savanne-kham
savanne-kham / git_remotes_pushall.md
Last active February 22, 2023 21:10
Git multiple remotes and pushall alias configuration

Show list of remotes

$ git remote
$ git remote -v

Edition of remotes

$ git remote add <remote_name> <SSH repo address>
$ git remote remove 
@savanne-kham
savanne-kham / listcomps-Cartesian_Product.py
Last active February 22, 2023 20:56
List comprehension for list of tuple from cartesian products of 2 lists
colors = ['black', 'white']
sizes = ['S', 'M', 'L']
tshirts = [(color, size) for color in colors for size in sizes]
# (color, size): [('black', 'S'), ('black', 'M'), ('black', 'L'), ('white', 'S'), ('white', 'M'), ('white', 'L')]
tshirts = [(size, color) for size in sizes for color in colors]
# (size, color): [('S', 'black'), ('S', 'white'), ('M', 'black'), ('M', 'white'), ('L', 'black'), ('L', 'white')]