Skip to content

Instantly share code, notes, and snippets.

View ivan's full-sized avatar
🕸️

Ivan Kozik ivan

🕸️
View GitHub Profile
@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>
html {
background-color:
var(--LIGHT, #eee)
var(--DARK, #111);
color:
var(--LIGHT, #000)
var(--DARK, #ccc);
}
html {
@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

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

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.

@ivan
ivan / information.md
Last active July 8, 2023 01:28
Questions to ask when managing the deluge of information to consume
  1. Is this something you can save and look up later when your work context makes it more salient? You'll get a lot more out of it then.

  2. Does random sampling of the text or its conclusions suggest that this is worth your time? Generally, things are either fractally good or fractally bad.

  3. Can you get 50% of the value in 1% of the time? Sometimes you can, if what you needed was just a reference to something you didn't know about.

  4. Is this information more general and useful, or are you in some backwater of meaning? Gossip, ephemera, personalities and memoirs, half-baked ideas.

  5. Did you arrive at this information through your own attentional mechanisms? Consuming the feed can be fun but costly in time. How much more interesting is it, really, than the information that is relevant to your goals? Are you prioritizing momentary pleasure over information hygiene and attentional control?

@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 / 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 November 1, 2024 01:11
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

  • $310K for a year of MSSQL support
  • $192K for Traefik support
  • $27.5K for a https://snyk.io/ renewal
  • $233K for YotaScale renewal while "working on our own internal tool with a goal to replace Yotascale with an alternative which will allow for better customization & self-service options"
  • $30K for RStudio renewal for their data scientists
  • $12K/year for Nasdaq Governance Solutions to "allow directors and section 16 officers of the company to complete required disclosure questionnaires using an online questionnaire platform"
  • unknown amount for 800 licenses of Lightstep "a cloud-based tracing solution that can track the communication and dependency among the HTTP or gRpc services, and help debug latency or performance issues"
  • $125K/year for https://www.kodex.us/ "Kodex. The purpose of this tool is to enable secure receiving and responding to law enforcement requests. Kodex will also take on ownership of verifying law enforcement agencies as well as flagging if they deem a request suspicious. Kodex i
@ivan
ivan / Python resources.md
Last active September 29, 2025 01:52
Python resources

For programming beginners who want to learn Python, these are some of the better resources I know about: