Skip to content

Instantly share code, notes, and snippets.

View ivan's full-sized avatar
🕸️

Ivan Kozik ivan

🕸️
View GitHub Profile
@ivan
ivan / Anti-information.md
Created September 11, 2023 01:57
Anti-information
View Anti-information.md

Not good information

@ivan
ivan / nix-serve-ng segfault.txt
Created September 8, 2023 05:26
nix-serve-ng segfault
View nix-serve-ng segfault.txt
Sep 08 05:18:38 ra nix-serve-start[1822]: 10.10.0.1 - - [08/Sep/2023:05:18:38 +0000] "GET /nix-cache-info HTTP/1.1" 200 - "" "curl/8.1.1 Nix/2.17.0"
Sep 08 05:18:38 ra kernel: nix-serve:w[831166]: segfault at f32 ip 00007ed18bb6c2a3 sp 00007ed182ff8540 error 4 in libnixutil.so[7ed18bb4b000+81000] likely on CPU 18 (core 18, socket 0)
Sep 08 05:18:38 ra kernel: Code: 00 74 04 ff 47 08 c3 f0 ff 47 08 c3 90 66 2e 0f 1f 84 00 00 00 00 00 41 54 55 53 48 8b 2f 48 39 fd 74 37 49 89 fc 90 48 89 eb <48> 8b 6d 00 48 8b 7b 10 48 8d 43 20 48 39 c7 74 0d 48 8b 43 20 48
Sep 08 05:18:38 ra systemd[1]: Created slice Slice /system/systemd-coredump.
Sep 08 05:18:38 ra systemd[1]: Started Process Core Dump (PID 831186/UID 0).
Sep 08 05:18:39 ra systemd-coredump[831187]: [🡕] Process 1822 (nix-serve) of user 62540 dumped core.
Module libattr.so.1 without build-id.
Module libkeyutils.so.1 without build-id.
@ivan
ivan / notify-yourself.sh
Created August 18, 2023 05:13
notify yourself using signal-cli
View notify-yourself.sh
#!/usr/bin/env bash
set -eu -o pipefail
message=$1
sender=+SERVERPHONE
recipient=+YOURPHONE
sender_for_dbus=${sender//+/_}
@ivan
ivan / axum thing.rs
Created August 14, 2023 06:58
axum thing.rs
View axum thing.rs
/// Error indicating failure to parse strictly a natural number
#[derive(thiserror::Error, Debug, Clone)]
#[error("could not parse as natural number without leading 0 or +")]
pub struct ParseNaturalNumberError;
/// Parse strictly, forbidding leading '0' or '+'
#[inline]
fn parse_natural_number<T: FromStr>(s: &str) -> Result<T, ParseNaturalNumberError> {
if s.starts_with('0') || s.starts_with('+') {
@ivan
ivan / data.csv
Created August 6, 2023 05:40
IRC messages with "twitter.com/" in the message, over time
View data.csv
Month IRC messages logged IRC messages logged with "twitter.com/" Percent mentioning Twitter
2015-02 17195404 8917 0.052%
2015-03 17749799 11017 0.062%
2015-04 16134253 15596 0.097%
2015-05 15123528 10197 0.067%
2015-06 15933871 12762 0.080%
2015-07 16113608 10884 0.068%
2015-08 16010748 7457 0.047%
2015-09 14542928 8772 0.060%
2015-10 14512795 9395 0.065%
@ivan
ivan / CSS light and dark mode.css
Last active August 11, 2023 23:04
CSS light and dark mode without JavaScript requirement and with a class-based override on <html>
View CSS light and dark mode.css
html {
background-color:
var(--LIGHT, #eee)
var(--DARK, #111);
color:
var(--LIGHT, #000)
var(--DARK, #ccc);
}
html {
@ivan
ivan / nixpkgs.patch
Created July 24, 2023 18:28
New AMD microcode hopefully fixing CVE-2023-20593 for nixpkgs
View nixpkgs.patch
diff --git a/pkgs/os-specific/linux/firmware/linux-firmware/default.nix b/pkgs/os-specific/linux/firmware/linux-firmware/default.nix
index a2229a0a60ce..025fcf049dd0 100644
--- a/pkgs/os-specific/linux/firmware/linux-firmware/default.nix
+++ b/pkgs/os-specific/linux/firmware/linux-firmware/default.nix
@@ -1,6 +1,4 @@
-let
- source = import ./source.nix;
-in {
+{
stdenvNoCC,
@ivan
ivan / setfacl with dynamic systemd users.txt
Created July 22, 2023 08:31
setfacl with dynamic systemd users
View setfacl with dynamic systemd users.txt
# setfacl -R -m u:photoprism:rX Pictures
setfacl: Option -m: Invalid argument near character 3
08:25:14 <ivan> why can I `setfacl -R -m u:photoprism:rX` on one machine but not another
08:25:42 <ivan> neither machine has a `photoprism` user or group
08:25:59 <ivan> nixos configuration is the same with a simple photoprism service enable = true;
08:27:32 <ivan> I _can_ u: another user that actually exists so it's not a btrfs issue
08:28:34 <ivan> oh my god
08:28:35 <ivan> systemctl restart photoprism; setfacl -R -m u:photoprism:rX Pictures
08:28:43 <ivan> it works while photoprism is running with its DynamicUser
@ivan
ivan / freedom.md
Last active July 19, 2023 02:24
the freedom to make things a little worse without getting punished for it immediately
View freedom.md

Someone made the product worse, but not so much that it has become a priority for me to do something about it.

The corollary is that if you make something a little worse, people won't necessarily be moved to expend their time and social capital to tell you about it. You largely have to critique your own work and notice your own little regressions.

@ivan
ivan / meta.md
Created July 9, 2023 05:57
educator
View meta.md

If you see someone teaching something online properly, save the irrational gift from the gods while you can, before they realize their time is better spent doing anything but being an educator in public. These kinds of surpluses come and go.