Skip to content

Instantly share code, notes, and snippets.

View ivan's full-sized avatar
🕸️

Ivan Kozik ivan

🕸️
View GitHub Profile
@ivan
ivan / 2024_reading.md
Last active February 9, 2025 22:28
2024 reading list
@ivan
ivan / README.md
Created December 24, 2023 06:29
I just need to find a good game to play

Game reviews of things I'm trying EOY 2023 - early 2024

@ivan
ivan / 2023_reading.md
Last active February 6, 2025 13:15
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 / Anti-information.md
Created September 11, 2023 01:57
Anti-information

Not good information

@ivan
ivan / cargo.sh
Last active December 13, 2024 17:03
cargo wrapper for NixOS and Rust nightly: mold, target-cpu, -Z share-generics
#!/usr/bin/env bash
# NixOS-only cargo wrapper that:
# - always uses mold for linking.
# - sets `-C target-cpu=haswell` to avoid generating code for pre-2013 CPUs.
# - sets `-C link-arg=-Wl,--compress-debug-sections=zlib-gabi` to compress debug sections.
# - sets LIBCLANG_PATH for projects that need clang.
# - sets `-Z share-generics` to reduce output binary sizes by ~2MB.
# - turns on cargo's sparse-registry feature.
# - increases niceness slightly with `nice -n 2` .
@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 / freerdp-dpi-help.md
Last active October 21, 2024 01:47
Use FreeRDP with non-standard DPI
xfreerdp /dynamic-resolution +decorations +fonts +aero +window-drag +multitransport /bpp:16 /rfx /codec-cache:rfx /video /scale-desktop:172 /scale-device:100

172% is the scaling factor we want.

/scale-device:100 is required because fucking Microsoft: "desktopScaleFactor (4 bytes): A 32-bit, unsigned integer. The requested desktop scale factor. This value MUST be ignored if it is less than 100% or greater than 500% or deviceScaleFactor is not 100%, 140%, or 180%. If this field is present, then the desktopOrientation and deviceScaleFactor fields MUST also be present."

https://msdn.microsoft.com/en-us/library/cc240510.aspx

@ivan
ivan / fix-vscode-server-binaries.nix
Last active September 16, 2024 23:59
Fix vscode server for NixOS
# Based on https://gist.github.com/sonowz/d70b03177c344f4bbbc674de5e5bb937
with import <nixpkgs> {};
let
pname = "fix-vscode-server-binaries";
script = pkgs.writeShellScriptBin pname ''
set -eu -o pipefail
SCRIPT_DIR="$(dirname -- "$(readlink -f -- "$0")")"
@ivan
ivan / firefox.org.txt
Created August 23, 2024 07:06
Firefox/Floorp things
* Floorp advantages over Chrome
** Padding isn't crazy in the bookmarks and menus
** Tree Style Tab
** Ctrl-Tab in MRU order
** Doesn't plan to remove Manifest V2 and break uBlock Origin
** Can use address bar and bookmarks while in fullscreen
** If tab is open, pressing Enter on suggestion switches to tab; don't need to Tab over to the 'switch to tab' suggestion as in Chrome
** Zooming on an image (loaded in its own tab) doesn't change the zoom level for the domain
** Supports JPEG XL
** Can alt-double and triple click inside links to select text and not download the link target