11 September 2019

Recovery a freebsd after whatever problem

If you had any trouble with your install (ndis module someone), there's an easy way to fix it.

  1. Boot your pendrive/cdrom/dvd/whatever with the freebsd install
  2. Enter the shell or start the LiveCD option (livecd is root without any password)
  3. Create a directory where you can import your zfs pool: mkdir /tmp/zroot
  4. Import your zpool there: zpool import -fR /tmp/zroot zroot 
  5. Need access to /? No problem: mkdir /tmp/root && mount -t zfs zroot/ROOT/default /tmp/root
  6. When you're done, unmount everything and reboot: zpool export zroot

05 September 2019

Organizing your clusterfuck collection of wallpapers

I have a directory filled with wallpapers that syncs with my devices, so I can use a random wallpaper (usually, change at boot or every 24h, whatever comes first). For the sake of organization, let's make this straight:

First, convert everything to png, because why not?


find . -name "*.jpg" -exec mogrify -format png {} \;

Double check your files and then delete the remaining jpgs (or whatever format you're converting):

rm *.jpg

Now, let's organize by number:

num=0; for i in *; do mv "$i" "$(printf '%04d' $num).${i#*.}"; ((num++)); done
 
If you need to add more wallpapers to this directory, remember to change the num= to the last wallpaper of this directory +1.