Swift: Type Casting in For Loop

Okay. I need to jot this down somewhere, because i find myself googling this snippet, at least once a month. It’s not complex, but for some reason, it’s constantly slipping off my mind!

for case let children as ElementNode in rootNode.children { }

Burning Kali in macOS High Sierra!

To my future self: this is how you can ‘burn’ an ISO file into a flashdrive, so that it’s bootable!

hdiutil convert -format UDRW -o destination.img kali-linux-2017.2-amd64.iso 
diskutil list
diskutil partitionDisk /dev/disk2 1 "Free Space" "unused" "100%"
sudo dd if=destination.img.dmg of=/dev/disk2 bs=1m
diskutil eject /dev/disk2

macOS: Format as FAT32

Find the device path:

diskutil list

Format as FAT32:

sudo diskutil eraseDisk FAT32 NAME MBRFormat /dev/disk2

Thanks Apple, for having FAT32 as an option in the Disk Utility app. It’s so much nicer than having to remember a CLI command.</sarcasm>

Disabling Num Lock on startup (or why Windows makes me sick)

  • Launch Regedit
  • HKEY_USERS\Default\Control Panel\Keyboard
  • Set InitialKeyboardIndicators to Zero

Now, next time you boot… your beautiful small keyboard won’t have Num Lock enabled by default, AND you should be able to enter your password without further issues.