[-] machiner@lemmy.org 1 points 3 hours ago

Openbox.

All. Day.

[-] machiner@lemmy.org 1 points 4 hours ago

Every day is Debian day.

[-] machiner@lemmy.org 1 points 4 hours ago

Nothing I could think of readily without some sort of infrastructure support. If you look 'lazy' up in a dictionary you will see my smiling face.

19
submitted 4 hours ago* (last edited 4 hours ago) by machiner@lemmy.org to c/linux@programming.dev

The goal was to be able to have a function to randomly pick a movie for me to watch.

I made a text file with one movie title per line that included random flicks top-of-my-head, adding 10. Then, I went and exported some imdb lists, which was so handy because csv files. So, export one list, open it in calc; highlight, and then copy the title column. Simple. I pasted it into my movies list file.

I did this maybe 7 times which gave me a good sized list of movies - then, I needed to remove duplicates, so, I saved the file and ran this on it:

cat films.txt | sort | uniq > films2.txt

I opened the new file and double entries were stacked so I could go through and delete redundant rows, of which, there weren't very many. Now, I have a file with 1892 lines, each line being a movie title. Handy.

Of course, now, I need to randomly be able to choose a title (line) from the file because I can't be bothered to open the thing and read through it every time I need some inspiration, or, guidance. That's where shuf comes in - look:

shuf -n 1 films.txt

Dayum! And the final step of my goal is to make this available, so, bash alias and keybind.

I added the following to my ~/.bash_aliases file:

alias pick='shuf -n 1 films.txt'

I made a bash script with the following command in it and then bound the script to some keys in rc.xml:

#!/bin/bash
bash -c 'notify-send -i /usr/share/icons/gnome/256x256/emotes/face-glasses.png -t 5000 "Watch this one" "$(shuf -n 1 films.txt)" '

the keybind:

    <keybind key="C-A-p">
      <action name="Execute">
        <command>sh ~/bin/pick.sh</command>
      </action>
    </keybind>

Awesome linux for every day stuff.

machiner

joined 4 hours ago