u/mpersico

▲ 15 r/bash

TIL command_not_found_handle

You don’t want to know what hoops I’ve jumped through to implement FPATH in bash. Then today I innocently asked GPT how it would implement FPATH in bash and it introduced me to this hook.

Now have to go home now get rid of a lot of needless code. Oh well. Less code is the best code!

reddit.com
u/mpersico — 9 days ago
▲ 4 r/perl

What's in a name?

So, knowing that there is File::stat as an OO wrapper around stat(), I went looking for the corresponding OO wrapper around caller(). Searching for "caller" presented mostly packages that were enhancements, providing access to other data. The closest I found was Caller::Easy that used Moose! Talk about overkill.

So, I am writing my own that is JUST A THIN WRAPPER around caller. Rather than keep it under wraps (pun intended), I'd like to put it up on CPAN to be the caller() analogue to File::stat() => CORE::stat().

The main question I have is this - what's the name? Caller::Tiny? Caller:Simple? Caller:00? I am going to crosspost this question to r/perl, Facebook groups, perlmonks and slack.

reddit.com
u/mpersico — 4 months ago
▲ 13 r/bash

Why does printf behave differently in a subshell?

$ printf "%-9s:" "since"
since    :

$ y=$(printf "%-9s:" "since")
 
$ echo $y
since :

Why is the format not working in the subshell? It's the same printf:

$ which printf
/usr/bin/printf
 
$ y=$(which printf)
 
$ echo $y
/usr/bin/printf

And it's the same shell:

$ echo $SHELL
/bin/bash

$ y=$(echo $SHELL)

$ echo $y
/bin/bash

$ /bin/bash --version
GNU bash, version 5.2.37(1)-release (aarch64-unknown-linux-gnu)
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
reddit.com
u/mpersico — 4 months ago
▲ 1 r/github

How to create preview publishes of PRs in my Pages repo

I've been using docs and AI for two days. Even paid for a GoDaddy name (blogs.matthewpersico.com) to replace matthewpersico.github.io.

In the end, it looks like Pages won't serve anything except off the root. A PR from a branch in my Pages repo such as https://blog.matthewpersico.com/previews/pr-10/index.html just keeps coming back 404.

It appears that the only way to do this is to copy the Pages repo and treat the copy like a fork (you cannot fork in your own org as I understand it). Then you configure the pages for that project to render the PRs' previews, and merge the PR when happy.

Does that seem right?

reddit.com
u/mpersico — 5 months ago