Skip to content

Instantly share code, notes, and snippets.

View ivan's full-sized avatar
🕸️

Ivan Kozik ivan

🕸️
View GitHub Profile
@ivan
ivan / thoughts.md
Last active May 12, 2024 04:02
Thoughts on online dating and social networking apps after 7 years

OLD and SNS apps claim to provide value that is generally not delivered unless you are elite, or above some kind of threshold for attracting enough people to make it worthwhile; within a month or so you should be able to determine where you stand, and if you are below the threshold the only rational thing to do is cease use and do anything else with your time; popularity will not come from improved skill in using them; it's not like programming where years of practice will make it better, so said apps can easily deceive people with prior skill acquisition experiences, more hope, or long-term thinking.


If we exclude the rare and random rewards of friendship or good information (better than you'd get through other uses of time), a rational person would:

  • keep using online dating app if it were a semi-reliable source of dates with people they might like
  • keep using social networking app if it were improving their distribution through being retweeted/recommended, or semi-reliably connecting them with re
@ivan
ivan / yt-dlp-use-deno-for-nsig.patch
Created May 13, 2023 00:41
yt-dlp: use deno for nsig extraction
diff --git a/yt_dlp/extractor/youtube.py b/yt_dlp/extractor/youtube.py
index b9623cbf8..abe996273 100644
--- a/yt_dlp/extractor/youtube.py
+++ b/yt_dlp/extractor/youtube.py
@@ -19,6 +19,8 @@
import urllib.error
import urllib.parse
import urllib3
+import tempfile
+import subprocess
@ivan
ivan / urls-and-time.md
Last active April 11, 2023 14:41
A less naïve perception of URLs

Ordinarily, when we encounter a URL, we take just the URL by itself and do something with it; perhaps we try to load it in our browser or store it somewhere.

We can consider this to be the more naïve interpretation of a URL: we assume we're always fine with the latest version of the document, or the document is unchanging, or the changes don't really matter; we try to load the URL in our browser and if the website is gone or not the version we expect, well, tough luck for us.

But we can make our perception of URLs a little less naïve, as there is another piece of data we can take when we see a URL: the time that the URL was posted. Fortunately, we typically encounter URLs in documents or messages with some sort of timestamp.

So instead of taking URL, we take (URL, referring_document_time), which enables us to know which version of the document that author was referring to. We can then, for example, look up that website around that point in time in Wayback Machine. In other cases, when a website parti

@ivan
ivan / asyncread poll_read footgun.md
Last active April 7, 2023 12:22
tokio::io::AsyncRead poll_read implementation footgun

The tokio::io::AsyncRead documentation confusingly states:

Poll::Ready(Ok(())) means that data was immediately read and placed into the output buffer. The amount of data read can be determined by the increase in the length of the slice returned by ReadBuf::filled. If the difference is 0, EOF has been reached.

https://docs.rs/tokio/latest/tokio/io/trait.AsyncRead.html

The footgun is that when poll_read is called, buf may already be partially filled. In some cases, this happens just a small fraction of the time in production, causing e.g. the last chunk of a file to be poll_read twice.

Setup code:

@ivan
ivan / Cults are patronage networks.md
Last active May 2, 2023 17:29
Cults are patronage networks

Cults are patronage networks. They distribute benefits. The benefits could be intangible, they don't have to be money. Belonging is a benefit, acceptance is a benefit, access to [partners] is a benefit, money is a benefit of course, but also power is a benefit; an internal hierarchy. It's a fantasy, it's what we call in psychology is a paracosm. A paracosm is an alternative cosmos; it's detached, it's a bubble. And so within this bubble you can create an entire universe with its own laws of physics of you wish, and then if you play by these rules, you're mightily rewarded, emotionally, materially, in other ways. And if you don't, of course, you're sanctioned, similarly. So it's what we call a reinforcement system. It's a reward-punishment system. Positive and negative. And it's fairly intermittently by the way, it's fairly intermittent in the sense that very often, the leader kind of punished you to remind you that you're still at his mercy. He demotes you, he criticizes you publicly, he does something to

@ivan
ivan / Build CockroachDB on NixOS.md
Last active July 8, 2023 08:04
Build CockroachDB on NixOS (Cockroach Build Secrets Exposed)

Build CockroachDB on NixOS

(entirely serious, this is how you do it, last tested July 8, 2023)

Summary: you can use nixpkgs's bazel_6 to build and run CockroachDB's bazelbuilder Docker container, which will use the bazel version it really wants to use for building cockroach. You need to patchelf a few things along the way, and then patchelf the resulting cockroach binary.


  1. Add this to your NixOS configuration:
@ivan
ivan / 2023_reading.md
Last active May 23, 2024 02:39
2023 reading list

[This page is best viewed with https://github.com/ludios/expand-everything, which will load all the comnents below.]

Wherein I try to prioritize reading for the limited amount of time I have this year, and to remind myself to read more than just comments on the Internet. Because of problems of time and shifting interests, I will consider this a success if I read a third of the list. I'll reflect on the reading and deviations from the plan in Jan 2024.

{+} = added after initial planning

@ivan
ivan / All known numeric-only YouTube video IDs.md
Last active July 12, 2023 07:20
All known numeric-only YouTube video IDs as of 2023-07-12
@ivan
ivan / cherry-pick-version-bumps.sh
Last active December 15, 2022 08:53
git cherry-pick version bumps from nixpkgs master onto your nixpkgs release branch
#!/usr/bin/env bash
# This is intended to be run in a git checkout of nixpkgs
set -eu -o pipefail
dirs=(
./pkgs/development/tools/esbuild
./pkgs/applications/misc/calibre
)
@ivan
ivan / saving your tweets with snscrape and SingleFile cli.md
Last active November 29, 2022 13:40
saving your tweets with snscrape and SingleFile cli

Another way to save your own tweets exactly as they are rendered on Twitter, with replies, using snscrape and SingleFile/cli:

  1. TWEETER=someusername
    snscrape twitter-user ${TWEETER} | grep -o -P '\d+$' | sed -r 's,^,https://twitter.com/i/status/,g' > ${TWEETER}-tweets # write a URL list
    
  2. Make sure the oldest tweet in this list is in fact your oldest tweet, and that snscrape did not stop early due to Twitter Search problems.
  3. Merge in all the tweet URLs from your Twitter data export, to include retweets and Circle tweets:
    cat data/tweets.js | sed -r 's/^window\.YTD\.tweets\.part0 = //' | jq -r '.[].tweet.id' | sed -r 's,^,https://twitter.com/i/status/,g' >> ${TWEETER}-tweets