• 4 Posts
  • 24 Comments
Joined 8 months ago
cake
Cake day: December 27th, 2023

help-circle




  • Here’s a few of the micro-hacks that I’ve hacked up in the past.

    A 2-line script to chroot into Debian when logging in as a certain user on FreeBSD.
    #!/bin/sh  
    
    clear  
    doas chroot /linux /bin/login
    
    I didn't have an IDE, so I just made a script called ide which runs Vim, and then compiles the code and makes it executable.
    #!/bin/sh
    #Works only for C
    vim $1.c && cc -O3 -Wall -Werror -Wno-unused-result $1.c -o $1
    #MODE=`stat -f "%OLp" $1`
    if ("stat -f "%OLp" $1 | grep -e 6 -e 4 -e 2") then
    	chmod +x $1
    fi
    
    This thing, called demoronize, which does what it says in the comments
    #!/bin/sh
    
    #dos2unix -O -e -s $1 | sed 's/    /	/g' | sed 's/“/"/g' | sed 's/”/"/g'
    cat $1 | sed 's/    /	/g' | sed 's/“/"/g' | sed 's/”/"/g'
    #Convert DOS line endings to Unix ones and add a final newline if there isn't one,
    #replace sequence of 4 spaces with tab,
    #and replace "smart" quotes with normal ones
    

    I just keep those ones for historical value, but there’s one hack I use every day. My keyboard doesn’t have a function key (Fn), so I use the Super/Windows key instead.
    I have xdotool keyup Super_L keyup Super_R keyup F4 key XF86Sleep bound to a custom keyboard shortcut. It unpresses the keys used for the shortcut (Super + F4), then presses the sleep key.















    • Started on a Windows Vista machine, but I dual-booted Mint on it when it started to run slow.
    • The software broke or got corrupted, so I installed Lubuntu.
    • Lubuntu started to freeze, so I installed Mint again.

    The hardware was really outdated at this point, so I got a new machine. Windows 8.1.

    Got a different new computer with Windows 10. Started trying out lots of distros of VMs.

    • Switched out the drive and installed… OpenSUSE, I think?
    • Catastrophic system error during an update, left the system corrupted. I installed Debian.
    • Another system error (which may have been caused by me) led me to install FreeBSD.
    • FreeBSD was usable, but not super usable. I installed OpenSUSE Tumbleweed.
    • Catastrophic system error during an update, left the system corrupted. I installed Debian (again).

    tldr: Windows Vista -> Mint -> Lubuntu -> Mint again -> Windows 8.1 (new computer) -> Windows 10 (new computer) -> OpenSUSE Leap -> Debian -> FreeBSD -> OpenSUSE Tumbleweed -> Debian again