Hacker Public Radio

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.

Episodes

  1. 4 hr ago

    HPR4673: First contact conversation

    This show has been flagged as Clean by the host. Hello, this is your host, Archer72 for another episode of Hacker Public radio. In this episode, I make my first contact off a local repeater in a small town in Kentucky. What got me to try my hand at radio? It was when I started to capture ISS (International Space Station) Ham radio transmissions. From Kentucky, I have logged receiving from Texas and Oregon and as far as a brief transmission over Great Britain. My next step was to have a first contact, which I botched at first when I said my call sign, and didn’t leave enough time for someone to respond. I thought that a repeater was the best place to start, so found this one on RepeaterBook.com The repeater was found in RepeaterBook at RepeaterBook : My local Cynthiana, Kentucky repeater Youtube : Harrison County Amateur Radio Club QRZ : Harrison County Amateur Radio Club Facebook : Harrison County Amateur Radio Club The callsign for this repeater is Kilo-Four-Kilo-Juliett-Quebec It is currently On Air (and quite active near club time and the weekend) The base frequency is 147.165 MHz with an offset of plus (+) 600 KHz and a tone to open the repeater, of 67.0 Hz It is hosted by the Bluegrass Amateur Radio Society The RepeaterBook entry was updated on 2025-10-27 K4KJQ On-Air Open 147.16500 (+) MHz 67.0 Cynthiana • Harrison County • Kentucky Updated 2025-10-27 Technical Downlink 147.16500 Uplink 147.76500 Offset +0.600 Uplink Tone 67.0 Downlink Tone 67.0 Antenna (AGL) 125 feet Sponsor: Bluegrass Amateur Radio Society Sponsor: BARS Local Time 04:30 (EDT UTC-04:00 DST) America/New_York Reviewed 2025-10-27 Bluegrass Amateur Radio Society RepeaterBook Worldwide RepeaterBook is a worldwide amateur radio repeater directory So, with after all that being said I programmed a Baofeng BF-F8HP to this frequency manually. You can also use open source Chirp software, but I wanted to know my radio to program it on the fly. This brings me to a recording with permission from Keith (KO4BWJ) who is located outside this little A notable feature of this the town of Cynthiana, Kentucky is the hometown of the artist Robert Kirkman for the Television series The Walking Dead, and home to the mural depicting the main characters of the show. This mural had some controversy over the rights to have it depicted, or so I thought. The actual story is story is that some groups did not want a Zombie theme representing their town. Cynthiana, Kentucky: Walking Dead Mural Without further delay, here is the promised recording. … I hope you enjoyed and learned from this little piece of an experience Ham vs a new (to the airwaves) Ham. This has been Archer72 (Kilo-Delta-Niner-Victor-Mike-Whiskey) 73 Provide feedback on this episode.

  2. 2 days ago

    HPR4671: Protocal AI

    This show has been flagged as Explicit by the host. In this episode, Operator dives into his ongoing journey to migrate away from centralized cloud ecosystems specifically moving his daily workflow off Google Keep and onto Obsidian hosted locally on a Debian server. Operating purely over a secure VPN to minimize his external attack surface, he discusses the security considerations of managing personal data in local plain-text markdown files. The episode features a deep dive into local AI infrastructure, sparked by technologist Daniel Miessler’s recent shift away from RAG (Retrieval-Augmented Generation) in favor of a simpler, localized file-system-as-context approach (using fast search tools like ripgrep). Operator shares his own mixed results experimenting with RAG noting great success with massive, structured car repair manuals, but incredibly poor fidelity when indexing conversational podcast transcripts. To find the sweet spot, Operator is testing a dual approach : combining flat-file local search with a PostgreSQL vector database ( pgvector ). He also rants about the frustrating "hype cycle" of online tutorials that claim to teach "local" setups but secretly rely on expensive, cloud-hosted frontier models. Finally, the host introduces his ambitious roadmap for "Protocol AI." Designed as a localized, read-only dashboard to help manage his ADHD and "time blindness," this system will scrape, aggregate, and summarize his cluttered digital life including multiple Gmail accounts, Yahoo spam, calendars, and a massive array of social media feeds (Signal, Discord, Mastodon, BlueSky). The long-term goal? Transitioning from a read-only local summarizer to a safe, "human-in-the-loop" execution assistant that keeps his data out of the hands of mega-corporations. References Obsidian is a proprietary personal knowledge base and note-taking application that operates on Markdown files. The software is free for personal and commercial use; only the offered cloud services, optional commercial licenses, and early access versions are paid. It is available as desktop versions for macOS, Windows and Linux as well as for mobile operating systems such as iOS and Android, but not as a web application. Obsidian - From Wikipedia, the free encyclopedia Retrieval-augmented generation (RAG) is a technique that enables large language models (LLMs) to retrieve and incorporate new information from external data sources. With RAG, LLMs first refer to a specified set of documents, then respond to user queries. These documents supplement information from the LLM's pre-existing training data. This allows LLMs to use domain-specific and/or updated information that is not available in the training data. For example, this enables LLM-based chatbots to access internal company data or generate responses based on authoritative sources. RAG (Retrieval-Augmented Generation) Provide feedback on this episode.

  3. 5 days ago

    HPR4670: Playing Civilization V, Part 13

    This show has been flagged as Clean by the host. In our sample game we look at playing as Austria and aiming for a Diplomatic Victory. And our focus is on puppeting City-States, but I misunderstood and instead of making a Diplomatic Victory easier, it makes it harder. I still managed to get my Diplomatic Victory, but a Science or Domination Victory would definitely have been easier in this scenario. Playing Civilization V, Part 13 Playing for a Diplomatic Victory, Part 2 So, how do you solve a Happiness problem? For a full discussion, you can check out this section of the Civilization Wiki. In Civilization V you have these options: Trade for luxuries – Luxury resources are the best way to get a quick hit of Happiness, and trade is the best way to do this quickly. But to trade you have to have met the other civ, so my drive to explore pays off here. Every luxury resource I can obtain adds +4 Global Happiness to my Empire. Note that only the first unit of the resources adds happiness. So if you have multiple copies of a luxury resource you should keep one and trade the others if you can. Buildings – Buildings like the Circus (+2), Colosseum (+2), Zoo (+2), and Stadium (+4) provide local happiness in the city that builds them. That still gets added to your total happiness number, but local happiness can never exceed the size of the population. So if you have a city with 5 population, building a Circus and a Colosseum might make sense, but building a Circus and a Stadium would not since 2 of the Happiness would not count. Buildings take longer than Trade deals, so if you need a quick hit start with trading for Luxuries. Wonders – Chichen Itza (+4), Notre Dame (+10), Taj Mahal (+4), Eiffel Tower (+5), Neuschwanstein (+1 for every Castle you have), Prora (+1, plus +1 for every 2 Social Policies you have adopted), and CN Tower (+1 per city). Wonders are even harder to build, and you may not get them since you are competing with other players. But there is a National Wonder worth getting, the Circus Maximus (+5) Social Policies – Every policy tree has policies that can add to Happiness or decrease Unhappiness, which is just as good. Natural Wonders – Each Natural Wonder grants +1 Global Happiness to each empire that has discovered it. So again exploration is key. Mercantile City States grant +3 Global Happiness to each Empire that is at least Friends with it. So you have a lot of options here, and they are listed in order of how you should pursue them. Trading for Luxury Resources can be done quickly and provide an immediate boost, so you should be actively trading all along. Buildings and Wonders should definitely be pursued, but here you will probably be balancing demands for other investments as well. Natural Wonders are nice, but you need to explore the whole map to max that out. I was able to trade one of my Whales to Patchacuti for one of his Ivory, which helped push my happiness up. Then with Askia I traded one Spice for one Copper. I also made a small gift to the City-State of Manila to make them my ally. Once 5 turns have elapsed, I can take them over via Diplomatic Marriage. And I have started on Colosseums in several of my cities to push up my Happiness further. Meanwhile I continued my exporations, and became the first to discover all of the the other Empires in the game. This makes me the host for the World Council, which is good for one additional vote. I will keep exploring since there are probably some Natural Wonders out there worth finding yet. And indeed on the next turn I found Mount Fuji, pushing my Happiness to 24. Then I Puppeted Manilaa, and over a couple of turns it dropped to 18. But a Colosseum got built, and I found a Natural Wonder,so I am back to 21. I am not the leader in this game, and I think I can afford to Puppet another City-State. For now I am avoiding doing this to Mercantile City-States since they can add to my Happiness. But there’s lots of City-States in this game. I picked Kathmandu for my next target, but also dropped 250 on Ragusa to become Friends with them. You have to look to the future sometimes. I am currently pulling in 144 Gold per turn, so I can afford it. At turn 267 my Happiness was up to 30, but as soon as I puppeted Kathmandu it dropped to 22. This is why you need to manage your Happiness carefully. This pushed me another 100 points up on the Leader board, so I am in good shape. But with 22 Happiness, I can probably afford to start on puppeting Ragusa. At turn 272 I have 5766 Gold, and I am earninig 163 Gold per turn. My Happiness is at 27, so I am in good shape. I puppet Ragusa, and my Happiness falls to 18, but my status on the leader board goes up another 100 points, putting me 200 ahead of my nearest competitor. But a few turns later and my Happiness is back up to 24, so I am starting the process to puppet Bucharest. At turn 280 I have 6584 Gold, I am earning 179 per turn, and my Happiness is 26. Then I puppet Bucharest, and my Happiness drops to 16. But I am nearly 300 ahead of my nearest competitor on the leader board, so not bad. Also, we are getting near to the first World Council, where I am the host. I have put a proposal on the agenda to enact a World’s Fair. The number 2 player has put a proposal on the ban Whales as a luxury resource, and I have a lot of whale resources. I suspect the World’s Fair will pass without my votes since many other players supported it, so I will put my votes into denying the Whale ban. We’ll see how it goes. I have the most votes, but if everyone else gangs up on me they can get it passed. And as I expected, the World’s Fair passed without my votes, and the Whale ban was defeated. I tabled a proposal to enact Arts Funding for the next Council. It looks to be very popular. Right now I starting to snowball. On turn 287 I now have 6476 Gold, and I am earning 231 each turn. I have puppeted 6 City-States, and my Happiness is at 31. I can now start to puppet another. In the World Council I have 4 votes, and every other player has 1. My main strategy right now is to keep on friendly terms with the other players since everything is going well. But I am also starting to build factories to improve my Production capacity, which in turn wil let me update my Military. I picked up a Great Scientist, and used him to construct an Academy to boost my Science output. And every city next to a mountain has gotten an Observatory for added science . And then I constructed the Leaning Tower of Pisa and got one free Great Person of my choice, and I chose a Great Scientist and constructed another academy. And I hit a Golden Age good for 10 turns. My Golden Age ended, but on the next turn I finished the Taj Mahal which gave me another 10 turn Golden Age, in addition to =4 Global Happiness. And I used some of my big cash balance to upgrade my military units, because in this game the best way to keep the peace is to have a strong military. Then on the next turn I was able to choose an ideology, so I picked Freedom, and for my two policies I chose Universal Healthcare and Capitalism, each of which added Happiness. I have earned a couple of Great Artists, and I plan to use them to create more Golden Ages since accumulating Culture is not part of my strategy. On turn 309 I puppeted Bratislava and started on Wittenberg. And now that I have expxlored the entire map I don’t need my Caravels any longer, so I deleted them. then on turn 314 my closest competitor, Japan, denounced me, and was in turn denounced by Brazil. I have been building up my military, so I am not worried. Basically, Japan has realized I am opening up a bigger lead, and that is why they denounced me. I’d like to win without going to war, but if he attacks me I can handle it. Meanwhile, I am also building up my Science to open up a lead there. On the next turn I built the Red Fort, which improves my defensive strength. Brazil approached me to join in a war on Japan, but I declined. I am not seeking a military victory in this game, so I don’t want to be distracted. However I just puppeted two more cities, and looking at the map I now have 3 cities on the border of Japan. So maybe there will be a war in my future. I got another policy to choose, and picked Universal Suffrage, which increases the length of Golden Ages, since I plan a few. And I am starting to build more military units, starting with riflemen which are good for defending cities. If I am given time I will ship them to my puppeted cities near Japan. But if he attackes me before then, they are still worth having. Links https://civilization.fandom.com/wiki/Happiness_(Civ5) https://www.palain.com/gaming/civilization-v/playing-civilization-v-part-13/ Provide feedback on this episode.

  4. 24 Jun

    HPR4668: Nuclear Power Technology Follow Up on Safety

    This show has been flagged as Clean by the host. -------------------- 01 Introduction This is the second follow up to my 8 part series on nuclear power. In this episode I will attempt to answer a question posed by brian in ohio in a comment on HPR4583. In that comment he said: 02 -------------------- Loving this series. Maybe Whiskey Jack could give some cost comparisons between large and small reactors. He could also give us a realistic look at nuclear plant safety/accidents compared to conventional power production. Looking forward to the episode on FORTH generation reactors ;-) -------------------- 03 End of quote. The first question I answered in my previous follow up, which was HPR4628. In this episode I will attempt to answer the second question, which was about the safety of nuclear power compared to other sources of electrical power generation. One of the HPR janitors encouraged me to make this episode, so I think we can thank him for getting another HPR episode made. 04 Defining the Scope First, let's define the scope of the question. This will cover electrical power generation only. Within that scope I will consider only the following sources of energy. 05 Coal Oil Natural Gas Hydroelectric Nuclear Wind Solar I won't cover geothermal, wave, or tidal power as these are only used in very small amounts and so there simply isn't enough literature on them to base a discussion on . 06 Foreshadow Conclusion I should mention right away that I cannot provide absolute answers to this question in the form of a nice, neat ranking table based on numbers from peer reviewed scientific sources. The reasons for this will become apparent, but to put it briefly, the data on which to base such a ranking simply doesn't exist. I will however provide context within which people can think about the issue. Wherever possible, I will provide links to the references that I used in the show notes so you can read further on this yourself. -------------------- 07 Energy Catastrophism versus Energy Uniformitarianism First though I need to go off on a slight geological detour in order to explain an important analogy that I will use. 08 In the 19th century there was a great debate among geologists over what is known as catastrophism versus uniformitarianism. In seeking to explain the origins of the earth and of the landscape that we see around us, there were two points of view. 09 One was "catastrophism". This is the belief that the mountains, valleys, and plains that we see around us were formed as a result of great catastrophes which occurred relatively recently in earth's history. This explanation was necessary in order to fit geological features into an earth that was believed to be only a few thousands of years old. This view was heavily influenced by religious belief. In this view Noah's flood was the great catastrophe and the fossils of dinosaurs were the remains of animals who had not been saved on the ark and so had died in the flood. 10 The other point of view was uniformitarianism. This was the hypothesis that the landscape we see around us can be explained by the very slow accumulation of very small changes over very long periods of time. For this to be true however, the earth had to be far older than the few thousand years that a literal reading of the bible would suggest. The earth in fact had to be many, many, millions of years old. 11 Eventually, the uniformitarian view won out and people understood that while some catastrophes can take place, the shape of the landscape is overwhelmingly due to small changes over very long periods of time. 12 How is this Relevant to this Episode You Ask? How this is relevant is that I will use this analogy to explain how we need to think about energy and safety. Very small numbers of deaths and injuries multiplied over many occurrences can add up to big numbers, comparable in scale or possibly even larger than a single catastrophe or even several of them. 13 I don't know if anyone else has used this analogy before, I have just thought of this when writing the script for this podcast. None the less, I think it is a very useful way of helping to understand the issues. 14 As an example of this, think about the well known case of the safety of flying versus the safety of travelling in your car. Air crashes are catastrophes that make the headlines. Automobile crashes are seldom more than local news at best. You have probably heard many times the claim that if you making a trip somewhere, you are safer to fly than to drive yourself in your car. 15 Example - Hydro versus Solar I will now present an example of this. Hydro electric power has some notable large scale catastrophes associated with it. Roof top solar power does not have any notable catastrophes that I am aware of. However, which is safer? 16 Hydro Catastrophes Here are three examples of hydro electric catastrophes in just one country, Italy. The Vajont Dam which collapsed in1963 An estimated 1,917 to 2,500 people died. The Sella Zerbino dam which collapsed in 1935. More than 100 people died. The Gleno Dam which collapsed in 1923. An estimated 350 people died. https://damfailures.org/ https://pmc.ncbi.nlm.nih.gov/articles/PMC4997708/ 17 I haven't tried to compile a global list of the worst hydro electric dam collapses, as this sort of information is actually very difficult to find, even on web sites dedicated to dam failures. An additional problem is that information on whether a dam was used for electric power generation or not is often not available. 18 Dam failures where contradictory or insufficient information is available on whether there was an associated hydro power plant include the 1975 Banqian Dam failure, where death estimates range up to a quarter of a million. 19 Solar Panel Slow Accumulation Contrast this with roof top solar panels. Many small accidents can add up to big numbers as well. 20 Health and safety literature discussing solar panel safety mention things such as Falls from roofs. Electric shock. Arc flash (burns from electrical arcing). Normal electrical safety procedures which are based around locking out sources of energy do not work with solar panels which makes safety more difficult. Heat stress due to working exposed in the hot sun. Warning from US government on falls by solar panel installers. https://stacks.cdc.gov/view/cdc/228946 https://www.osha.gov/green-jobs/solar 21 Why We Cannot Compare the Two Hydro catastrophes are not well documented, but we can at least find records of some of the most notable ones. However, even those have very large variations in estimates of deaths. 22 Roof top solar deaths however are largely undocumented. The industry is largely unregulated. There is no central authority which accumulates many individual deaths or injuries. At best there are worker and public safety bodies who simply accumulate those statistics into general construction or household injuries. 23 Thus we have no reliable means of comparing the two energy sources on a comparable basis. We face the same problem with all other major electrical energy sources. So far as I am aware, there are no peer reviewed scientific studies which compare the relative safety of all of the major electrical energy sources we are considering here based on actual numbers. -------------------- 24 Safety Risks I will now try to list some the major hazards for each of energy sources we are considering. There is however limited data available. In many cases we just have reference to worker safety organizations as to what the hazards are. I will not attempt here to put numbers to these here. Categories 25 Coal, Oil, Natural Gas The hazards are Air pollution Mining and oil field accidents Pipeline explosions Transportation accidents. These- move a lot of material so these are significant. 26 Hydroelectric These include Dam collapse Drowning 27 Nuclear These include Radiation exposure 28 Wind These include Falls Confined space deaths (there is not much detail on this) Electric shock Ice throws (that is, throwing pieces of ice off the blades) This technology has a significant problem with people working alone which greatly increases risks associated with other dangers. 29 Solar These include Falls Electric shock Arc flash Heat stress 30 I have not tried to cover all possible risks associated with each category, just the ones which each industry considers to be the risks they concern themselves with. There does not exist any means by which risks of similar types are compared across different industries. 31 Reliability of Supply is Also Safety In a completely electrified net zero society, reliability of supply is a safety matter. People will die in very large numbers in cold climates if they do not have heat. If we have no fossil fuels, we need to also consider how reliably does a grid based on any of the options work. I have not seen anyone attempt to address this question and will not attempt to address it here. However, it must be addressed in any comprehensive attempt to rank safety. -------------------- 32 Studies or Articles on Estimates of Relative Safety Despite the difficulties of comparing the safety of different sources of energy, some people have attempted this anyway. Different estimates done

  5. 23 Jun

    HPR4667: UNIX Curio #9 - printf

    This show has been flagged as Clean by the host. This series is dedicated to exploring little-known—and occasionally useful—trinkets lurking in the dusty corners of UNIX-like operating systems. The echo command is very useful—it prints the arguments given to it, followed by a newline character. (The newline is sometimes also called a linefeed character depending on who is writing or speaking, and has the ASCII decimal value 10.) It has many uses, either in a script or interactively on the command line. The echo utility is used to display text, the value of a variable, or the result of a pathname expansion. It can also feed text to another command in a pipeline. As useful as echo is, it should come as no surprise that it first appeared early on in Bell Laboratories' Second Edition UNIX 1 in 1972. This initial version accepted no options 2 —although the manual page doesn't explicitly say output is followed by a newline character, the description of writing "as a line" seems to imply it. In Seventh Edition UNIX, the manual page 3 makes that clear, and also features the addition of the -n option, which causes echo to print the arguments without a trailing newline character. Eighth Edition UNIX's echo 4 gained the -e option, which allows certain escape codes from the C programming language to be used. These variations caused differences in behavior between different versions of echo . Will running echo -n something on your system output the text "something" without a newline, or "-n something" followed by a newline? Things get even trickier when the command arguments include parameter or pathname expansions. If there are files named "-n" and "something" in the current directory, what does echo * output? Like the previous question, that depends on whether or not your version of echo treats -n as an option. You can't get around this ambiguity by quoting or escaping the "*", because that just causes echo to print a literal asterisk. Example using GNU utilities on Debian 12; both the "echo" utility and the "echo" builtin of bash recognize "-n" as an option. $ ls -1 -n something $ echo * something$ #Shell prompt is on the same line because "-n" was treated as an option to echo $ echo "*" * The solution was to create a new utility, which is the first UNIX Curio for today: printf . This command allows a user to print text similar to the way the identically-named function works in the C programming language. You run printf 5 followed by a format string, followed by zero or more arguments. No newline characters are printed unless specifically indicated by the format string or the arguments. To use printf to print "something" without a newline, that would just be printf something . This demonstrates that you don't need any arguments—in this example, the format string is just a set of regular characters to be displayed. If you wanted a newline character at the end, printf "something\n" would give you that. (In this case, the format string needs to be quoted so the "\n" isn't interpreted by the shell.) In addition to "\n" for a newline, you can also use "\a" for an alert (rings the terminal bell), "\b" for a backspace, "\f" for a formfeed, "\r" for a carriage return, "\t" for a horizontal tab, "\v" for a vertical tab, and "\\" to get a literal backslash. In addition to these special characters, any arbitrary byte can be included using a backslash followed by one to three octal digits; however, it might be difficult to predict what will be output because it can differ based on the character set the terminal is using. It is safer and more portable to stick to the pre-defined characters if possible. The real magic of the printf utility comes from using "conversion specifications" in the format string. Probably the simplest of these to explain is the "%s" conversion specification—it represents a string of any length. The command printf "Hi, %s, how are you?\n" followed by a list of names would print the greeting for each name, putting it in the place occupied by the "%s". $ printf "Hi, %s, how are you?\n" Alice Bob Carol Hi, Alice, how are you? Hi, Bob, how are you? Hi, Carol, how are you? The format string is reused as many times as needed to consume all of the arguments. Take, for example, the command printf "Hi, %s, have you met %s?\n" . If this is run with two name arguments, it would print the sentence on one line, using both names. If run with four name arguments, it would print the sentence twice, once with the first two names and again with the second two names. If you only gave it three names, the last "%s" conversion specification would be replaced with a null string. $ printf "Hi, %s, have you met %s?\n" Alice Bob Hi, Alice, have you met Bob? $ printf "Hi, %s, have you met %s?\n" Alice Bob Carol David Hi, Alice, have you met Bob? Hi, Carol, have you met David? $ printf "Hi, %s, have you met %s?\n" Alice Bob Carol Hi, Alice, have you met Bob? Hi, Carol, have you met ? Three other items can also be given in each conversion specification: flags, the field width, and the precision. The exact meanings of these depend on which type of conversion specifier character you are using. For "%s", using a "-" as the flag causes the text to be left-justified instead of the default right-justified, a field width causes the printed field to be at least as long as the number given, and a precision limits the number of bytes written from the string to the number given. $ #Example of %s with a precision value $ printf "Hi, %.3s, how are you?\n" Alice Bob Carol Hi, Ali, how are you? Hi, Bob, how are you? Hi, Car, how are you? $ #Example of %s with a field width $ printf "Hi, %8s, how are you?\n" Alice Bob Carol Hi, Alice, how are you? Hi, Bob, how are you? Hi, Carol, how are you? $ #Example of %s with a left-justify flag and a field width $ printf "Hi, %-8s, how are you?\n" Alice Bob Carol Hi, Alice , how are you? Hi, Bob , how are you? Hi, Carol , how are you? $ #Example of %s with a left-justify flag, a field width, and a precision $ printf "Hi, %-8.3s, how are you?\n" Alice Bob Carol Hi, Ali , how are you? Hi, Bob , how are you? Hi, Car , how are you? While "%s" is probably the most commonly-used conversion specification, others are available. A whole set of them are dedicated to printing integer values as a signed decimal, an unsigned decimal, an unsigned octal, or an unsigned hexadecimal number. These also can take flags, a field width, and a precision. I think the details and nuances of all this are too complex to clearly explain here, so I will just refer you to the POSIX "file format notation" specification 6 . Be aware that unlike the printf function in the C programming language, the printf utility is not obligated to accept conversion specifications for floating-point numbers. While some implementations might support this, scripts intended to be portable should limit themselves to the restricted set required by the POSIX standard (%d, %i, %o, %u, %x, %X, %c, and %s, plus %b and %% described below). Two more conversion specifications are worth mentioning. The first is only required by the standard for the printf utility, not the C function, and is "%b". This is the same as "%s", except that certain backslash escape sequences in the argument will be treated specially. This includes all the ones described above except for the one using octal digits to represent a byte. In an argument, this is instead represented by "\0" followed by one to three octal digits. An additional backslash escape sequence accepted is "\c"—this does not print anything itself, but causes printf to immediately halt output. The final conversion specification is "%%", which just outputs a literal "%". You can't use a bare "%" in the format string, because printf expects that to introduce a conversion specification. Be careful not to be tripped up by this when trying to print some value as a percentage. Example assuming that the hypothetical "/dev/batterycharge" file on your laptop outputs the battery charge level (42% in this case). As you can see, in some cases an error message might be displayed, but in others it might just behave in a way you didn't intend without complaining. GNU's "printf" utility and the "printf" builtin of bash both support "%e" as a conversion specification as an extension to POSIX. $ cat /dev/batterycharge 42 $ #Wrong $ printf "Your laptop's charge level is $(cat /dev/batterycharge)%.\n" bash: printf: `\': invalid format character Your laptop's charge level is 42$ #Shell prompt appears here from the error $ #Right $ printf "Your laptop's charge level is $(cat /dev/batterycharge)%%.\n" Your laptop's charge level is 42%. $ #Next one treats %e as the specifier, with the space and "l" as flags $ printf "Your laptop has $(cat /dev/batterycharge)% level of charge.\n" Your laptop has 42 0.000000e+00vel of charge. $ #Because no arguments were given, "0" was used for the value to convert Let's go back to the situation I was describing with echo —we have files named "-n" and "something" in the current directory and want to print all their names, separated by spaces. We could do that with printf "%s " * , which would not treat the "-n" as an option. However, the output might look a little weird because there wouldn't be a newline character at the end. We could insert a newline by using "%b" instead of "%s" and following the asterisk with a "\n\c" as the second argument. The "\c" is there to prevent the final space in the format string from being printed after the newline. $ ls -1 -n something $ printf "%s " * -n something $ #No newline was printed here $ printf "%b " * "\n" -n something $ #There's a newline, but also a spurious space before the shell prompt $ printf "%b " * "\n\c" -n something $ #No space before the shell prompt this

  6. 22 Jun

    HPR4666: How I got into tech

    This show has been flagged as Clean by the host. I started out with Basic on the TI-99/4A in 1984. The bare machine could not be programmed by the user in machine code. In 1985 I bought a ZX Spectrum, that gave me total control over the machine. I wrote two FORTH systems on the ZX-Spectrum. In 1988 I got my first 8088 PC, also programming it in FORTH. In 1992 I got an 80386 PC and I ran Linux on it. MCC Interim Release from v. This was the first Linux distro. I have been using Linux ever since. From then on I obtained newer PCs, such as a Pentium in 1995, a Pentium-2 in 1998, a Pentium-4 in 2003 and a Core-2 Duo in 2006. I used several Linux distributions: but I always return to Debian. Links: https://github.com/ForthHub/F83 F83.COM is the ready to run FORTH system. https://github.com/uho/F-PC F-PC - a Forth system optimized for IBM-PC, XT and AT machines running DOS https://www.latte.org/latte.htmlLatte The Language for Transforming Text https://en.wikipedia.org/wiki/Joe's_Own_Editor https://www.freebsd.org/ https://www.debian.org/ https://www.gentoo.org/ https://en.wikipedia.org/wiki/Mac_Mini https://en.wikipedia.org/wiki/PowerPC https://en.wikipedia.org/wiki/Ivy_Bridge_(microarchitecture) https://en.wikipedia.org/wiki/Ubuntu https://en.wikipedia.org/wiki/Firefox https://en.wikipedia.org/wiki/Chromium_(web_browser) https://www.raspberrypi.com/products/raspberry-pi-400/ https://www.intel.com/content/www/us/en/ark/products/series/217838/12th-generation-intel-core-i5-processors.html https://en.wikipedia.org/wiki/Windows_11 Provide feedback on this episode.

About

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.

You Might Also Like