Powered by RND
PodcastsOnderwijsHacker Public Radio

Hacker Public Radio

Hacker Public Radio
Hacker Public Radio
Nieuwste aflevering

Beschikbare afleveringen

5 van 45
  • HPR4420: The First Doctor, Part 2
    This show has been flagged as Clean by the host. This is a further look at the stories of the First Doctor, portrayed by William Hartnell, during the 1960s Links: https://en.wikipedia.org/wiki/Planet_of_Giants https://en.wikipedia.org/wiki/The_Dalek_Invasion_of_Earth https://en.wikipedia.org/wiki/The_Rescue_(Doctor_Who) https://en.wikipedia.org/wiki/The_Romans_(Doctor_Who) https://en.wikipedia.org/wiki/The_Web_Planet https://en.wikipedia.org/wiki/The_Crusade_(Doctor_Who) https://www.palain.com/science-fiction/intro-to-doctor-who/the-first-doctor-part-2/ Provide feedback on this episode.
    --------  
  • HPR4419: YouTube Subscriptions 2025 #1
    This show has been flagged as Clean by the host. I am subscribed to a number of YouTube channels, and I am sharing them with you. Links: https://www.youtube.com/@2LegsAPaulMcCartneyPodcast https://www.youtube.com/@AdamNeely https://www.youtube.com/@AlReviewsWho https://www.youtube.com/@AlternateHistoryHub https://www.youtube.com/@amawaterways https://www.youtube.com/@theSpaceVixen https://www.youtube.com/channel/UC1AtM-B9YZTSoMcKt1yDieg https://www.youtube.com/@TheRealAndyMcKee https://www.youtube.com/channel/UCxgAH7EcmKhC9bLm7xQ971g https://www.youtube.com/@ApartmentSessions https://www.youtube.com/@arthurc.clarkecenterforhum6745 https://www.youtube.com/@associationofirishcelticfe4447 https://www.palain.com/ Provide feedback on this episode.
    --------  
  • HPR4418: My Desktop Applications
    This show has been flagged as Clean by the host. TuxJam co-host Kevie goes over the desktop applications that he currently uses, January 2025 at the time of recording. These include: Peazip Lutris GIMP Inkscape Tuba Mumble Telegram Calibre PDF Arranger Bluefish Editor Easytag Goodvibes OBS Studio Openshot Reco Audacity Provide feedback on this episode.
    --------  
  • HPR4417: Newest matching file
    This show has been flagged as Explicit by the host. Overview Several years ago I wrote a Bash script to perform a task I need to perform almost every day - find the newest file in a series of files. At this point I was running a camera on a Raspberry Pi which was attached to a window and viewed my back garden. I was taking a picture every 15 minutes, giving them names containing the date and time, and storing them in a directory. It was useful to be able to display the latest picture. Since then, I have found that searching for newest files useful in many contexts: Find the image generated by my random recipe chooser, put in the clipboard and send it to the Telegram channel for my family. Generate a weather report from wttr.in and send it to Matrix. Find the screenshot I just made and put it in the clipboard. Of course, I could just use the same name when writing these various files, rather than accumulating several, but I often want to look back through such collections. If I am concerned about such files accumulating in an unwanted way I write cron scripts which run every day and delete the oldest ones. Original script The first iteration of the script was actually written as a Bash function which was loaded at login time. The function is called newest_matching_file and it takes two arguments: A file glob expression to match the file I am looking for. An optional directory to look for the file. If this is omitted, then the current directory will be used. The first version of this function was a bit awkward since it used a for loop to scan the directory, using the glob pattern to find the file. Since Bash glob pattern searches will return the search pattern when they fail, it was necessary to use the nullglob (see references) option to prevent this, turning it on before the search and off afterwards. This technique was replaced later with a pipeline using the find command. Improved Bash script The version using find is what I will explain here. function newest_matching_file { local glob_pattern=${1-} local dir=${2:-$PWD} # Argument number check if [[ $# -eq 0 || $# -gt 2 ]]; then echo 'Usage: newest_matching_file GLOB_PATTERN [DIR]' >&2 return 1 fi # Check the target directory if [[ ! -d $dir ]]; then echo "Unable to find directory $dir" >&2 return 1 fi local newest_file # shellcheck disable=SC2016 newest_file=$(find "$dir" -maxdepth 1 -name "$glob_pattern" \ -type f -printf "%T@ %p\n" | sort | sed -ne '${s/.\+ //;p}') # Use printf instead of echo in case the file name begins with '-' [[ -n $newest_file ]] && printf '%s\n' "$newest_file" return 0 } The function is in the file newest_matching_file_1.sh , and it's loaded ("sourced", or declared) like this: . newest_matching_file_1.sh The '.' is a short-hand version of the command source . I actually have two versions of this function, with the second one using a regular expression, which the find command is able to search with, but I prefer this one. Explanation The first two lines beginning with local define variables local to the function holding the arguments. The first, glob_pattern is expected to contain something like screenshot_2025-04-*.png . The second will hold the directory to be scanned, or if omitted, will be set to the current directory. Next, an if statement checks that there are the right number of arguments, aborting if not. Note that the echo command writes to STDERR (using '>&2' ), the error channel. Another if statement checks that the target directory actually exists, and aborts if not. Another local variable newest_file is defined. It's good practice not to create global variables in functions since they will "leak" into the calling environment. The variable newest_file is set to the result of a command substitution containing a pipeline: The find command searches the target directory. Using -maxdepth 1 limits the search to the chosen directory and does not descend into sub-directories. The search pattern is defined by -name "$glob_pattern" Using -type f limits the search to files The -printf "%T@ %p\n" argument returns the file's last modification time as the number of seconds since the Unix epoch '%T@' . This is a number which is larger if the file is older. This is followed, after a space, by the full path to the file ( '%p' ), and a newline. The matching file names are sorted. Because each is preceded by a numeric time value, they will be sorted in ascending order of age. Finally sed is used to return the last file in the sorted list with the program '${s/.\+ //;p}' : The use of the -n option ensures that only lines which are explicitly printed will be shown. The sed program looks for the last line (using '$' ). When found the leading numeric time is removed with ' s/.\+ //' and the result is printed (with 'p' ). The end result will either be the path to the newest file or nothing (because there was no match). The expression '[[ -n $newest_file ]]' will be true if $newest_file variable is not empty, and if that is the case, the contents of the variable will be printed on STDOUT, otherwise nothing will be printed. Note that the script returns 1 (false) if there is a failure, and 0 (true) if all is well. A null return is regarded as success. Script update While editing the audio for this show I realised that there is a flaw in the Bash function newest_matching_file . This is in the sed script used to process the output from find . The sed commands used in the script delete all characters up to a space, assuming that this is the only space in the last line. However, if the file name itself contains spaces, this will not work because regular expressions in sed are greedy . What is deleted in this case is everything up to and including the last space. I created a directory called tests and added the following files: 'File 1 with spaces.txt' 'File 2 with spaces.txt' 'File 3 with spaces.txt' I then ran the find command as follows: $ find tests -maxdepth 1 -name 'File*' -type f -printf "%T@ %p\n" | sort | sed -ne '${s/.\+ //;p}' spaces.txt I adjusted the sed call to sed -ne '${s/[^ ]\+ //;p}' . This uses the regular expression: s/[^ ]\+ // This now specifies that what it to be removed is every non-space up to and including the first space. The result is: $ find tests -maxdepth 1 -name 'File*' -type f -printf "%T@ %p\n" | sort | sed -ne '${s/[^ ]\+ //;p}' tests/File 3 with spaces.txt This change has been propagated to the copy on GitLab . Usage This function is designed to be used in commands or other scripts. For example, I have an alias defined as follows: alias copy_screenshot="xclip -selection clipboard -t image/png -i \$(newest_matching_file 'Screenshot_*.png' ~/Pictures/Screenshots/)" This uses xclip to load the latest screenshot into the clipboard, so I can paste it into a social media client for example. Perl alternative During the history of this family of scripts I wrote a Perl version. This was originally because the Bash function gave problems when run under the Bourne shell, and I was using pdmenu a lot which internally runs scripts under that shell. #!/usr/bin/env perl use v5.40; use open ':std', ':encoding(UTF-8)'; # Make all IO UTF-8 use Cwd; use File::Find::Rule; # # Script name # ( my $PROG = $0 ) =~ s|.*/||mx; # # Use a regular expression rather than a glob pattern # my $regex = shift; # # Get the directory to search, defaulting to the current one # my $dir = shift // getcwd(); # # Have to have the regular expression # die "Usage: $PROG regex [DIR]\n" unless $regex; # # Collect all the files in the target directory without recursing. Include the # path and let the caller remove it if they want. # my @files = File::Find::Rule->file() ->name(qr/$regex/) ->maxdepth(1) ->in($dir); die "Unsuccessful search\n" unless @files; # # Sort the files by ascending modification time, youngest first # @files = sort {-M($a) <=> -M($b)} @files; # # Report the one which sorted first # say $files[0]; exit; Explanation This is fairly straightforward Perl script, run out of an executable file with a shebang line at the start indicating what is to be used to run it - perl . The preamble defines the Perl version to use, and indicates that UTF-8 (character sets like Unicode) will be acceptable for reading and writing. Two modules are required: Cwd : provides functions for determining the pathname of the current working directory. File::Find::Rule : provides tools for searching the file system (similar to the find command, but with more features). Next the variable $PROG is set to the name under which the script has been invoked. This is useful when giving a brief summary of usage. The first argument is then collected (with shift ) and placed into the variable $regex . The second argument is optional, but if omitted, is set to the current working directory. We see the use of shift again, but if this returns nothing (is undefined), the '//' operator invokes the getcwd() function to get the current working directory. If the $regex variable is not defined, then die is called to terminate the script with an error message. The search itself is invoked using File::Find::Rule and the results are added to the array @files . The multi-line call shows several methods being called in a "chain" to define the rules and invoke the search: file() : sets up a file search name(qr/$regex/) : a rule which applies a regular expression match to each file name, rejecting any that do not match maxdepth(1) : a rule which prevents the search from descending below the top level into sub-directories in($dir) : defines the directory to search (and also begins the search) If the search returns no files (the array is empty), the script ends with an error message. Otherwise the @files array is sorted. This is done by comparing modification times of the files, with the array being reordered such that the "youngest" (newest) file is sorted first. The <=> operator checks if the value of the left operand is greater than the value of the right operand, and if yes then the condition becomes true. This operator is most useful in the Perl sort function. Finally, the newest file is reported. Usage This script can be used in almost the same way as the Bash variant. The difference is that the pattern used to match files is a Perl regular expression. I keep this script in my ~/bin directory, so it can be invoked just by typing its name. I also maintain a symlink called nmf to save typing! The above example, using the Perl version, would be: alias copy_screenshot="xclip -selection clipboard -t image/png -i \$(nmf 'Screenshot_.*\.png' ~/Pictures/Screenshots/)" In regular expressions '.*' means "any character zero or more times". The '.' in '.png' is escaped because we need an actual dot character. Conclusion The approach in both cases is fairly simple. Files matching a pattern are accumulated, in the Bash case including the modification time. The files are sorted by modification time and the one with the lowest time is the answer. The Bash version has to remove the modification time before printing. This algorithm could be written in many ways. I will probably try rewriting it in other languages in the future, to see which one I think is best. References Glob expansion: Wikipedia article on glob patterns HPR shows covering glob expansion: Finishing off the subject of expansion in Bash (part 1) Finishing off the subject of expansion in Bash (part 2) GitLab repository holding these files: hprmisc - Miscellaneous scripts, notes, etc pertaining to HPR episodes which I have contributed Provide feedback on this episode.
    --------  
  • HPR4416: HPR Community News for June 2025
    This show has been flagged as Explicit by the host. New hosts There were no new hosts this month. Last Month's Shows Id Day Date Title Host 4391 Mon 2025-06-02 HPR Community News for May 2025 HPR Volunteers 4392 Tue 2025-06-03 The Water is Wide, and the sheet music should be too Jezra 4393 Wed 2025-06-04 Journal like you mean it. Some Guy On The Internet 4394 Thu 2025-06-05 Digital Steganography Intro mightbemike 4395 Fri 2025-06-06 Second Life Lee 4396 Mon 2025-06-09 AI and Sangria operat0r 4397 Tue 2025-06-10 Transfer files from desktop to phone with qrcp Klaatu 4398 Wed 2025-06-11 Command line fun: downloading a podcast Kevie 4399 Thu 2025-06-12 gpg-gen-key oxo 4400 Fri 2025-06-13 Isaac Asimov: Other Asimov Novels of Interest Ahuka 4401 Mon 2025-06-16 hajime oxo 4402 Tue 2025-06-17 pinetab2 Brian in Ohio 4403 Wed 2025-06-18 How to get your very own copy of the HPR database norrist 4404 Thu 2025-06-19 Kevie nerd snipes Ken by grepping xml Ken Fallon 4405 Fri 2025-06-20 What did I do at work today? Lee 4406 Mon 2025-06-23 SVG Files: Cyber Threat Hidden in Images ko3moc 4407 Tue 2025-06-24 A 're-response' Bash script Dave Morriss 4408 Wed 2025-06-25 Lynx - Old School Browsing Kevie 4409 Thu 2025-06-26 H D R Ridiculous Monitor operat0r 4410 Fri 2025-06-27 Civilization V Ahuka 4411 Mon 2025-06-30 The Pachli project thelovebug Comments this month These are comments which have been made during the past month, either to shows released during the month or to past shows. There are 29 comments in total. Past shows There are 4 comments on 3 previous shows: hpr4375 (2025-05-09) "Long Chain Carbons,Eggs and Dorodango?" by operat0r. Comment 4: Torin Doyle on 2025-06-06: "Reply to @Bob" hpr4378 (2025-05-14) "SQL to get the next_free_slot" by norrist. Comment 1: Torin Doyle on 2025-06-12: "Cheers for this." hpr4388 (2025-05-28) "BSD Overview" by norrist. Comment 4: Henrik Hemrin on 2025-06-02: "Learned more about BSD." Comment 5: norrist on 2025-06-02: "Additional info for OpenBSD Router" This month's shows There are 25 comments on 10 of this month's shows: hpr4391 (2025-06-02) "HPR Community News for May 2025" by HPR Volunteers. Comment 1: Torin Doyle on 2025-06-06: "Very disappointed."Comment 2: Ken Fallon on 2025-06-06: "Thanks for your feedback."Comment 3: Torin Doyle on 2025-06-09: "Reply to Ken [Comment 2]"Comment 4: norrist on 2025-06-09: "Watch the Queue for a show about how to find all the comments"Comment 5: Torin Doyle on 2025-06-10: "Comment #3 typo."Comment 6: Torin Doyle on 2025-06-11: "Reply to Comment #4 by norrist"Comment 7: Torin Doyle on 2025-06-11: "Got the link." hpr4394 (2025-06-05) "Digital Steganography Intro" by mightbemike. Comment 1: Henrik Hemrin on 2025-06-05: "Fascinating topic"Comment 2: oxo on 2025-06-05: "Good show! " hpr4395 (2025-06-06) "Second Life" by Lee. Comment 1: Antoine on 2025-06-08: "Brings philosophical thoughts" hpr4397 (2025-06-10) "Transfer files from desktop to phone with qrcp" by Klaatu. Comment 1: Laindir on 2025-06-18: "The perfect kind of recommendation" hpr4398 (2025-06-11) "Command line fun: downloading a podcast" by Kevie. Comment 1: Henrik Hemrin on 2025-06-11: "Tempted to have fun"Comment 2: Ken Fallon on 2025-06-22: "Personal message to redhat (nprfan)" hpr4403 (2025-06-18) "How to get your very own copy of the HPR database" by norrist. Comment 1: Torin Doyle on 2025-06-18: "Appreciated!"Comment 2: Torin Doyle on 2025-06-18: "Database size."Comment 3: norrist on 2025-06-18: "Also an SQLite version"Comment 4: Torin Doyle on 2025-06-25: "Not able to use database to find my comments." hpr4404 (2025-06-19) "Kevie nerd snipes Ken by grepping xml" by Ken Fallon. Comment 1: Henrik Hemrin on 2025-06-22: "More to digest"Comment 2: Alec Bickerton on 2025-06-29: "Shorter version"Comment 3: Alec Bickerton on 2025-06-29: "Shorter version"Comment 4: Alec Bickerton on 2025-06-29: "XML parsing without xmlstarlet" hpr4405 (2025-06-20) "What did I do at work today?" by Lee. Comment 1: Dave Morriss on 2025-06-25: "Thanks for bringing us along..." hpr4406 (2025-06-23) "SVG Files: Cyber Threat Hidden in Images" by ko3moc. Comment 1: oxo on 2025-06-23: "Interesting! "Comment 2: ko3moc on 2025-06-24: "response " hpr4408 (2025-06-25) "Lynx - Old School Browsing" by Kevie. Comment 1: Henrik Hemrin on 2025-06-29: "Review ALT texts" Mailing List discussions Policy decisions surrounding HPR are taken by the community as a whole. This discussion takes place on the Mailing List which is open to all HPR listeners and contributors. The discussions are open and available on the HPR server under Mailman. The threaded discussions this month can be found here: https://lists.hackerpublicradio.com/pipermail/hpr/2025-June/thread.html Events Calendar With the kind permission of LWN.net we are linking to The LWN.net Community Calendar. Quoting the site: This is the LWN.net community event calendar, where we track events of interest to people using and developing Linux and free software. Clicking on individual events will take you to the appropriate web page. Provide feedback on this episode.
    --------  

Meer Onderwijs podcasts

Over Hacker Public Radio

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.
Podcast website

Luister naar Hacker Public Radio, Keuringsdienst van Waarde en vele andere podcasts van over de hele wereld met de radio.net-app

Ontvang de gratis radio.net app

  • Zenders en podcasts om te bookmarken
  • Streamen via Wi-Fi of Bluetooth
  • Ondersteunt Carplay & Android Auto
  • Veel andere app-functies
Social
v7.20.2 | © 2007-2025 radio.de GmbH
Generated: 7/11/2025 - 12:57:38 AM