Skip to main content
tdro

Another wandering soul screaming 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 may 30 2023 20 sec 59/50 words
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 screaming 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 may 23 2023 39 sec 117/50 words
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 screaming 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 may 5 2023 21 sec 63/50 words

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 screaming 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 jan 21 2023 65 sec 194/50 words
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
tdro

Another wandering soul screaming 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 jan 5 2023 49 sec 146/50 words
My default nix configuration on NixOS.

This configuration is more for building/debugging stuff and caching with nix-serve. Usually my package version is locked since different versions of nix can have some effects.

nix
{ config, ... }:

{
  nix = {
    package = (import ../versions.nix).nix_2_12 { inherit config; };
    settings = {
      log-lines = 25;                                # https://nixos.org/manual/nix/unstable/command-ref/conf-file.html#conf-log-lines
      fallback = true;                               # https://nixos.org/manual/nix/unstable/command-ref/conf-file.html#conf-fallback
      tarball-ttl = 0;                               # https://nixos.org/manual/nix/unstable/command-ref/conf-file.html#conf-tarball-ttl
      show-trace = true;                             # https://nixos.org/manual/nix/unstable/command-ref/conf-file.html#conf-show-trace
      connect-timeout = 5;                           # https://nixos.org/manual/nix/unstable/command-ref/conf-file.html#conf-connect-timeout
      auto-optimise-store = true;                    # https://nixos.org/manual/nix/unstable/command-ref/conf-file.html#conf-auto-optimise-store
      narinfo-cache-negative-ttl = 0;                # https://nixos.org/manual/nix/unstable/command-ref/conf-file.html#conf-narinfo-cache-negative-ttl
      narinfo-cache-positive-ttl = 0;                # https://nixos.org/manual/nix/unstable/command-ref/conf-file.html#conf-narinfo-cache-positive-ttl
      builders-use-substitutes = true;               # https://nixos.org/manual/nix/unstable/command-ref/conf-file.html#conf-builders-use-substitutes
      min-free = 268435456;                          # https://nixos.org/manual/nix/unstable/command-ref/conf-file.html#conf-min-free (256 MB in Bytes)
      max-free = 1073741824;                         # https://nixos.org/manual/nix/unstable/command-ref/conf-file.html#conf-max-free (1 GB in Bytes)
      allowed-users = [ "root" "@wheel" ];           # https://nixos.org/manual/nix/unstable/command-ref/conf-file.html#conf-allowed-users
      trusted-users = [ "root" "@wheel" ];           # https://nixos.org/manual/nix/unstable/command-ref/conf-file.html#conf-trusted-users
      experimental-features = "nix-command flakes";  # https://nixos.org/manual/nix/unstable/command-ref/conf-file.html#conf-experimental-features
    };
  };
}
My nix-configuration.nix on version 22.11
#gists #linux
tdro

Another wandering soul screaming 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 dec 13 2022 23 sec 69/50 words

It’s kinda neat how CSS animation rules are sort of simple in their construction. , rules could be made even simpler if the animation-delay property also allowed delays between iterations/intervals instead of at the start only. Interval delays could allow for writing drastically less key frame rules.

css
text-animation[hang] {
  animation: tilt-rightward 1.3s infinite, tilt-leftward 1.8s infinite;
}
Combining two key frame animations to create a hanging effect.
#gists #webdev
tdro

Another wandering soul screaming 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 sep 27 2022 25 sec 74/50 words

Chrome --headless can dump the to the command line. Set a virtual time budget in [?] for the to settle down and then do stuff.

shell
Html() {
  chromium \
    --headless \
    --incognito \
    --dump-dom \
    --virtual-time-budget=999999 \
    "$1"
}

HtmlToText() {
  lynx -stdin -dump -nolist
}

This has “peculiar” uses. Fun fact: invoking the name of chromium around normal people confers alien–like status.

shell
Html 'https://www.youtube.com/' | HtmlToText
#gists
tdro

Another wandering soul screaming 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 sep 2 2022 17 sec 50/50 words
tdro

Another wandering soul screaming 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 aug 26 2022 47 sec 142/50 words
My puppeteer scripts now use deno.

No more need for npm in my personal stack! spawnSync + which returns the local browser’s path.

javascript
import puppeteer from "https://deno.land/x/puppeteer@16.2.0/mod.ts";

const chrome = "firefox";   /* Browser Chrome: "firefox" | "chromium" | "google-chrome" | ... */
const product = "firefox";  /* Product Base:   "firefox" | "chrome" */

const { status, stdout, stderr } = Deno.spawnSync("which", {
  args: [ chrome, ],
});

const executablePath = new TextDecoder().decode(stdout).trim();

const browser = await puppeteer.launch({
  headless: false,
  executablePath: executablePath,
  product: product,
});

const page = await browser.newPage();
await page.setViewport({ width: 1024, height: 768, });

const sites = [ "example.com", ];

for (const site of sites) {
  await page.goto("http://" + site);
  await page.screenshot({ path: site + ".png" });
}

await browser.close();
Basic Boilerplate: Captures a picture of example.com (main.ts)
shell
deno run --allow-all --unstable main.ts
Deno Version: 1.23.0
#gists #webdev
tdro

Another wandering soul screaming 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 jul 6 2022 27 sec 82/50 words
Web servers can be spun up quickly on the command line but with gotchas.

Take the innocent web server .

shell
php -S 127.0.0.1:8080

Best not to use PHP’s web server cli (even for PHP) because routes with a dot (.) are assumed to be static files. Use a real web server or superior cli web servers with minor gotchas.

shell
python -m http.server --bind 127.0.0.1 8080
busybox httpd -f -p 127.0.0.1:8080
ruby -run -e httpd . -p 8080
#gists #webdev
Newest Oldest

Authors

Web Ring