What programing/scripting languages do you use and why?

@Bevo posted an app that does that in the Software thread!

https://apps.ankiweb.net/ - flashcard app for memorising

I have used Anki in the past, and I wasn’t a fan of it. I might have to give it another go though.

I might give it a whirl to learn something or other. We could make a deck of subjects covered here to share with @drumphil! :smiley:

snicker

nevermind

I’m brain dead today. I haven’t updated lately.

20 posts were split to a new topic: emacs / doom / editor group therapy

Came across Gogs for self-hosted Git repos with issue tracker and wiki stuff. UI looks like GitHub. Can run locally, on a Pi or on the cl-somebodyelsescomputer-oud. Uses SQLite otb so it’s easy peasy setup - just download and run (on Linux, haven’t tried Win).

https://gogs.io

Snookoda, how did the assembly tinkering go a while back?

Just killing time today when I should be getting things done, and I ran onto a site called i-programmer.info with a section of book reviews. I remembered my nephew (and a former coworker) wanting to begin learning programming with Python, and I looked through a bunch of beginner Python books for them without ever finding anything worth recommending. I spotted one today in the book review section of i-programmer.info called Hello World!: Computer Programming for Kids and Other Beginners. Looks like a good time for complete beginners that teaches some programming, not just one on a thousand Python books that quickly hurls readers into object-oriented programming by chapter 2.

I noodled for a while, I wrote an extremely small and crappy bare metal text adventure game in asm that booted straight from USB. I did a victory lap after that and dropped it. :slight_smile:

Victory lap deserved nonetheless.

I couldn’t recommend anything along those lines for Python or anything else. I remember watching a video with an experienced dev saying that if they ran a class the first couple wouldn’t have any code in it at all.

Cheers, yeah it’s was nice getting it out of qemu and booting on a real 'pute!

Now you have me curious. What were you running on qemu? I mean, how far did you go with it?

Qemu is more forgiving than actual hardware so I started in that.

You write (mostly copy/pasta) a bootloader and can stay in 16 bit mode or jump into 32 bit “protected” mode or 64 bit. You jump to the address you are loading your actual code to. You can use BIOS calls for I/O in 16 bit mode but do it a different way in 32 bit.

If you’re serious you can have fancy linker scripts and get it ready for grub or whatever but for noodling I didn’t bother. I ended up putting asm instructions to pad out the sections of code to size instead of using a linker script and just joined files together in a bat script.

Is it too early to put in feature requests? :smiley:

Feature requests are always welcome, but never acted upon. :slight_smile:

Patching up some of my very holey BASH’ing while thinking about making an audio playlist script. Field splitting with IFS is interesting here. ‘IFS’ is a shell variable that can use a custom delimiter character and be used with the ‘read’ command and multiple variables to take in a string and split it into fields. Simple example:

#!/bin/bash
# Demonstrates field splitting. '@' is the custom delimiter in this example
echo "Enter url@song@artist@playlist"
IFS=@ read URL SONG ARTIST PLAYLIST
echo $URL
echo $SONG
echo $ARTIST
echo $PLAYLIST

Example string entered at the script prompt:

https://www.youtube.com/watch?v=FFqb1I-hiHE@The Weight@The Band@Feelers

Output of script at commandline:

https://www.youtube.com/watch?v=FFqb1I-hiHE
The Weight
The Band
Feelers

A bash script to ease making playlists from yt-dlp output. If any of you use it, let me know how it might be made better. This is the first draft. Next will be touching it up for Android/Termux.

#!/bin/bash

# ---- What it does ----
# Makes audio playlists from yt-dlp output
# Prompts for youtube url, desired file name, and desired playlist name, all on new lines
# Creates a directory of the same name as the user provided playlist name in MUSIC_DIR
# Grabs the audio and renames it to desired name (suggested name format:  Artist - Song)
# Adds the new file name to the desired .m3u playlist file

# ---- Requirements ----
# Run at your own risk
# Uses yt-dlp (supersedes youtube-dl) to grab audio
# Save this file to whatever file name you like
# Give it executable permission (for linux:  chmod 755 file_name)
# Change value of MUSIC_DIR in line below to your desired playlists directory
MUSIC_DIR="/home/user1/Music/playlists"
# Add this script to your environment PATH to prevent headaches

# ---- Instructions ----
# Run, paste url, and enter
# Provide desired file name and enter (.mp3 is automatically appended)
# Provide desired playlist name and enter

# Get user info
echo -e "*** MUSIC PLAYLISTER ***\n"
echo -e "	Enter: youtube video url, file name, playlist name\n"
read URL
read FILE
read PLAYLIST

clear
cd "$MUSIC_DIR"

# Check for existance of playlist name, creating a new directory if needed
if ! [[ -d "$MUSIC_DIR/$PLAYLIST" ]];then
	mkdir -v "$PLAYLIST"
	cd "$MUSIC_DIR/$PLAYLIST"
fi

cd "$MUSIC_DIR/$PLAYLIST"

# Check for existance of file name, downloading if needed
if ! [[ -f "$MUSIC_DIR/$PLAYLIST/$FILE" ]];then
	yt-dlp -x --audio-format mp3 -o "$FILE".mp3 $URL
fi

# Add file name to playlist, creating new playlist if needed
echo "$FILE".mp3 >> "$PLAYLIST".m3u

I don’t know if you’ve noticed, but yt-dlp can crap out with full urls so sometimes using just the video id is necessary. Might be worth parsing the video string to extract the video id in that case.

I don’t remember that happening to me yet, but I haven’t used yt-dlp (or youtube-dl) a ton, and it’s almost always with a small number of options that I have memorized or via a convenience script. Also, I only ever use the first part of the url ending with the video id. I wonder if it is playlist id’s and options that tend to make it flake out. It wouldn’t hurt to grab the video id only though, or an option while I’m thinking of adding some other options. I was thinking that it would be nice to just drop the url’s, file names, and playlist names in a text file in one go and have the script take that as input. And some way of easier playlist re-ordering. Vim for moving a line I suppose, but that might not be so good on a phone.