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.
-
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/ -
HPR4109: The future of HPR
This will probably be one I'll get a lot of comments on, but I've
looked at the marketing proposition of HPR in light of some of the
challenges we face. To prevent us dipping into the reserve queue and
seeing a slow but steady decline in both audience and hosts.. Maybe its
time to give HPR a bit of a makeover. -