ohai.social is one of the many independent Mastodon servers you can use to participate in the fediverse.
A cozy, fast and secure Mastodon server where everyone is welcome. Run by the folks at ohai.is.

Administered by:

Server stats:

1.8K
active users

#cli

24 posts22 participants1 post today

Today, like many days prior, I had _reasons_ to relearn how to strip directory and extension from file path with Bash!

Syntax: `//+(*\/|.ext)/`

Example:

```bash
shopt -s extglob
_path="/tmp/ham/sandwich.txt";
printf '%s\n' "${_path//+(*\/|.txt)/}";
#> sandwich
```

It's been a minute (almost 3 years, but who's counting?), but I've just released a new version of broken-links, to add a user agent to it (thank you @mike_k for the suggestion).

It's a link checker - give it a starting URL, and it'll recursively crawl all pages with that domain, checking all internal and external links found.

Install via `cargo install broken-links` or see the release page for other options: codeberg.org/kdwarn/broken-lin

Summary card of an release titled "v0.2.4" in repository kdwarn/broken-links
Codeberg.orgv0.2.4 - kdwarn/broken-linksSee the [changelog](https://codeberg.org/kdwarn/broken-links/src/branch/main/CHANGELOG.md#0-2-4-https-codeberg-org-kdwarn-broken-links-compare-v0-2-3-v0-2-4).
#RustLang#Rust#cli
Continued thread

The #Codex #CLI tool offers a natural language interface to coding tasks:
🔒 Secure sandboxed execution with configurable approval modes for file operations and commands
🛠️ Runs in network-disabled mode and confined to current directory for defense-in-depth security

Continued thread

The purpose of the script is to generate and execute a Makefile to convert videos for recording VHS tapes - either directly from the computer or via a DVD player.

Outputting Makefile syntax is pretty easy with PHP: The toString method in the Makefile rule class only needs 5 lines of code. Look for yourself: codeberg.org/ncc1988/analogtap

2/2

Summary card of repository ncc1988/analogtape-utils
Codeberg.organalogtape-utils/encode_vhs.php at 6566e560fad1fea61bef7b32c9211353b572465fanalogtape-utils - This repository contains tools for compact cassette and VHS tape recording.
#PHP#CLI#Makefile

I think I won't bother anymore with writing (bash) shell scripts that are longer than a few lines. I find the syntax too unintuitive and there are better programming languages like PHP that produce more readable code.

In the last two hours, I translated a bash shell script with ~250 lines to a PHP CLI script. The latter is nearly 400 lines long but definetly more readable and it also has more user-friendly output.

1/2