Skip to content

Instantly share code, notes, and snippets.

View arvati's full-sized avatar
💭
Studying online

Ademar Arvati arvati

💭
Studying online
View GitHub Profile
@arvati
arvati / vhd4wsl2.md
Created September 17, 2024 11:48 — forked from spajak/vhd4wsl2.md
Creating virtual hard disk (VHD) for WSL2

Creating additional virtual hard disk (VHDX) for WSL2 with ext4 filesystem

Lines starting with # mean the commands have to be executed by root user under Linux shell (WSL distro). All other commands have to be executed under Windows-PowerShell as Administrator.

Make VHDX disk file and mount it under Windows

New-VHD support.vhdx -SizeBytes 25GB -Dynamic -BlockSizeBytes 1MB
Write-Output "\\.\PhysicalDrive$((Mount-VHD -Path support.vhdx -PassThru | Get-Disk).Number)"
@arvati
arvati / build.txt
Created August 24, 2024 17:15 — forked from ninlith/build.txt
Hybrid UEFI/BIOS multiboot USB drive
# Hybrid UEFI/BIOS multiboot USB drive
# Install required packages
sudo apt install gdisk grub2-common grub-efi-amd64-bin grub-pc-bin qemu-system
# Create an empty disk image
target_size=3.6G # $(lsblk -b --output SIZE -n -d /dev/sdX) for drive size
qemu-img create -f raw boottitikku.img "$target_size"
# Create a GUID Partition Table (GPT)
@arvati
arvati / bcrypt.ts
Last active August 9, 2024 00:25
This module provides BCrypt hashing support for deno and the web by providing simple bindings using bcrypt compiled to webassembly.
//https://jsr.io/@blackberry/bcrypt
import { hash, verify } from "jsr:@blackberry/bcrypt";
const encoder = new TextEncoder();
const password = encoder.encode("very-cool-password");
const salt = encoder.encode("salty salt woo!!");
const hashed = hash(password, salt);
@arvati
arvati / copy_disk.md
Created August 3, 2024 14:25
Copy entire windows disk with dd on debian linux
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@arvati
arvati / vault.md
Last active September 2, 2024 17:53
Create an encrypted file vault on Linux using LUKS

Install Luks

sudo apt install cryptsetup

Create an empty file, size 512 Mb

cd ~/
dd if=/dev/urandom of=vaultfile.img bs=1M count=512

Create Luks Volume

@arvati
arvati / flatpak.md
Created June 23, 2024 22:13
Install Linux Alpine flatpak working inside WSL
@arvati
arvati / mount.md
Last active June 23, 2024 20:17
Using USB devices under WSL with usbipd-win and mount Disks

Mount Windows Disk under WSL:

sudo mount -t drvfs D: /mnt/d

Mount generic disk under WSL

Identify your disk

GET-CimInstance -query "SELECT * from Win32_DiskDrive"
@arvati
arvati / month.md
Last active April 28, 2024 19:55
Move files with date in file name to directories
#!/bin/bash

declare -a months=("01 - Janeiro" "02 - Fevereiro" "03 - Março" "04 - Abril" "05 - Maio" "06 - Junho" "07 - Julho" "08 - Agosto" "09 - Setembro" "10 - Outubro" "11 - Novembro" "12 - Dezembro")

for ano in /mnt/data/media/Pictures/Dropbox/video/*; do
    if [  -d "${ano}" ] && [ $((10#$(basename "${ano}"))) -le 2024 ]; then
        for folder in "${ano}"/*; do
            pasta=$(basename "${folder}")
 nro=$((10#${pasta}))
@arvati
arvati / reboot.md
Last active April 20, 2024 19:26
Reboot Openwrt