That’s what I’m using right now, while my own client is still in the making.
A simple bash script to write a post in a mktemp
file then clean it with regex.
I don’t even bother to hash the replies, I just open https://twtxt.net and copy the hash by hand since I’m checking the new posts from there anyway (temporarily, as I might end up DoS-ing everyone’s feed in my client right now).
Only figured this out yesterday:
pinentry
, which is used to safely enter a password on Linux, has several frontends. There’s a GTK one, a Qt one, even an ncurses one, and so on.
GnuPG also uses pinentry
. And you can configure your frontend of choice here in gpg-agent.conf
.
But what happens when you don’t configure it? What’s the default?
Turns out, pinentry
is a shellscript wrapper and it’s not even that long. Here it is in full:
#!/bin/bash
# Run user-defined and site-defined pre-exec hooks.
[[ -r "${XDG_CONFIG_HOME:-$HOME/.config}"/pinentry/preexec ]] && \
. "${XDG_CONFIG_HOME:-$HOME/.config}"/pinentry/preexec
[[ -r /etc/pinentry/preexec ]] && . /etc/pinentry/preexec
# Guess preferred backend based on environment.
backends=(curses tty)
if [[ -n "$DISPLAY" || -n "$WAYLAND_DISPLAY" ]]; then
case "$XDG_CURRENT_DESKTOP" in
KDE|LXQT|LXQt)
backends=(qt qt5 gnome3 gtk curses tty)
;;
*)
backends=(gnome3 gtk qt qt5 curses tty)
;;
esac
fi
for backend in "${backends[@]}"
do
lddout=$(ldd "/usr/bin/pinentry-$backend" 2>/dev/null) || continue
[[ "$lddout" == *'not found'* ]] && continue
exec "/usr/bin/pinentry-$backend" "$@"
done
exit 1
Preexec, okay, then some auto-detection to use a toolkit matching your desktop environment …
… and then it invokes ldd
? To find out if all the required libraries are installed for the auto-detected frontend?
Oof. I was sitting here wondering why it would use pinentry-gtk
on one machine and pinentry-gnome3
on another, when both machines had the exact same configs. Yeah, but different libraries were installed. One machine was missing gcr
, which is needed for pinentry-gnome3
, so that machine (and that one alone) spawned pinentry-gtk
…
Just discovered how easy it is to recall my last arg in shell and my brain went 🤯 How come I’ve never learned about this before!? I wonder how many other QOL shortcuts I’m missing on 🥲
could I use :source ~/.bash_history? for get last commands in the list of command? ⌘ Read more
What is it wrong with this command: :r ~/.bash_history | %!grep ‘err’ ⌘ Read more
Weird syntax highlighting in Bash ⌘ Read more
Security updates for Monday
Security updates have been issued by Debian (ansible, containerd, and vips), Fedora (chromium, java-17-openjdk, nodejs-bash-language-server, nodejs-pnpm, ntpd-rs, redis, rust-hickory-proto, thunderbird, and valkey), Mageia (apache-mod_auth_openidc, fcgi, graphicsmagick, kernel-linus, pam, poppler, and tomcat), Red Hat (firefox, libsoup, nodejs:20, redis:6, rsync, webkit2gtk3, xmlrpc-c, and yelp), and SUSE (audiofile, ffmpeg, firefox, libsoup-2_4-1, libsoup-3_0-0, libva, libxml2, and … ⌘ Read more
This code displays the last 10 lines of a twtxt feed without a full dowload.
FEED_URL="https://twtxt.net/user/prologic/twtxt.txt"
MAX_RANGE=$(curl -sI $FEED_URL | grep -i 'content-length' | awk '{print $2}' | tr -d '\r')
MIN_RANGE=$((MAX_RANGE - 5000))
curl -s --range "$MIN_RANGE-$MAX_RANGE" "$FEED_URL" | grep -v -e '^#' -e '^$' | head -n 10
My self-response!
Even though I really do like the shell, I always use Dolphin to mount my digicam SD card and copy the photos onto my computer. I finally added a context menu item in Dolphin to create a forest stroll directory with the current date in order to save some typing:
The following goes in ~/.local/share/kservices5/ServiceMenus/galmkdir.desktop:
[Desktop Entry]
Type=Service
X-KDE-ServiceTypes=KonqPopupMenu/Plugin,inode/directory
Actions=Waldspaziergang;
[Desktop Action Waldspaziergang]
Name=Heutigen Waldspaziergang anlegen…
Icon=folder-green
Exec=~/src/gelbariab/galmkdir "%f"
In order to update the KDE desktop cache and make this action menu item available in Dolphin, I ran:
kbuildsycoca5
The referenced galmkdir
script looks like that:
#!/bin/sh
set -e
current_dir="$1"
if [ -z "$current_dir" ]; then
echo "Usage: $0 DIRECTORY" >&2
exit 1
fi
dir="$(kdialog \
--geometry 350x50 \
--title "Heutigen Waldspaziergang anlegen" \
--inputbox "Neues Verzeichnis in „$current_dir“ anlegen:" \
"waldspaziergang-$(date +%Y-%m-%d)")"
mkdir "$current_dir/$dir"
dolphin "$current_dir/$dir"
This solution is far from perfect, though. Ideally, I’d love to have it in the “Create New” menu instead of the “Actions” menu. But that doesn’t really work. I cannot define a default directory name, not to mention even a dynamic one with the current date. (I would have to update the .desktop file every day or so.) I also failed to create an empty directory. I somehow managed to create a directory with some other templates in it for some reason I do not really understand.
Let’s see how that works out in the next days. If I like it, I might define a few more default directory names.
AI problems, top to bottom:
1: Open AI nerds, believe fine tuning a language model algorithm, will eventually produce an AGI god.
2: Subpar artists and techbros who can’t code, convinced AI image bashing and vibe coding, will help convince the dumber parts of Internet, they are a real deal.
3: Parasites, using AI to scam people, because they just want passive income, selling crap, made by an automated process.
Side: Adobe&co, killing Flash/old web, pricing new artists and developers out, to face learning curves of free tools, or use AI, peddled as solution.
Then I cleaned up my shell history of all of the invocations I ever made of dkv rm ...
to make sure I never ever have this so easily accessible in my shell history (^R
):
$ awk '
/^#/ { ts = $0; next }
/^dkv rm/ { next }
{ if (ts) print ts; ts=""; print }
' ~/.bash_history > ~/.bash_history.tmp && mv ~/.bash_history.tmp ~/.bash_history && history -r
Introducing rpi-image-gen for customized Raspberry Pi images
Raspberry Pi has
announced rpi-image-gen,
a tool to create custom software images for its devices.
rpi-image-gen is a Bash orientated scripting engine capable of
producing software images with different on-disk partition layouts,
file systems and profiles using collections of metadata and a defined
flow of execution. It provides the means to create a hig … ⌘ Read more
i love everything pico.sh i wish i had more of a use for their services but the paste service is SUPER handy omg i finally had a reason to use it (to send a friend my unfinished failed marvel API bash program lol) and it’s epic. i love SSH i love TUI apps they are the best
SQL scares me i tweaked a bash script that pulled from a DB and the bash part was easy even if i was just going off of the code in there that i didn’t write (like i understood it at least) but the SQL parts had me suffering
** mkv no more **
My previous post included a video. I made that video with OBS which outputs .mkv
video files.
I wanted to do my best to ensure that folks with a variety of devices and browsers would be able to watch the video if they wanted to, so, I converted it into a few different formats.
Here’s the bash script I wrote to do that. It relies on ffmpeg.
”`hljs bash
#!/bin/bash
if ! command -v ffmpeg &> /dev/null; then
echo "ffmpeg ... ⌘ [Read more](https://eli.li/mkv-no-more)```
My hypothesis about that thing breaking my twts is that it might have something to do with the parenthesis surrounding the root twt hash in the replay twt-A
when I replay to it with fork-twt-B
; I imagine elisp interpreting those as a s-expression thus breaking the generation precess of hash (#twt-A) before prepending it to for-twt-B
… but then I’m too ignorant to figure out how to test my theory (heck I couldn’t even recalculate the hashes myself correctly in bash xD). I’ll keep trying tho.
curl: (3) URL rejected: Malformed input to a URL function. Writing sender in bash was BAD idea
shellcheck
: https://github.com/koalaman/shellcheck It points out common errors and gives some suggestions on how to improve the code. Some details in shell scripting are very tricky to get right at first. Even after decades of shell programming, I run into "corner cases" every now and then.
Checked my posthook… looks like my bash skills at zero: https://doesnm.cc/huh.txt
@kat@yarn.girlonthemoon.xyz definitely a fun way to get better at bash scripting by hand (AKA learn how it works besides the extreme basics i know) and use gum to make them cute too
@prologic@twtxt.net, do you use zsh
on macOS, or do you change it to, say, bash
?
John-Doggett creates public XMR node setup script
John-Doggett1 has created a Bash script2 that helps users to automatically configure public Monero nodes with support for HTTPS on Debian:
It uses Caddy to create a public website on your node, as well as renewing LetsEncrypt certificates. [..] Let me know what you all think
Usage instructions are available on GitHub2.
Note: inspect the code4 before running the script.
- https:/ … ⌘ Read more
nahuhh releases ‘basicswap-bash’ v0.14.1
nahuhh (ofrnxmr)1 has released basicswap-bash 2 version 0.14.13:
Changes overviewA suite of bash scripts to install and manage BasicSwapDEX on Windows(WSL)/Debian/Ubuntu/Arch/Fedora
* placeorders: use python to check offer size
* setup: update tails
* fix $PATH detection
* fix restore from seed
* install: xfce .profile use in .xsessionrc
Installation instructions are available on the Github release page3.
… ⌘ Read more
I mean thread command but bash escapes quoted as command…
@lyse@lyse.isobeef.org aha! Just like Bash would do. I figure --
is way too broad to start an autocomplete. Got to feed it a bit more! :-D
LOl 😂 Not only have a tried to write up a full Twtxt v2 specification, I’ve also written a Bash shell script that implements the new spec 😅
@quark@ferengi.one Mine is a little overkill 😂 but I need to do something for practice:
#!/bin/bash
set -e
trap 'echo "!! Something went wrong...!!"' ERR
#============= Variables ==========#
# Source files
LOCAL_DIR=$HOME/twtxt
TWTXT=$LOCAL_DIR/twtxt.txt
HTML=$LOCAL_DIR/log.html
TEMPLATE=$LOCAL_DIR/template.tmpl
# Destination
REMOTE_HOST=remotHostName # Host already setup in ~/.ssh/config
WEB_DIR="path/to/html/content"
GOPHER_DIR="path/to/phlog/content"
GEMINI_DIR="path/to/gemini-capsule/content"
DIST_DIRS=("$WEB_DIR" "$GOPHER_DIR" "$GEMINI_DIR")
#============ Functions ===========#
# Building log.html:
build_page() {
twtxt2html -T $TEMPLATE $TWTXT > $HTML
}
# Bulk Copy files to their destinations:
copy_files() {
for DIR in "${DIST_DIRS[@]}"; do
# Copy both `txt` and `html` files to the Web server and only `txt`
# to gemini and gopher server content folders
if [ "$DIR" == "$WEB_DIR" ]; then
scp -C "$TWTXT" "$HTML" "$REMOTE_HOST:$DIR/"
else
scp -C "$TWTXT" "$REMOTE_HOST:$DIR/"
fi
done
}
#========== Call to functions ===========$
build_page && copy_files
@aelaraji@aelaraji.com this is the little script I am using on my publish_command
:
#!/usr/bin/env bash
twtxt2html -t "Quark's twtxt feed" /var/www/sites/ferengi.one/twtxt.txt > /var/www/sites/ferengi.one/index.html
I named it twtxtit
. :-)
@bender@twtxt.net It’s just a simple twtxt2html and scp … it goes like:
twtxt2html $HOME/path/to/local_twtxt_dir/twtxt.txt > $HOME/path/to/local_twtxt_dir/log.html && \
scp $HOME/path/to/local_twtxt_dir/log.html user@remotehost:/path/to/static_files_dir/
I’ve been lazy to add it to my publish_command script, now I can just copy/pasta from the twt 😅
@movq@www.uninformativ.de Variable names used with -eq in [[ ]] are automatically expanded even without $ as explained in the “ARITHMETIC EVALUATION” section of the bash man page. Interesting. Trying this on OpenBSD’s ksh, it seems “set -u” doesn’t affect that substitution.
I love shell scripts because they’re so pragmatic and often allow me to get jobs done really quickly.
But sadly they’re full of pitfalls. Pitfalls everywhere you look.
Today, a coworker – who’s highly skilled, not a newbie by any means – ran into this:
$ bash -c 'set -u; foo=bar; if [[ "$foo" -eq "bar" ]]; then echo it matches; fi'
bash: line 1: bar: unbound variable
Why’s that happening? I know the answer. Do you? 😂
Stuff like that made me stop using shell scripts at work, unless they’re just 4 or 5 lines of absolutely trivial code. It’s now Python instead, even though the code is often much longer and clunkier, but at least people will understand it more easily and not trip over it when they make a tiny change.
Since I have these simple, yet effective bash shell commands, which allow me to edit notes, plans, todos and statuses from the terminal, I feel liberated from overly complex software - everything is just text files and applications which come preinstalled on every Linux system.
@prologic@twtxt.net I’ve even added the twthash message hash to my Twtxt bash CLI script so I can properly answer here.
** December adventure **
Over the past couple years I’ve done the advent of code to varying degrees. I thought I was going to do it again this year but decided to try something different. I’ve been calling what came together a“ December Adventure.”
It isn’t anything fancy; throughout December I aim to write a little bit of code everyday. So far I’ve written a bit of apl, bash, elisp, explored a bunch of flavors of scheme, and star … ⌘ Read more
5 DevOps tips to speed up your developer workflow
From learning YAML to scripting with Bash, here are a few simple tips for developers who want to speed up their workflows. ⌘ Read more
This will be the last entry on this conversation (hopefully!):
#!/bin/bash
echo "hello world"
The end!
TIL that changing a .bashrc alias to a bash function requires you to restart the terminal as calling source ~/.bashrc
does not change the alias to the function call.
@prologic@twtxt.net Txtnish adds a 28 character timestamp to the message, so in Bash: tweet=tail -1 the current twtxt.txt file and then pipe echo body=${tweet:28} to twt.
@prologic@twtxt.net Txtnish adds a 28 character timestamp to the message, so in Bash: tweet=tail -1 the current twtxt.txt file and then pipe echo body=${tweet:28} to twt.
Used bash to remove the timestamp of the just -posted tweet to twttxt.txt and passed that to twt to re-post to the configured pod
Used bash to remove the timestamp of the just -posted tweet to twttxt.txt and passed that to twt to re-post to the configured pod
Bash emacs command history via ^R ^P ^N ^S, who knew? https://blog.pythian.com/emacs-keybindings-in-bash/
Making a bash gemlog script to maintain my gemini log
I added scripts to my bash so it cheers me up with friendly greetings and messages
@mdosch@mdosch.de Oh wow. I thought Apple was the only org out there shipping zsh by default. What was their rationale for not defaulting to bash?
Using twtxt from bash now using echo
This one is coming to you from the Alfred launcher https://albertlauncher.github.io/ and a Bash script calling txtnish https://github.com/mdom/txtnish and oysttyer https://github.com/oysttyer/oysttyer #microblogging
This one is coming to you from the Alfred launcher https://albertlauncher.github.io/ and a Bash script calling txtnish https://github.com/mdom/txtnish and oysttyer https://github.com/oysttyer/oysttyer #microblogging
@mdosch@mdosch.de Apple refuses to ship GPLv3 software. bash has security bugs that Apple doesn’t want to backport. So they’ve switched default shells again, this time to zsh. (bash and the previous default, tcsh, still ship with the OS.)
Interestingly enough, Visual Studio Code keeps running bash as its preferred shell, even though it isn’t the login shell anymore.
@kas@enotty.dk now that I understand fish enough to port over the contents of my .bashrc and .bash_profile, I’m starting to get used to it. How’s having different shell preferences for login/interactive treating you?
I wanted to feel productive this evening, but I didn’t want to do any useful work. In related news, I’ve switched to https://fishshell.com/ from GPLv2 bash.
today was the day of the triennual trying of the fish shell only to go back to bash within an hour or two
I was too lazy to look up how to write a for-loop in bash so I just ran “find . -name *.ttf -exec woff2_compress {} \;”
Detecting the use of “curl | bash” server side | Application Security https://www.idontplaydarts.com/2016/04/detecting-curl-pipe-bash-server-side/
iridakos - Creating a bash completion script https://iridakos.com/tutorials/2018/03/01/bash-programmable-completion-tutorial
@sdk@codevoid.de A comment might not be in the spec, but I know several of the twtxt files I’ve looked at have them. I know my kit bashed twtxt client ignores those lines and I’m sure other clients do too.
@kas@enotty.dk Switching shells is the reason that I started deploying scripts in /usr/local/bin rather than defining aliases. :D Tested #bash #ksh #fish and #zsh and the latter it is now for years already.
/me wonders in which world autocorrecting spelling errors during tab-completion is sane? https://github.com/mrzool/bash-sensible
/me wonders in which world autocorrecting spelling errors during tab-completion is sane? https://github.com/mrzool/bash-sensible
Thanks @kas@enotty.dk for the final nudge to change my bash history settings. Still on the fence about PROMPT_COMMAND=“history -a” though.
Thanks @kas@enotty.dk for the final nudge to change my bash history settings. Still on the fence about PROMPT_COMMAND=“history -a” though.
@xena@xena.greedo.xeserv.us True, but the syntax it uses is so different from what I’m used to on bash/zsh
Search linux bash history
Have you ever executed something on the linux shell and didn’t remember later how it was done? Well if you remember just part of it you can search for it: history | grep -i “” ⌘ Read more