JJJ's Blog

  • WordPress
  • GitHub
  • Twitter/X
  • Self Hosted

    It’s taken about-a-million tiny steps, but as of this moment (2 May, 2024 07:42 UTC-6) this WordPress blog (jjj.blog) and a bunch of other blogs for friends & family are all calling from inside the house running on a cluster of Raspberry Pi 4’s in a server rack in my basement.

    (more…)

    JJJ

    May 2, 2024
    Self Hosting, Home, Software, WordPress
    GitLab, Caddy, Mail-in-a-Box, Raspberry Pi
  • Fresh Docker

    sudo nano /usr/bin/docker_fresh
    #!/usr/bin/env bash
    
    #
    # Obliterates containers, images, networks, volumes, and cache.
    #
    
    [ $(docker ps | wc -l) -ne 1 ] && echo "Stopping containers..." && docker stop $(docker ps | sed -n '1d;p' | awk -F" " '{print $1}')
    [ $(docker ps -a | wc -l) -ne 1 ] && echo "Deleting containers..." && docker rm $(docker ps -a | sed -n '1d;p' | awk -F" " '{print $1}')
    [ $(docker images | wc -l) -ne 1 ] && echo "Deleting images..." && docker image rm $(docker images | sed -n '1d;p' | awk -F" " '{print $3}')
    echo "Pruning networks, volumes, and cache..." && docker system prune -a -f --volumes
    
    echo "Docker is fresh again."
    sudo chmod +x /usr/bin/docker_fresh

    JJJ

    February 13, 2024
    Software
    Docker
  • J3’s 3V’s

    Value. Validation. Victory.

    Writing & releasing strong, resilient, fault-tolerant, production-quality software (for the entire world to use) – with dynamic teams of contributors over many months & years – is all about banking trust, typically through an unlimited number of positive interactions.

    (more…)

    JJJ

    February 8, 2024
    Jobs, Opinion, Software
  • Persistent Touch ID for sudo on macOS

    Did you know you can activate Touch ID (or some other biometric) support to authenticate sudo commands on your command line, in a way that survives operating system updates?

    All you need to do is copy & modify a single file:

    cd /etc/pam.d
    sudo cp sudo_local.template sudo_local
    sudo nano sudo_local

    And it should look like this when you are done:

    # sudo_local: local config file which survives system update and is included for sudo
    # uncomment following line to enable Touch ID for sudo
    auth       sufficient     pam_tid.so

    The way I see it, manually typing passwords isn’t just annoying; it’s an error-prone attack vector for key-logging and yet-another-barrier to productivity. To make software more secure, the best security stuff needs to be the most convenient option by default; this is one-of-many small steps towards that.

    JJJ

    January 14, 2024
    macOS, Security
  • Netbeans crashing on macOS

    For the past few years & months, Netbeans (now version 20) has been really struggling to keep up with the type of work that I most frequently use it for (helping to maintain & improve WordPress and a few hundred plugins here or there) and it has really been a bummer because no matter how hard I’ve tried I have not felt any joy when writing PHP in VSCode – only frustration.

    Whenever I would launch Netbeans, it would open fine, and open projects & directories mostly OK, but then some other days & times it just felt far-far-far more sluggish than it used to (and than it should, given the relatively monster machine I am running it on).

    Like one does, I wasted a lot of time trying a bunch of things I found on The Internet that did nothing measurable; switched JDK versions, hard-coded a reserved amount of memory for the JVM, reinstalled, safe-mode, ask nicely, yada yada yada…

    The magic bullet, though, for me, harkens back to an old blog post of mine about not allowing macOS to index your node_modules directories.

    By adding |node_modules to Netbeans’ regular expression of “Files ignored by the IDE” it not only stopped crashing, but I am certain that I reduced the volume of indexing work it was doing by several ga’thousand percent, as every WordPress plugin is likely to have several megabytes of “modules” that are only used for tooling during its development and basically useless when it comes to day-to-day coding.

    Netbeans is the best hammer I never paid for. As soon as I stopped asking my hammer to write a bunch of notes for me that I’d never read anyways, I was able to pound nails again.

    Moral of the story? If there is one, I guess it must be: “John you are handsome & wise & always right and you should stop doubting yourself” 🙌

    JJJ

    January 12, 2024
    Netbeans
    macOS
  • Silence Ubuntu Pro security update nag

    If you see this:

    The following security updates require Ubuntu Pro with 'esm-infra' enabled:

    In short, it is telling you that the Ubuntu Core team has:

    1. patched versions of packages with known vulnerabilities
    2. made those improvements available for their Pro users/customers

    If your Ubuntu machines are critical infrastructure for you, you should consider signing up for Ubuntu Pro.

    If not, I think that makes it the perfect type of package update to “divert”:

    File diversions are a way of forcing dpkg(1) not to install a file into its location, but to a diverted location. Diversions can be used through the Debian package scripts to move a file away when it causes a conflict. System administrators can also use it to override some package’s configuration file, or whenever some files (which aren’t marked as “conffiles”) need to be preserved by dpkg, when installing a newer version of a package which contains those files.

    https://www.man7.org/linux/man-pages/man1/dpkg-divert.1.html

    There are different ways to accomplish this, but I did it like this:

    sudo dpkg-divert --divert /etc/apt/apt.conf.d/20apt-esm-hook.conf.bak --rename --local /etc/apt/apt.conf.d/20apt-esm-hook.conf

    This ultimately results in not receiving the most-fast security update benefits from Ubuntu Pro, but you aren’t any less secure than you would’ve normally been before Ubuntu Pro existed – we all still qualify for & receive the same old updates from the same old original package maintainers like before.

    JJJ

    September 5, 2023
    Software
    Ubuntu
  • Install Java & Netbeans on macOS via Homebrew

    brew install java
    sudo ln -sfn /opt/homebrew/opt/openjdk/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk
    echo 'export PATH="/opt/homebrew/opt/openjdk/bin:$PATH"' >> ~/.zshrc
    echo 'export CPPFLAGS="-I/opt/homebrew/opt/openjdk/include"' >> ~/.zshrc
    brew install netbeans

    JJJ

    August 24, 2023
    Netbeans, Apple, macOS
    macOS
  • Prevent empty new-line with Starship prompt

    From this GitHub issue: https://github.com/starship/starship/issues/560

    Enter this to modify Starship’s configuration:

    starship config

    Put this near the very top:

    # Tuck "new line" inside the ($all) variable
    format = """($all
    )$character"""
    
    # No new line between shell prompts
    add_newline = false
    
    # No line-break between shell prompts
    [line_break]
    disabled = true

    This works because anything inside of ($var) is skipped if $var is empty, and luckily this includes (or does not explicitly exclude/trim) a trailing new-line.

    JJJ

    January 9, 2023
    Software, Uncategorized
    Starship
  • Fix HomeBrew Permissions

    When running brew cleanup I was seeing this error:
    
    Error: Could not cleanup old kegs! Fix your permissions on:
    /opt/homebrew/Cellar/php/8.1.6

    Quickest fix I could muster was:

    sudo chown -R $(whoami) $(brew --prefix)/*

    JJJ

    June 13, 2022
    Software
    homebrew
  • 17 Rules

    1. Build modular programs
    2. Write readable programs
    3. Use composition
    4. Separate mechanisms from policy
    5. Write simple programs
    6. Write small programs
    7. Write transparent programs
    8. Write robust programs
    9. Make data complicated when required, not the program
    10. Build on potential users’ expected knowledge
    11. Avoid unnecessary output
    12. Write programs which fail in a way that is easy to diagnose
    13. Value developer time over machine time
    14. Write abstract programs that generate code instead of writing code by hand
    15. Prototype software before polishing it
    16. Write flexible and open programs
    17. Make the program and protocols extensible.

    From The Art of Unix Programming by Eric S. Raymond

    JJJ

    August 16, 2021
    Software
    Open Source
1 2 3 … 7
Next Page

Proudly Powered by WordPress