Hacker Public Radio Hacker Public Radio
-
- Technology
-
Hacker Public Radio is an podcast that releases shows every weekday Monday through Friday. Our shows are produced by the community (you) and can be on any topic that are of interest to hackers and hobbyists.
-
HPR4115: Tagging music with Beets
References
Beets documentation
Album art in Funkwhale (after recording I noticed it can also look up album art during import, using the musicbrainz ID. Not 100% sure beets adds it, but I might assume so)
Recommended opus bitrates
Pronunciation of the word "archivist"
MusicBrainz
Everything you need to know about Funkwhale -
HPR4114: Introduction to jq - part 2
Overview
In the last
episode we looked at how JSON data is structured and saw how
jq could be used to format and print this type of data.
In this episode we'll visit a few of the options to the
jq command and then start on the filters written in the
jq language.
Options used by jq
In general the jq command is invoked thus:
jq [options...] filter [files...]
It can be given data in files or sent to it via the STDIN (standard
in) channel. We saw data being sent this way in the last episode, having
been downloaded by curl.
There are many options to the command, and these are listed in the
manual page and in the online manual. We will
look at a few of them here:
--help or -h
Output the jq help and exit with zero.
-f filename or
--from-file filename
Read filter from the file rather than from a command line, like awk´s
-f option. You can also use ´#´ to make comments in the file.
--compact-output or -c
By default, jq pretty-prints JSON output. Using this
option will result in more compact output by instead putting each JSON
object on a single line.
--color-output or -C and
--monochrome-output or -M
By default, jq outputs colored JSON if writing to a
terminal. You can force it to produce color even if writing to a pipe or
a file using -C, and disable color with
-M.
--tab
Use a tab for each indentation level instead of two spaces.
--indent n
Use the given number of spaces (no more than 7) for indentation.
Notes
The -C option is useful when printing output to the
less command with the colours that jq normally
generates. Use this:
jq -C '.' file.json | less -R
The -R option to less allows colour escape sequences to
pass through.
Do not do what I did recently. Accidentally leaving the
-C option on the command caused formatted.json
to contain all the escape codes used to colour the output:
$ jq -C '.' file.json > formatted.json
This is why jq normally only generates coloured output
when writing to the terminal.
Filters in jq
As we saw in the last episode JSON can contain arrays and objects.
Arrays are enclosed in square brackets and their elements can be any of
the data types we saw last time. So, arrays of arrays, arrays of
objects, and arrays of both of these are all possible.
Objects contain collections of keyed items where the keys are strings
of various types and the values they are associated with can be any of
the data types.
JSON Examples
Simple arrays:
[1,2,3]
[1,2,3,[4,5,6]]
["Hacker","Public","Radio"]
["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]
Simple object:
{ "name": "Hacker Public Radio", "type": "podcast"}
This more complex object was generated by the Random User Generator
API. -
HPR4113: Today I Learnt, sed hold/pattern space use.
Today I Learnt, sed
hold/pattern space use.
Sgoti talks
about using sed hold/pattern spaces.
Tags: TIL, sed
I
fixed the ${ls} /usr/bin to ${ls} ${bindir}
issue mentioned in the show.
#!/bin/bash
# License: GPL v3
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
#Name: grab-bin.sh
#Purpose: Link your binaries.
#Version: beta 0.07
#Author: SGOTI (Some Guy On The Internet)
#Date: 2023-12-17
#variables:
bindir=/usr/bin/
awk=${bindir}awk
cat=${bindir}cat
chmod=${bindir}chmod
date=${bindir}date
echo=${bindir}echo
find=${bindir}find
ls=${bindir}ls
mktemp=${bindir}mktemp
sed=${bindir}sed
uniq=${bindir}uniq
#start:
${echo} -e "nStep 0: $(${date} +%F), $(${date} +%T)";
# Create the /tmp/ directory to place the files.
function mkt (){
if [ -d /tmp/$(${date} +%F).* ]; then
tmpdir1=$(ls -d /tmp/$(${date} +%F).*)
${echo} -e "The directory already exists.n${tmpdir1}"
else
tmpdir0=$(${mktemp} -d /tmp/$(${date} +%F).XXXXXXXX)
tmpdir1=${tmpdir0}
${find} "${tmpdir1}" -type d -exec ${chmod} -R =700 {} +;
${echo} "Had to create ${tmpdir1}"
fi
}
mkt
${echo} -e "nStep 1: $(${date} +%F), $(${date} +%T)";
# Files created by this script.
tmpdoc0=${tmpdir1}/$(${date} +%Y%m%d)variables.txt
tmpdoc1=${tmpdir1}/$(${date} +%Y%m%d)bash.vim
tmpdoc2=${tmpdir1}/$(${date} +%Y%m%d)sed-script.sed
# Here-document to build the first document (variables.txt).
${cat} > ${tmpdoc0} > ${tmpdoc0}
${sed} -i '/[/d' ${tmpdoc0}
${echo} -e "nStep 2: $(${date} +%F), $(${date} +%T)";
# Bash.vim here-document.
${cat} > ${tmpdoc1} [yY])
${echo} 'User said, "Yes"';
;;
[nN])
${echo} 'User said, "No"';
;;
[qQ])
${echo} "Let's get outta here.";
exit
;;
*)
${echo} "Good Heavens! Someone broke the script I'm writing.";
exit
;;
esac
iabbr here; ${cat} _EOD_2k0
iabbr func function NAME () {}
iabbr if; if []; thenIelse${echo} "Good Heavens!"Ifi4k0A
iabbr ali; alias NAME=''B
iabbr ; ()
EOL1
# bash.vim body.
${ls} -1 ${bindir}
| ${sed} -n ' {
h
s/[^0-9a-zA-Z]//g
G
s/n/ /
s/(.*) (.*)/iabbr 1 ${2}/p
}
' >> ${tmpdoc1}
# Bash.vim here-document second pass.
${cat} >> ${tmpdoc1}
EOL1-5
# bash.vim body second pass.
${ls} -1 ${bindir}
| ${sed} -n ' {
h
s/[^0-9a-zA-Z]//g
G
s/n/ /
s/(.*) (.*)/1=${bindir}2/p
}
' >> ${ -
HPR4112: JSON and VENDORS and AUTH ohh my!
Some stuff I use to help make APIs
https://github.com/freeload101/Python/blob/master/Python_Includes_RMcCurdy.py
JAMBOREE.rmccurdy.com for burp suite. Have I done a podcast on
JAMBOREE? I must have... If not I will -
HPR4111: HPR Community News for April 2024
table td.shrink {
white-space:nowrap
}
hr.thin {
border: 0;
height: 0;
border-top: 1px solid rgba(0, 0, 0, 0.1);
border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}
New hosts
Welcome to our new host:
Dave Hingley.
Last Month's Shows
Id
Day
Date
Title
Host
4086
Mon
2024-04-01
HPR Community News for March 2024
HPR Volunteers
4087
Tue
2024-04-02
Getting started with the digiKam photo management software
Henrik Hemrin
4088
Wed
2024-04-03
Today I Learnt more Bash tips
Some Guy On The Internet
4089
Thu
2024-04-04
Modifying a Python script with some help from ChatGPT
MrX
4090
Fri
2024-04-05
Playing Civilization III, Part 1
Ahuka
4091
Mon
2024-04-08
Test Driven Development Demo
norrist
4092
Tue
2024-04-09
More man-talk.
Some Guy On The Internet
4093
Wed
2024-04-10
Installing postmarketOS on a PINE64 PinePhone
Claudio Miranda
4094
Thu
2024-04-11 -
HPR4110: Playing Civilization III, Part 2
This starts our look at the details of playing Civilization III. In
this episode we look at the Early game, which sets the stage for
everything that follows. Then we look at Revenue and Resources.
Links:
https://civilization.fandom.com/wiki/List_of_resources_in_Civ3
https://www.palain.com/gaming/civilization-iii/playing-civilization-iii-part-2/
Customer Reviews
Love this idea
Keep it up
This is real Open Source
With a different host every day, you get people's once every few month bit of tech awesomeness every day, not oh no we have to do a show, let's throw something together. Great job on this show community. Way to go open source podcasting.
Mixed bag, at best
Some of it is moderately interesting from time to time. But after just listening to a guy (probably drunkenly,) ramble about installing an SSD and 16 gigs of RAM into a decade old MacBook for 18 minutes straight, I can't recommend. (Real hacker stuff, that...) There's plenty of better podcasts that are more consistent and technology-focused out there.