In UNIX everything is a file. A file is a file and a directory is a special kind of file…
I saw something peculiar the other day. Hallucination? The microsoft.com domain was serving up 192.168.1.0 and 192.168.1.1 as A records in a 7 address round robin.
That’s a spooky reminder to check your rebinding setup — that is, if you’re playing with fire ().
For example,
unbound
with private-address
and private-domain
. Then
test if DNS rebinding is possible.
Are the caches warmed up? vmtouch and fincore are two useful programs.
What do they do? Basically, one can peek at what’s been cached into memory. I somehow ended up re–looking into this today. The Linux kernel is intelligent.
Many fortnights ago, I foolishly thought writing a theme from scratch would be easy. It was mostly unlike GTK2. About 40 minutes in came a horrifying realization: there’s fundamentally (and definitively) no way to write a consistent theme that works reliably with every application. The minor upside was a working (and somewhat accessible) wireframe theme and a basic understanding of debugging. The end.
GTK_DEBUG=interactive firefox
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?
smem -s swap -kta
smem --sort swap --abbreviate --totals --autosize
What about on other categories running a --sort
?
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;
df -h | grep tmpfs
df --human-readable | grep tmpfs
Incus is worth a look. It’s the fork of LXD, a container and orchestration/hypervisor program for cluster setups and infra models. Incus sits on top of the lower level LXC (Linux Containers).
- Incus Documentation: https://linuxcontainers.org/incus/docs/main/
- Incus Package Files: https://github.com/zabbly/incus#readme
- Incus Repository: https://github.com/lxc/incus#readme
- Incus Demo: https://linuxcontainers.org/incus/try-it/
Some nix
language gotchas I’ve experienced while using
NixOS personally:
- Avoid
with
expressions unless with theinherit
keyword for identifying hidden attributes in scope. - Avoid the
rec
keyword unless there’s tracking/control of infinite set recursion (self naming/references). - Avoid importing more than 1 instance of
<nixpkgs>
for any evaluation chain unless there’s magic compute and “infinite” memory.
Tricky is numero three, but crucial for fast feedback regardless of the current thing? I don’t poke around as much to know anymore but; legacy, flakes, community, and possibly others.
Ho, some of us think alike. I stumbled onto this site while looking up related unshare namespace configuration. I do something similar.
Different words similar meaning?
--references
is NixOS speak for direct
package dependencies.
--requisites
list all. These work with the
nix-store
command.
$ 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
.
guix graph --type=references which
I’ve had a draft post of Guix notes written up for a while now. Did you know that it’s easy to generate a file system specified from a config.scm? It’s somewhat equivalent to nixos-install, pacstrap and the like.
guix system init --no-bootloader config.scm filesystem/
Why? Commands like this are handy for messing around with chroots, containers, and other related stuff!