Skip to main content
tdro

Another wandering soul whispering into the void. If you are looking for my blog you are in the wrong place. The profile and header pictures are brought to you by cdd20.

tdro micro.thedroneely.com view
  • Markdown Plaintext Embed Permalink
  • 110/50 words 37s read

    A quick wrapper script for normalized git commit dates. Commit dates and timezones are normalized or truncated to the day. This is useful for avoiding rebasing and/or not having to think about system or git date/time settings when on another device or in another timezone. If precise timestamps matter, then it is easily disabled.

    shell
    #!/bin/sh -eu
    
    GIT=$(which git --all | grep --invert-match "local/bin" | head --lines 1)
    GIT_COMMITTER_DATE="$(date --utc --date '0' '+%a %b %d %H:%M:%S %Y %z')"
    
    export GIT_COMMITTER_DATE
    
    [ "${1:-}" = "commit" ] && export DATE=1 && $GIT "$@" --date="$GIT_COMMITTER_DATE"
    
    [ "${DATE:-}" = 1 ] && exit
    
    $GIT "$@"
    #gists #programs
    tdro

    Another wandering soul whispering into the void. If you are looking for my blog you are in the wrong place. The profile and header pictures are brought to you by cdd20.

    tdro micro.thedroneely.com view
  • Markdown Plaintext Embed Permalink
  • 89/50 words 30s read

    Infinite scrolling is unusual. Most implementations are “almost infinite” to avoid excessive length (memory).

    • Infinite scrolling: Limits content to an arbitrarily large amount to avoid exhausting memory.

    • Virtual scrolling: Unload everything except the visible viewport + a top and bottom offset. Pad the rest.

    Virtual scrolling is infinite, but breaks auxiliary actions ( CTRL + F ) because what’s on the screen is the content.

    js
    document.addEventListener("scroll", function() {
      console.log(document.querySelectorAll('*').length)
    });
    Increasing DOM length is infinite and constant length is virtual

    The most popular library appears to be https://infinite-scroll.com.

    #gists #webdev
    tdro

    Another wandering soul whispering into the void. If you are looking for my blog you are in the wrong place. The profile and header pictures are brought to you by cdd20.

    tdro micro.thedroneely.com view
  • Markdown Plaintext Embed Permalink
  • 56/50 words 19s read

    Some SSH options are worth tweaking when directly distributing code with git to multiple remotes. ConnectTimeout and BatchMode (optionally for automation). ControlMaster enables multiplexing for session sharing via sockets.

    cfg
    ForwardX11 no
    Compression no
    ConnectTimeout 3
    ServerAliveCountMax 1
    ServerAliveInterval 10
    
    Host *
      ControlMaster auto
      ControlPersist yes
      ControlPath ~/.ssh/sockets/%r@%h-%p
    An example ~/.ssh/config or /etc/ssh/ssh_config

    %r@%h-%p translates to user@hostname-22.

    #gists
    tdro

    Another wandering soul whispering into the void. If you are looking for my blog you are in the wrong place. The profile and header pictures are brought to you by cdd20.

    tdro micro.thedroneely.com (edited) view
  • Markdown Plaintext Embed Permalink
  • 130/50 words 43s read

    An actual but where did my Linux memory go command;
    This program (repositories) came in handy while helping someone resolve an problem. Want to see memory usage and shared memory, perhaps sorted by swap?

    shell
    smem -s swap -kta
    smem --sort swap --abbreviate --totals --autosize
    What about on other categories running a --sort?
    text
    swap     (amount of swap space consumed ignoring sharing)
    command  (process command line)
    maps     (total mappings count)
    name     (process name)
    pid      (process id #)
    user     (process owner)
    pss      (proportional set size including sharing)
    rss      (resident set size ignoring sharing)
    uss      (unique set size)
    vss      (virtual set size; total virtual memory mapped)
    Bonus: A filesystem usage command to catch /tmp/ and tmpfs (temporary file storage) abusers;
    shell
    df -h | grep tmpfs
    df --human-readable | grep tmpfs
    #gists #linux
    tdro

    Another wandering soul whispering into the void. If you are looking for my blog you are in the wrong place. The profile and header pictures are brought to you by cdd20.

    tdro micro.thedroneely.com view
  • Markdown Plaintext Embed Permalink
  • 103/50 words 34s read

    Text fragments are a Chromium feature from a couple years ago. They (#:~:text=) emulate CTRL + F or window.find() from a . I experimented in times past with a snippet–like approach using <mark> with URL encoded terms on id + :target logic, such that clicking this link highlights the paragraph below.

    text
    https://web.dev/text-fragments/#:~:text=Text%20Fragments%20let%20you
    The article says ‘boldly link’, but personally fragments (any) work best on infrequently changing content. Long URLs do text fragments make. Annoying? Who knows/cares? They are not everywhere yet (Firefox). On another tangent; I discovered that hugo did have the urlquery function available (that nice blog saved me code surfing). #gists #webdev
    tdro

    Another wandering soul whispering into the void. If you are looking for my blog you are in the wrong place. The profile and header pictures are brought to you by cdd20.

    tdro micro.thedroneely.com (edited) view
  • Markdown Plaintext Embed Permalink
  • 88/50 words 29s read

    It’s amusing the sort of easter eggs found hiding in open source code. I’ve been playing around with farzher/fuzzysort, a fast fuzzy search picked up from the Stack Overflow fuzzy search tag.

    On line 27 and 40 there’s a horizontal off–screen scroll easter egg.

    javascript
    if(search=='farzher')return{target:"farzher was here (^-^*)/",score:0,_indexes:[0]}
    if(search=='farzher')return[{target:"farzher was here (^-^*)/",score:0,_indexes:[0],obj:targets?targets[0]:NULL}]

    Yes, I happen to be one of those who read the code eventually. And obviously, it goes without saying, no one person reads all the code. But it’s the Internet, can’t be too sure ;)

    #gists
    tdro

    Another wandering soul whispering into the void. If you are looking for my blog you are in the wrong place. The profile and header pictures are brought to you by cdd20.

    tdro micro.thedroneely.com view
  • Markdown Plaintext Embed Permalink
  • 58/50 words 19s read
    Distributed is the new centralized.

    You can never be too sure anymore..

    shell
    $ git remote -v
    all             cgit@thedroneely.com:thedroneely/dotfiles (fetch)
    all             git@codeberg.org:tdro/dotfiles.git        (push)
    all             git@github.com:tdro/dotfiles.git          (push)
    all             cgit@thedroneely.com:thedroneely/dotfiles (push)
    all             git@gitlab.com:tdro/dotfiles.git          (push)
    codeberg.org    git@codeberg.org:tdro/dotfiles.git        (fetch)
    codeberg.org    git@codeberg.org:tdro/dotfiles.git        (push)
    github.com      git@github.com:tdro/dotfiles.git          (fetch)
    github.com      git@github.com:tdro/dotfiles.git          (push)
    gitlab.com      git@gitlab.com:tdro/dotfiles.git          (fetch)
    gitlab.com      git@gitlab.com:tdro/dotfiles.git          (push)
    thedroneely.com cgit@thedroneely.com:thedroneely/dotfiles (fetch)
    thedroneely.com cgit@thedroneely.com:thedroneely/dotfiles (push)
    Taking bets
    #gists
    tdro

    Another wandering soul whispering into the void. If you are looking for my blog you are in the wrong place. The profile and header pictures are brought to you by cdd20.

    tdro micro.thedroneely.com view
  • Markdown Plaintext Embed Permalink
  • 115/50 words 38s read
    There’s this cool python script chromexup that allows declaratively managing chromium based extensions.

    Basically setup the configuration in the right place, find the extension id from the Chrome web store and run chromexup.

    ini
    [main]
    branding           = chromium
    remove_orphans     = True
    parallel_downloads = 4
    
    [extensions]
    BlankNewTabPage   = jaadjnlkjnhohljficgoddcjmndjfdmi
    JavaScriptToggle  = cdcgbgnfhhdmdkallfmlachogpghifgf
    NoHistory         = ljamgkbcojbnmcaonjokopmcblmmpfch
    ~/.config/chromexup/config.ini

    Side note: NoHistory is good for disabling history (Firefox has options). If the history/bookmarks database gets too large, funky auto–suggestion stuff can happen (100% processor usage). , it’s best not to trust browsers storing bookmarks anyway and use an independent tool/method. The less data coupled to browsers the better — at least if you’re like me and swap browsers regularly.

    #gists
    tdro

    Another wandering soul whispering into the void. If you are looking for my blog you are in the wrong place. The profile and header pictures are brought to you by cdd20.

    tdro micro.thedroneely.com view
  • Markdown Plaintext Embed Permalink
  • 61/50 words 20s read

    Different words similar meaning? --references is NixOS speak for direct package dependencies. --requisites list all. These work with the nix-store command.

    shell
    $ readlink --canonicalize "$(type -P which)"
    /nix/store/r78jv9xgxnvsm5vpasf5ldkc28pkri6r-which-2.21/bin/which
    
    $ nix-store --query --references /nix/store/r78jv9xgxnvsm5vpasf5ldkc28pkri6r-which-2.21
    /nix/store/4nlgxhb09sdr51nc9hdm8az5b08vzkgx-glibc-2.35-163

    which directly depends on glibc. Swap --references to --referrers for paths pointing to which.

    On Guix, list/draw dependencies with guix graph.

    shell
    guix graph --type=references which
    #gists #linux
    tdro

    Another wandering soul whispering into the void. If you are looking for my blog you are in the wrong place. The profile and header pictures are brought to you by cdd20.

    tdro micro.thedroneely.com view
  • Markdown Plaintext Embed Permalink
  • 191/50 words 64s read
    A NixOS configuration for a working sound driver on an A1418 Cirrus Logic CS8409/CS42L83.
    nix
    { stdenv, lib, fetchgit, linuxKernel, kernel ? linuxKernel.kernels.linux_5_15
    , version ? "d0d785dc1859b09299bde6d0f1d6786a0d610e7f" }:
    
    stdenv.mkDerivation {
    
      inherit version;
      name = "sna-hda-codec-cs8409-${version}-module-${kernel.modDirVersion}";
    
      # Upstream: https://github.com/davidjo/snd_hda_macbookpro
    
      src = fetchgit {
        url = "https://github.com/egorenar/snd-hda-codec-cs8409.git";
        rev = version;
        sha256 = "sha256-0UeoERcYpM+ojeZ7dDIE3ruTIoHkkC+s7FcoEVUTR0w=";
      };
    
      hardeningDisable = [ "pic" ];
      nativeBuildInputs = kernel.moduleBuildDependencies;
    
      NIX_CFLAGS_COMPILE = [ "-g" "-Wall" "-Wno-unused-variable" "-Wno-unused-function" ];
    
      makeFlags = kernel.makeFlags ++ [
        "INSTALL_MOD_PATH=$(out)"
        "KERNELRELEASE=${kernel.modDirVersion}"
        "KERNEL_DIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
      ];
    
      postPatch = ''
        printf '
        snd-hda-codec-cs8409-objs := patch_cs8409.o patch_cs8409-tables.o
        obj-$(CONFIG_SND_HDA_CODEC_CS8409) += snd-hda-codec-cs8409.o
    
        KBUILD_EXTRA_CFLAGS = "-DAPPLE_PINSENSE_FIXUP -DAPPLE_CODECS -DCONFIG_SND_HDA_RECONFIG=1"
    
        KERNELRELEASE ?= $(shell uname -r)
        KERNEL_DIR    ?= /lib/modules/$(KERNELRELEASE)/build
        PWD           := $(shell pwd)
    
        default:
        	make -C $(KERNEL_DIR) M=$(PWD) CFLAGS_MODULE=$(KBUILD_EXTRA_CFLAGS)
    
        install:
        	make -C $(KERNEL_DIR) M=$(PWD) modules_install
        ' \
        > Makefile
    
        sed --in-place 's|<sound/cs42l42.h>|"${linuxKernel.kernels.linux_6_0.dev}/lib/modules/${linuxKernel.kernels.linux_6_0.modDirVersion}/source/include/sound/cs42l42.h"|'  patch_cs8409.h
        sed --in-place 's|hda_local.h|${kernel.dev}/lib/modules/${kernel.modDirVersion}/source/sound/pci/hda/hda_local.h|'                                                      patch_cs8409.h
        sed --in-place 's|hda_jack.h|${kernel.dev}/lib/modules/${kernel.modDirVersion}/source/sound/pci/hda/hda_jack.h|'                                                        patch_cs8409.h
        sed --in-place 's|hda_generic.h|${kernel.dev}/lib/modules/${kernel.modDirVersion}/source/sound/pci/hda/hda_generic.h|'                                                  patch_cs8409.h
        sed --in-place 's|hda_auto_parser.h|${kernel.dev}/lib/modules/${kernel.modDirVersion}/source/sound/pci/hda/hda_auto_parser.h|'                                          patch_cs8409.h
      '';
    
      meta = { platforms = lib.platforms.linux; };
    }
    ../packages/snd-hda-cs8409/default.nix

    Then build it as a extra/custom kernel module. The results of stumbling upon yet another troublesome device…

    nix
    { pkgs, ... }:
    
    {
      boot = {
        extraModulePackages = [
          (pkgs.callPackage ../packages/snd-hda-cs8409/default.nix {
            kernel = pkgs.linux_5_15;
          })
        ];
      };
    }
    hardware.nix
    #gists #linux

    Authors