Skip to main content


Personal growth is hard when you leave no room (time) for it.


Modern shell #scripting is weird. :P #programming #bash #linux

#!/usr/bin/env bash

function parse_options () {
    declare -n result="$1"
    shift 1
    result['verbosity']='4'
    result['memory']='24G'
    result['volumes']=''
    result['device']='/dev/st0'
    result['write-rate']='250M'

    local opt
    local OPTARG
    while getopts 'vm:n:i:' opt
    do
        case $opt in
            v)
                result['verbosity']=6
                ;;
            m)
                result['memory']="$OPTARG"
                ;;
            n)
                result['volumes']="$OPTARG"
                ;;
            i)
                result['device']="$OPTARG"
                ;;
            r)
                result['write-rate']="$OPTARG"
                ;;
        esac
    done

    if [[ -z "${result['volumes']}" ]]; then
        echo "-i VOLUMES is required"
        exit 1
    fi
    return 0
}


declare -A CONFIG
parse_options CONFIG "$@" || exit 1

exec mbuffer \
    -v "${CONFIG['verbosity']}" \
    -m "${CONFIG['memory']}" \
    -n "${CONFIG['volumes']}" \
    -p 30 \
    -s 65536 \
    -A 'sh /usr/local/bin/tape_wait.sh' \
    -f \
    -R "${CONFIG['write-rate']}" \
    -i "${CONFIG['device']}"
This entry was edited (1 month ago)
in reply to Neil E. Hodges

what's weird is everything that could go wrong without all that. I'm not sure it's particularly modern though
in reply to Neil E. Hodges

Buffers? I see no buffers. It's a relatively trivial little script to translate one command-line API into another. I would use typeset instead of declare to make it portable to Korn Shell, and get rid of the unnecessary local OPTARG. I would get rid of the unnecessary local-reference trick with result -- it is not a sin to modify a well named global variable in a shell script. It could easily be translated into entirely POSIX-compatible syntax by using multiple global variables.

As for using another language, well that would be both silly, and far more complex. The shell is always already there and quite capable.



Doesn't using an #LLM to create large portions of your codebase mean that you end up with a lot of code that nobody understands unless they put in the time to go through it and learn what it's doing? If so, it's not much different from writing the code from scratch in the long one. :/

(Yes, I know about boilerplate and do think that's a valid use case as long as you know what the boilerplate is doing.)

#AI #programming

in reply to Steven Sandoval

It also worries me that a lot of people will forget how to write the more difficult code that they're offloading onto code generators (LLM or otherwise). They'll basically become captive customers out of fear of losing their jobs. :/
in reply to Neil E. Hodges

@baltakatei you shouldn't be allowed to use it professionally until you proved you can work competently without it.
in reply to Sick Sun

I hope that will be the case long-term, but I have the bad feeling it won't be. :/
This entry was edited (1 month ago)
in reply to Sick Sun

but will people who get the licence be fit to pass the exam again after say a decade of atrophy?
This entry was edited (1 month ago)



Had quite the time working on a personal project recently. It changed my life forever.

  • Learned the hard way that the (default on most POSIX) fork context is bad news.
  • Wrote a Unix domain datagram based log infrastructure.
  • Wrote an algorithm that operates kind of like concurrent.futures.as_completed(), except it has a priority queue and doesn't eagerly load the list of futures.
  • Discovered that it's possible to overload concurrent.futures.ProcessPoolExecutor with futures, preventing any actual background processing after a point.
  • Got TONS of practice optimizing stuff for large datasets.
  • Learned that taking breaks is important for reasons than most people are aware of.
  • My life was permanently altered by this project. I basically nerd-sniped myself.

#Python #programming


Never, ever, use the fork context in multiprocessing. :blobfoxsweating: POSIX OSes (aside from macOS) have that as the default. :blobfoxangrylaugh: Always use the spawn context! :blobfoxdead:

Of course, unless you have an extreme edge case. :blobfoxgoogly: (Yes, the names are funny. :blobfoxgooglytrash: )

#Python #multiprocessing


Tech Cyborg reshared this.

in reply to Neil E. Hodges

This whole mess got me thinking seriously about learning #Kotlin, since it would eliminate needing to use IPC to make use of multiple CPU cores. (Yes, I actually like the #JVM, but don’t want to boilerplate myself to death with #Java. :P )

I’ll probably still look into learning Kotlin, but not for this project.





Over a decade ago ago, I wrote an #NCurses vertical shooter from scratch in C++, but ran out of steam because I couldn't come up with a good AI system for the enemies. Maybe I could try again, but use #Lua or something similar to make AI writing easier. #programming #GameDev




Do you have to pronounce the name of the #programming language #Lisp like "Lithp"? 🤔


PEP 703 – Making the Global Interpreter Lock Optional in CPython


CPython’s global interpreter lock (“GIL”) prevents multiple threads from executing Python code at the same time. The GIL is an obstacle to using multi-core CPUs from Python efficiently. This PEP proposes adding a build configuration (--disable-gil) to CPython to let it run Python code without the global interpreter lock and with the necessary changes needed to make the interpreter thread-safe.


#python #programming #gil

Andrew Sterian reshared this.



Neil E. Hodges reshared this.


I think I found a #Python #bug today. If you try to do a csv.writer.writerow() and one of the strings (not bytes) in the row contains a null character in it, and you are using a csv.Dialect with escapechar set to None, it will result in this condition evaluating to true when it shouldn't. That will almost immediately result in the need to escape, but no escapechar set exception being thrown. #programming

reshared this



AI code generation provides us with vast swaths of legacy code that was copied from sources with all sorts of licenses that may not be compatible with each other or the end result. #programming
in reply to Neil E. Hodges

Yeahhhh, or one might argue that AI generated code is a new work and thus ready to be given a new free-standing copyright using whatever terms the "prompter" feels like.

Of course current so-called "AI"s are all trained by reading lots of code, so it may also be possible to argue that nothing they produce can really be claimed to be truly "clean room" creations, even though technically the way they work pretty much can't copy any actual code (or anything else) from their training materials.


Neil E. Hodges reshared this.


If AI-based code generators are indiscriminately sampling real-world programmers of all skill levels, then I don't think we really have to worry about them replacing more skilled programmers. #programming


When you come from the era of PHP and CGI Perl, and not the era of Node. #programming

I miss the simplicity of the early Web.
This entry was edited (1 year ago)

Neil E. Hodges reshared this.


Learned a new #Python trick on the job:
@contextmanager
def func(…):
    resource = …
    try:
        yield resource
    finally:
        …

#programming

reshared this





Don't hire a full-stack developer to work on a queue. #programming #joke



in reply to Neil E. Hodges

Nah--there will always be room for more. My fav 3 right now are JS, Python, and Rust. :) Right tool for the job!
in reply to Neil E. Hodges

Hopefully not, but certainly the vast amount of software that most users recognize as software will be JS for some time to come (driven by C++ or Rust under the hood of course).

in reply to Neil E. Hodges

I don't have a clue, but at least it's gone now (along with other out-dated versions of scripting languages).

The release notes for 10.15 (when it was first deprecated) do say:
Scripting language runtimes such as Python, Ruby, and Perl are included in macOS for compatibility with legacy software. Future versions of macOS won’t include scripting language runtimes by default
The same appears in the Xcode 11 release notes.

They don't say what specific "legacy software" they refer to though.


I'd still like to write a #Fediverse server in #Java, but I don't have the time or energy to do so solo. #programming

reshared this

in reply to Neil E. Hodges

I would participate ( 10y+ java backend exp). Contact me!
in reply to Bob

Cool! Are you aware of any good JSON → Java code generators? Manually writing the AP DTOs is more boilerplate than I have patience for.
in reply to Neil E. Hodges

well if then it would be openapi to Java which is straight forward; however I discovered there is already at least 1 ActivityPub-compatible Java implementations out there (https://fediverse.party/en/miscellaneous/)
This entry was edited (1 year ago)
in reply to Bob

I noticed Smithereens a while back, too. Could be a good starting point for a fork. Definitely would want to port it over to Postgres, though.
in reply to Neil E. Hodges

yes, totally. I'm going to check it out and boot it up to see how far it is yet
in reply to Bob

not the programming style I would do in 2022 however it seems a good starting point really
in reply to Bob

not. It's not. I'd rather start from scratch with micronaut or quarkus. This codebase is nothing we want to maintain
in reply to Bob

Thanks for looking into it. I've never worked with either of those frameworks, but they do sound promising.

Any ideas on a JSON → Java code generator for the AP object boilerplate?
in reply to Neil E. Hodges

there are so many out there we can just try some
in reply to Bob

because it's so obvious for the java implementation of the fediverse I suggest the name jediverse
in reply to Bob

See https://github.com/jediverse/coruscant which I just created. The models are there. No page is served yet, must be a config issue. http://localhost:8080/swagger-ui/ works

Neil E. Hodges reshared this.

in reply to Bob

Thank you for kicking this off. I can add the JSON DTOs, but I won't be able to get to it until the weekend.
in reply to Neil E. Hodges

I think it's already all set, see the model package
in reply to Bob

You might need something like this to handle polymorphism via the type field documented here. My code is under the BSD license, so it can be used elsewhere. Perhaps it would be a good idea to have a separate library since the other ones I've seen are very outdated.

I can handle the polymorphism, but I still won't have time until the weekend.
This entry was edited (1 year ago)
in reply to Neil E. Hodges

@Christine Lemmer-Webber I saw your name on a number of things related to ActivityPub test suites. Do you know if one still exists?
in reply to Neil E. Hodges

I'd help if it were Go! 🙃

But I would probably want to design a new protocol from scratch first.



Had to implement an #OAuth callback handler because a service I wanted to use outright refused to work with OOB OAuth. #programming


No Google, I don't want a #Java library from 2008. #programming


Upgraded my JDK version from 11 to 17 because I wanted some features added in 12. #Java #programming


When you've learned that many of the Stack Overflow solutions from years ago are outdated and are now using deprecated/removed functionality or are considered bad style today, but search engines keep digging them up because they were once popular. #programming
in reply to Neil E. Hodges

Finding a solution online doesn't mean you can turn off your brain. Common sense is still required to assess the results and find the best one. 10 year old answers might not be the most appropriate anymore. I often find myself searching multiple sites for an answer that I like.
in reply to Neil E. Hodges

Recently, I also noticed that often the solution to a problem simply emerges when writing the question into StackOverflow. There, you normally don't post your entire source code (if you're not a beginner at least), and while producing a minimal working example, and thus reducing my problem to the very core, I sometimes find the solution on my own. If it's not a too specific problem, I'd then just publish the question and answer it on my own, just for future reference.


When you're using Apache HttpClient 5 but all of the tutorials are using HttpClient 4. #Java #programming


I enjoy both regular expressions and SQL.

I'm a dying breed, I guess. #programming #regex #sql
in reply to Neil E. Hodges

Me two! This is an old article, but this is how I use RegEx from within SQL. Specific to MS SQL Server though: https://www.red-gate.com/simple-talk/databases/sql-server/t-sql-programming-sql-server/clr-assembly-regex-functions-for-sql-server-by-example/
Unknown parent

Neil E. Hodges
That's optional, at least with Postgres.


#Java takes forever to write, but the structure it enforces does make maintenance easier. #programming


Did my first baby # experiment today. Feel like I learned some useful info. #


I haven't been uploading a couple of big trips' worth of #photos because I've been working on a new tag editor. With it, I won't need to mess around with #Flickr's uploading UI as much. (Photo)

I wrote it in #Java since it's what I've been writing the most because of work. As much as people love to hate on it, there are a number of things I like about Java 8+. #photography #programming #photog

in reply to Neil E. Hodges

While writing this, I discovered a bug in SWT’s ImageLoader where the resulting image was always incorrect. For example, a 1×1 white JPEG loaded correctly via SWT’s ImageData was turned into a yellow 1×1 JPEG when saved again via ImageLoader. I had to use AWT’s BufferedImage and ImageIO to save files correctly.