diff options
| author | rtk0c <[email protected]> | 2025-09-01 13:31:50 -0700 |
|---|---|---|
| committer | rtk0c <[email protected]> | 2025-09-01 13:31:50 -0700 |
| commit | 3b3ded70587af4e780ed18697cd2be8ff48efe67 (patch) | |
| tree | 7c24e6719b2f34a7395432470c74c3e5d8ebd79b | |
| parent | 6e3af2d649b2931b9928a6d3ef21a90bbd86c35d (diff) | |
Big spell correction, using LTeX vscode extension
which is languagetools under the hood
which I struggled immensely trying to setup in emacs back then... now I give up
| -rw-r--r-- | content/blog/adventures-on-monitorless-server.md | 8 | ||||
| -rw-r--r-- | content/blog/cs166-tips-tricks.md | 36 | ||||
| -rw-r--r-- | content/blog/link-clearance/1.md | 6 | ||||
| -rw-r--r-- | content/blog/link-clearance/2.md | 2 | ||||
| -rw-r--r-- | content/blog/link-clearance/3.md | 6 | ||||
| -rw-r--r-- | content/blog/on-continuations.md | 12 | ||||
| -rw-r--r-- | content/blog/org-mode-watchlist.md | 2 | ||||
| -rw-r--r-- | content/blog/tailscale-and-sjsu-vpn.md | 36 | ||||
| -rw-r--r-- | content/blog/vim-kitty-compat.md | 8 |
9 files changed, 58 insertions, 58 deletions
diff --git a/content/blog/adventures-on-monitorless-server.md b/content/blog/adventures-on-monitorless-server.md index 47b61db..84843c3 100644 --- a/content/blog/adventures-on-monitorless-server.md +++ b/content/blog/adventures-on-monitorless-server.md @@ -15,7 +15,7 @@ SSH to your hearts content. --- So the story goes like this. -I recently got hands on a nice little old desktop tower, plenty of RAM and a good number of SATA ports for selfhosting: Seafile, Immich and what not. +I recently got hands on a nice little old desktop tower, plenty of RAM and a good number of SATA ports for self-hosting: Seafile, Immich and what not. Now it _is_ rather old machine, with only VGA and DVI on the motherboard. This means my little trusty HDMI to USB video capture dongle won't be helpful! I also need to deploy this machine to my parent's house, for I plan on giving them access to a photo backup solution. I need to bring a monitor that has a VGA port on it. @@ -26,7 +26,7 @@ And as all good stories go, the _one thing_ I was supposed to do was not done. I _Uh. oh._ -There is no proper DHCP in the lan, I had everything else setup with static IPs. I don't know its MAC, so no calculating SLAAC by hand to get a link local IPv6 either. In fact, if I remember correctly I don't even think the gateway was properly setup with IPv6 at all. +There is no proper DHCP in the LAN, I had everything else setup with static IPs. I don't know its MAC, so no calculating SLAAC by hand to get a link local IPv6 either. In fact, if I remember correctly I don't even think the gateway was properly setup with IPv6 at all. No network, no SSH. @@ -36,8 +36,8 @@ Quickly, I thought "what if I could just type out all the commands without a mon Trying to open vim on `/etc/network/interfaces` and blindly modifying a complex configuration file obviously did not work so well. Although I did figure out one helpful tidbit: since this machine has a beeper, I can run things like `foobar && tput bel` in TTY to get an audio confirmation that something succeeded. -After ten minutes of desparately trying various commands and questioning if I had been making typos all along, an enlightenment suddenly found its way into my mind: nothing is stopping me from running an ad-hoc DHCP server just for this purpose! -As far as I know, all of the networking implementations shipped by various Linux distros default to DHCP. This includes `NetworkManager`, `systemd-networkd`, or even Debian's default networking setup. +After ten minutes of desperately trying various commands and questioning if I had been making typos all along, an enlightenment suddenly found its way into my mind: nothing is stopping me from running an ad-hoc DHCP server just for this purpose! +As far as I know, all the networking implementations shipped by various Linux distros default to DHCP. This includes `NetworkManager`, `systemd-networkd`, or even Debian's default networking setup. [Kea](https://www.isc.org/kea/) is apparently the recommended implementation, so I installed it on my laptop, and after some fiddling of configs per the [ArchWiki](https://wiki.archlinux.org/title/Kea) (because ArchWiki is the one wiki to rule them all), it did work. The server allocates the first address in the pool, so I just picked `192.168.233.1/16` and successfully SSH-ed in. diff --git a/content/blog/cs166-tips-tricks.md b/content/blog/cs166-tips-tricks.md index 82a17e9..f9bbb8c 100644 --- a/content/blog/cs166-tips-tricks.md +++ b/content/blog/cs166-tips-tricks.md @@ -23,13 +23,13 @@ A very light, Windows-only hex editor. I use it on my laptop for quick things. I ImHex <https://imhex.werwolv.net/> -Much more powerful, but heavier. It has builtin support for pattern matching, processing, disassembly, etc. It also just looks _really really nice_, 200% eye candy factor. +Much more powerful, but heavier. It has built-in support for pattern matching, processing, disassembly, etc. It also just looks _really really nice_, 200% eye candy factor. ## C compiler Some assignments supply C source code that you'll have to compile. In general, they are not compatible with MSVC (Visual Studio), so special care needs taken on Windows. - macOS: install Xcode Command Line Tools, which contains an Apple-flavored clang. Alternatively, install either clang or gcc from [Homebrew](https://brew.sh/). -- Liunx: your distro's gcc will do. Or clang if you like that. Honestly if you use Linux why are you even reading this section, go away. :P +- Linux: your distro's gcc will do. Or clang if you like that. Honestly if you use Linux why are you even reading this section, go away. :P - Windows: install some flavor of gcc - I highly recommend <https://nuwen.net/mingw.html> It’s tiny, just a zip file. Unzip it, you get a `open_distro_window.bat`, which when opened gives you a terminal with everything setup. There is _zero_ room for `PATH` to go wrong. @@ -38,7 +38,7 @@ Some assignments supply C source code that you'll have to compile. In general, t {{< details summary="What's MinGW and what does it have to do with msys2 and cygwin" >}} In short, gcc is to MinGW as Linux is to distros. -gcc is a whole bunch of code that can turn C source code, among other things, into an executable. It's designed to run on various \*nix platforms. +gcc is a bunch of code that can turn C source code, among other things, into an executable. It's designed to run on various \*nix platforms. MinGW is a bunch of extra code _on top of gcc_ to make it (1) run on Windows, and (2) produce Windows ("PECOFF") executable. @@ -50,7 +50,7 @@ For MinGW, these projects do the same job: - https://cygwin.com/ \ This one tries to emulate the *nix environment on Windows. Comes with quite a few extra programs like bash. _See google._ - https://www.msys2.org/ \ - This one builds a whole bunch of softwares in addition to MinGW: bash, make, etc. It's quite complicated, due to those software requring compatibility layers like cygwin to function. I won't explain here. _See google._ + This one builds a bunch of software in addition to MinGW: bash, make, etc. It's quite complicated, due to those software requiring compatibility layers like cygwin to function. I won't explain here. _See google._ - etc. Regardless of which one you download, you get a copy of gcc (and MinGW). The difference is the default configs, and the extra software they ship with gcc. @@ -69,17 +69,17 @@ I am talking specifically about the offline disassembly and analysis functions. I recommend **Ghidra** because that's what I use. Realistically, for the things you'll do in this class, either choice will work just fine. -Similarly, comments below are targeted to use for this class. They're are shallow on purpose. +Similarly, comments below are targeted to use for this class. They're shallow on purpose. - [Ghidra](https://ghidra-sre.org). Completely free and open-source. Looks kind of ugly but once you get over that and interaction logic, it's good. -- [ ] [IDA Pro](https://hex-rays.com/ida-pro). Slightly closer eye candy. The built-in pattern matching works slightly better. Lots of people like it, so it (must also be) good. _This costs money_, there is a [free version](https://hex-rays.com/ida-free) but it doesn't come with a decompiler... not good. +- [IDA Pro](https://hex-rays.com/ida-pro). Slightly closer eye candy. The built-in pattern matching works slightly better. Lots of people like it, so it (must also be) good. _This costs money_, there is a [free version](https://hex-rays.com/ida-free), but it doesn't come with a decompiler... not good. - According to legend, alfs who have passed the great challenge will be rewarded a completely legitimate, legal way of using IDA Pro. Let the brave thus sail forth. + According to legend, all who have passed the great challenge will be rewarded a completely legitimate, legal way of using IDA Pro. Let the brave thus sail forth. -- [Binary Ninja](https://binary.ninja). Apparently this is a thing so I'm including it here for completeness, never used, never heard until today, no remarks. +- [Binary Ninja](https://binary.ninja). Apparently this is a thing, so I'm including it here for completeness, never used, never heard until today, no remarks. -None of these are intuitive, so please consult the respective _manuals_ and youtube _tutorial videos_ copiously. I shall not provide any guidance here because this blog will turn into the thickness of _Critique of Pure Reason_ or something. +None of these are intuitive, so please consult the respective _manuals_ and YouTube _tutorial videos_ copiously. I shall not provide any guidance here because this blog will turn into the thickness of _Critique of Pure Reason_ or something. ## x86 Dynamic Analysis @@ -91,9 +91,9 @@ I really like [x64dbg](https://x64dbg.com) (which does both x86\_32 and x86\_64) As of the writing of this blog, I shall claim FernFlower is the best Java decompiler available._<sub>runs<sub><sub>don't slap me don't slap me</sub></sub></sub>_ -Admittedly, I'm biased because I worked on Minecraft modding for a while, and Fernflower is what the whole community settled on... anyways! +Admittedly, I'm biased because I worked on Minecraft modding for a while, and FernFlower is what the whole community settled on... anyways! -It's bundled in **IntelliJ IDEA**. You can just open any .class file and it will decompile. +It's bundled in **IntelliJ IDEA**. You can just open any .class file, and it will decompile. It's also available as a **CLI tool**. If you're going this route, consider using one of the forks that grew from the Minecraft modding efforts, such as [Vineflower](https://vineflower.org). It's not going to matter for whatever you'll be doing in this class, but support their efforts! @@ -107,14 +107,14 @@ I did end up in quite a rabbit hole trying to find the exact solution. These are - https://math.stackexchange.com/questions/1539271/probability-of-exactly-two-pairs-share-a-birthday-and-each-pair-shares-differen {{< details summary="More hint" >}} -It's the square root approximation that’s implied, but much glossed over in the textbook. Fuller explaination here: +It's the square root approximation that’s implied, but much glossed over in the textbook. Fuller explanation here: https://en.m.wikipedia.org/wiki/Birthday_problem#Square_approximation {{< /details >}} ## Problem 24 - MD5 collision ### I'm getting different hashes The messages are supposed to be binary files, but the textbook gave them in hex codes. -You probably need something like `xxd -r -p`, or [powershell](https://stackoverflow.com/a/64927815), or your hex editor of choice, to turn it into a binary message. +You probably need something like `xxd -r -p`, or [PowerShell](https://stackoverflow.com/a/64927815), or your hex editor of choice, to turn it into a binary message. {{< details >}} Something like these will work: @@ -146,7 +146,7 @@ FYI, `cut` is used to strip the address column from the string. {{< /details >}} ## Problem 39 - stenography -### Getting a blank PDF on windows +### Getting a blank PDF on Windows The given `stegoRead.c` and `stego.c` is using `fopen(2)` in text mode, and CRT on Windows _may_ expand byte sequence 0A (\n) to 0D 0A (\r\n). I'm honestly not sure when it decides to do that. Add `b` to the mode of all instances of `fopen(...)`. For example, change `fopen(outfname, "w")` into `fopen(outfname, "wb")` @@ -162,7 +162,7 @@ If you have macOS/Linux, they should all work just fine in Wine (or variants it ## x86 assembly You'll need a basic understanding of x86 32-bit assembly for this chapter. Very little is required, so whatever you know above another assembly should be transferable. -General tip 0: x86 assembly has 2 syntax flavors, AT&T and Intel. Internet resources may use either, just be ware. GCC and whatnot by default produces AT&T syntax (🤮); if you see lots of % everywhere, or things like `movq` it's this. The textbook and all the reverse engineering tools use Intel syntax (💖 as they should); if you see square brackets `[rip+32h]` or bare `mov`'s, it's this. +General tip 0: x86 assembly has 2 syntax flavors, AT&T and Intel. Internet resources may use either, just beware. GCC and whatnot by default produces AT&T syntax (🤮); if you see lots of % everywhere, or things like `movq` it's this. The textbook and all the reverse engineering tools use Intel syntax (💖 as they should); if you see square brackets `[rip+32h]` or bare `mov`'s, it's this. General tip 1: `je`/`jz` and `jne`/`jnz` are the same instructions, just different mnemonics. You can always replace either with an unconditional `jmp` in place, they have the same encoding length. @@ -173,9 +173,9 @@ General tip 3: almost all the string literals are contained in the `.rdata` sect General tip 4: `rip` is the instruction pointer. Your debugger probably has a "set `rip` here" function to jump around. ## The program just exits immediately after I type something -Basically, when you double click to open a .exe that's a [Console program](https://stackoverflow.com/questions/574911), Windows only keeps the terminal open for as long as the program is running. Since the program exits right after it prints the last thing, it'll "exit immediately after I type something". +Basically, when you double-click to open a .exe that's a [Console program](https://stackoverflow.com/questions/574911), Windows only keeps the terminal open for as long as the program is running. Since the program exits right after it prints the last thing, it'll "exit immediately after I type something". -The proper way to do this is open a Cmd or Powershell window, run the .exe from inside like `path/to/my/program.exe`. +The proper way to do this is open a Cmd or PowerShell window, run the .exe from inside like `path/to/my/program.exe`. This is exactly the same thing as running a command-line program on macOS or Linux: you open Terminal.app, Konsole, Gnome Terminal or whatever, and type `/path/to/my/program` -To save you some head scratching: Note that in Powershell supports `cd D:/path/to/my/folder` directly, but Cmd you have to **type `D:` on it's own to switch drive**, followed by a separate command `cd D:/path/to/my/folder` to change directory in that drive. +To save you some head scratching: Note that in PowerShell supports `cd D:/path/to/my/folder` directly, but Cmd you have to **type `D:` on its own to switch drive**, followed by a separate command `cd D:/path/to/my/folder` to change directory in that drive. diff --git a/content/blog/link-clearance/1.md b/content/blog/link-clearance/1.md index 8617a52..0a9961d 100644 --- a/content/blog/link-clearance/1.md +++ b/content/blog/link-clearance/1.md @@ -8,7 +8,7 @@ This series isn't periodical at all. It'll come out whenever I have enough of th - [Famous hotel signs](https://www.ling.upenn.edu/~beatrice/humor/foreign-hotel-signs.html). If I recall correctly this is linked from a Hacker News discussion on... something linguistics. The rest of the posts on this site are equally funny though. -- [Mozart2](http://mozart2.org) and [Clean](https://clean-lang.org). Two languages linked from The Lisp Curse post for being containing novel and desirable features, being not Lispes (and thus not the /most powerful thing ever/) yet still everyone can learn from. +- [Mozart2](http://mozart2.org) and [Clean](https://clean-lang.org). Two languages linked from The Lisp Curse post for containing novel and desirable features, being not Lisps (and thus not the /most powerful thing ever/) yet still everyone can learn from. - Two discussions on parsing from the [Oils](https://github.com/oils-for-unix/oils/wiki/Lossless-Syntax-Tree-Pattern) [shell](https://github.com/oils-for-unix/oils/wiki/Parsing-is-Difficult) project. @@ -26,9 +26,9 @@ This series isn't periodical at all. It'll come out whenever I have enough of th - Pair of twin articles on [libraries](http://trevorjim.com/libraries-and-open-access) and [open access](http://trevorjim.com/open-access-should-not-mean-sole-access). - All of publishers (money!!?!?) and libraries (out of control) and readers (difficulty in accessing) hates electronic journals. A different route: stop doing the _storage_, stop trying to emulate physical paper electronically — produce PDF or whatever, send to customers, done. Let the libraries take care of the website and everything just like how they take care of printed materials. Maintain a minimal internal archive, suddenly a lot of cost and product leakage_ concerns are gone. + All publishers (money!!?!?) and libraries (out of control) and readers (difficulty in accessing) hates electronic journals. A different route: stop doing the _storage_, stop trying to emulate physical paper electronically — produce PDF or whatever, send to customers, done. Let the libraries take care of the website and everything just like how they take care of printed materials. Maintain a minimal internal archive, suddenly a lot of cost and product leakage_ concerns are gone. - One notable descendent, [what are libraries for](http://web.archive.org/web/20110723192224/http://www.inthelibrarywiththeleadpipe.org/2011/what-are-libraries-for/) (out of the many in there): + One notable descendant, [what are libraries for](http://web.archive.org/web/20110723192224/http://www.inthelibrarywiththeleadpipe.org/2011/what-are-libraries-for/) (out of the many in there): - [For what is anything but a tool?](https://blog.sanctum.geek.nz/vim-koans) diff --git a/content/blog/link-clearance/2.md b/content/blog/link-clearance/2.md index 2b28e82..1ddadc1 100644 --- a/content/blog/link-clearance/2.md +++ b/content/blog/link-clearance/2.md @@ -22,7 +22,7 @@ categories: ["link clearance"] Alternative to After Effects? Found in the said HN comments. - https://navysbir.us/n25_1/N251-024.htm#qa \ - Found this while looking for a self-hosted, ACME-capable certificate authority. For installing one root cert (preferrably with Name Constraint) and can get all homelab devices to use TLS. Without having to deal with things going in the CT. + Found this while looking for a self-hosted, ACME-capable certificate authority. For installing one root cert (preferably with Name Constraint) and can get all homelab devices to use TLS. Without having to deal with things going in the CT. Anyways. Apparently US Navy has this public website for their purchasing programs? - https://gitlab.com/eql/lqml/ \ diff --git a/content/blog/link-clearance/3.md b/content/blog/link-clearance/3.md index 88c6732..cc92489 100644 --- a/content/blog/link-clearance/3.md +++ b/content/blog/link-clearance/3.md @@ -11,7 +11,7 @@ Also, ok, I guess I did put in the effort to add link text, because otherwise th I should put in more effort in distinguishing between verbatim titles in link text, and own paraphrasing. Ugh, too much effort! Sorry! -- [The Eternal Maineframe](https://www.winestockwebdesign.com/Essays/Eternal_Mainframe.html) +- [The Eternal Mainframe](https://www.winestockwebdesign.com/Essays/Eternal_Mainframe.html) Mainframe was never and still isn’t about the physical form, the racks and racks of metal upon which computers hung. It’s about inaccessibility (“priesthood”) and centralization. “If offline use becomes uncommon, then the great and the good will ask: “What are you hiding?” Aren’t all prophesies almost necessarily be slippery slopes? Talks of chance and reasonableness almost certainly fails when the scope is far far long in the future. @@ -35,7 +35,7 @@ I should put in more effort in distinguishing between verbatim titles in link te - [Blacksmithing and Lisp](https://news.ycombinator.com/item?id=43566651) - [What is HDR?](https://www.lux.camera/what-is-hdr/) - Fantastic article (and blog!) clarifying all the mysteries behind HDR, specicially wrt. photography (as opposed to rendering). + Fantastic article (and blog!) clarifying all the mysteries behind HDR, specifically wrt. photography (as opposed to rendering). - Chomsky's (yes that one) [critique on LLM](https://chomsky.info/20230503-2/) @@ -46,7 +46,7 @@ I should put in more effort in distinguishing between verbatim titles in link te - [The radix 2^51 trick](https://www.chosenplaintext.ca/articles/radix-2-51-trick.html) - [Someone's rambling on centering](https://tonsky.me/blog/centering/) - Good introductory ideas, but leaves something to be desired on the topic of actually *designing* iconography and dealing with centering. Also, the sweeping take on icon fonts is inappropriate (granting the point of text centric logic used by fonts is unapt for icons). + Good introductory ideas, but leaves something to be desired on the topic of actually *designing* iconography and dealing with centering. Also, the sweeping take on icon fonts is inappropriate (granting the point of text centric logic used by fonts is inapt for icons). - https://www.hopefulmons.com/p/children-of-the-geissler-tube diff --git a/content/blog/on-continuations.md b/content/blog/on-continuations.md index 918f85d..d57cc22 100644 --- a/content/blog/on-continuations.md +++ b/content/blog/on-continuations.md @@ -35,7 +35,7 @@ which is indeed fascinating, though now _how_ it works and _why_ seem to hide th **Theofanis:** ...sure? -**Asimoula:** We should now then take a detours out of mathematics and theory land, and dive into the dirty waters of real CPUs and implementations. After that, we'll climb on mountain of asynchronous programming, so we can see a different way for using continuations—at the same time so we can look at it from a different, perhaps much higher vantage point. In this way, we'll not be blinded by the great city of Scheme and its fortress of walls, and be able to see the cloud of continuation in its full shape. +**Asimoula:** We should now then take a detour out of mathematics and theory land, and dive into the dirty waters of real CPUs and implementations. After that, we'll climb on mountain of asynchronous programming, so we can see a different way for using continuations—at the same time, so we can look at it from a different, perhaps much higher vantage point. In this way, we'll not be blinded by the great city of Scheme and its fortress of walls, and be able to see the cloud of continuation in its full shape. But enough babbling about, let's jump in: @@ -58,13 +58,13 @@ The Callstack ``` **Theofanis:** Yes, that seems to make sense, now that you talk about. I do seem to recollect about this. -_hesitating, for he being a JavaScript programmer by trade doesn't quite have the C model on top of the head_ +_Hesitating, for he being a JavaScript programmer by trade doesn't quite have the C model on top of the head_ -**Asimoula:** And so as you see, when we return from `bar()`, for hypothetically, we place the return value at a predetermined location, and read the "return address" from another predetermined location, and `jmp` to it. The frame of `bar()` is now free reign for anybody else to write on top of.[^calling-convention] In particular that return address points to a special chunk inside the assembly of `foo()`, that takes care of things after `call`ing `bar()`. But the details are unimportant for us right now. +**Asimoula:** And so as you see, when we return from `bar()`, for hypothetically, we place the return value at a predetermined location, and read the "return address" from another predetermined location, and `jmp` to it. The frame of `bar()` is now free rein for anybody else to write on top of.[^calling-convention] In particular that return address points to a special chunk inside the assembly of `foo()`, that takes care of things after `call`ing `bar()`. But the details are unimportant for us right now. **Theofanis:** Right. -**Asimoula:** Now if you take your hand, and cover up the part of the stack for variables of `bar()` and its babbage, and squint your eyes a little bit, so might realize a magical thing that seems to be happening here: for all we know, Deina who works on `bar()` has just wrote a few bytes into `<return value>` and `jmp`ed to another address at `[rsp+4]`, and he seem to have magically teleported to a place where the blinking lights and whistling crowd resumes into motion, in middle of `foo()`. +**Asimoula:** Now if you take your hand, and cover up the part of the stack for variables of `bar()` and its babbage, and squint your eyes a little bit, so might realize a magical thing that seems to be happening here: for all we know, Deina who works on `bar()` has just written a few bytes into `<return value>` and `jmp`ed to another address at `[rsp+4]`, and he seems to have magically teleported to a place where the blinking lights and whistling crowd resumes into motion, in middle of `foo()`. **Theofanis:** That does seem sort of magical, if you put such metaphors on top of it. @@ -126,7 +126,7 @@ To that idea, _CPS is a property that some programs have. CPS can be obtained ei **Asimoula:** You got it exactly right, my friend. -As some bonus chatter, an naive `call/cc` machinery by stack copying can be quite slow. It would literally copy the entire execution stack, megabytes of data, to the heap, and replace it when reentering the continuation. +As some bonus chatter, a naive `call/cc` machinery by stack copying can be quite slow. It would literally copy the entire execution stack, megabytes of data, to the heap, and replace it when reentering the continuation. Non-naive implementations like [Chicken](https://www.more-magic.net/posts/internals-gc.html) exists, by rewriting the entire program to be CPS. This way, `call/cc` is free because literally everything is already a continuation. But this comes at the tradeoff that everything, even the code that does not _explicitly use_ continuations, are just a little bit slower. @@ -141,7 +141,7 @@ Read on at your own risk (or benefit). [^demonic-breathe]: What I mean by this is `setjmp`/`longjmp` traditionally have a bad reputation among programmers, that it allows non-local control flow ("goto considered harmful"). Also this metaphor isn't all that helpful to showing what continuations are *supposed to* enable; C programs really don't use `setjmp`/`longjmp` similarly to continuations at all. I guess a little bit? -[^calling-convention]: These are all made up for the convenience for the demonstration. I don't remember if any real calling convetions work in this exact way, but even if they do, things like parameters, register spillage, and stack pointer handling are omitted here. Don't take it too seriously. +[^calling-convention]: These are all made up for the convenience for the demonstration. I don't remember if any real calling conventions work in this exact way, but even if they do, things like parameters, register spillage, and stack pointer handling are omitted here. Don't take it too seriously. [^stack-dir]: Usually, the callstack is said to grow downwards (lower address means deeper callstack), based on that most calling conventions do it this way. I am going to call it "upwards" because it probably makes more sense to more people. diff --git a/content/blog/org-mode-watchlist.md b/content/blog/org-mode-watchlist.md index 9c58819..c63fea0 100644 --- a/content/blog/org-mode-watchlist.md +++ b/content/blog/org-mode-watchlist.md @@ -5,7 +5,7 @@ date: 2025-04-19T12:29:00-07:00 Watch progress websites exist for [anime](https://myanimelist.net) and [film](https://letterboxd.com). They work great. Socialization is great. -But they don't record the _exact time_ at which I finished each episode. I find such statistics amusing to dig through in some kind of a year-end review. I also found it tremendously helpful to know which episodes were most recently watched, and in what order. Helps with recollecting the context of each show, especially when chasing more than a couple of shows at the same time. +But they don't record the _exact time_ at which I finished each episode. I find such statistics amusing to dig through in some kind of year-end review. I also found it tremendously helpful to know which episodes were most recently watched, and in what order. Helps with recollecting the context of each show, especially when chasing more than a couple of shows at the same time. Depending on your judgment, using Letterboxd and MyAnimeList may also constitute giving private information to 3rd parties. So I ended with an organization system that's, effectively, top layer of bullet points for the show, and inner layer for the episodes. Something like: diff --git a/content/blog/tailscale-and-sjsu-vpn.md b/content/blog/tailscale-and-sjsu-vpn.md index 46da685..9af00dd 100644 --- a/content/blog/tailscale-and-sjsu-vpn.md +++ b/content/blog/tailscale-and-sjsu-vpn.md @@ -7,15 +7,15 @@ tags: ["SJSU", "networking"] Note this intended for relative networking novices, so I will try to explain every term used. Skip over them if you find it verbose. If you don't care about anything else and just wants to replicate my setup for your home server, go to [this section](#my-journey). Read the TL;DR's in there if that section alone is too long for you too. # Motivation -Virtual mesh networking software, like Tailscale, ZeroTier, tinc, Hamachi and else, practically[^1] cannot establish a direct/p2p connection between a machine on the SJSU wifi and a machine somewhere else, running on a common residential internet. This situation is an example of a hard-NAT to easy-NAT connnection (I'm using terminology from [Tailscale's article on NAT traversal](https://tailscale.com/blog/how-nat-traversal-works)). I really only use Tailscale so that's what I'm concerned with here. +Virtual mesh networking software, like Tailscale, ZeroTier, tinc, Hamachi and else, practically[^1] cannot establish a direct/p2p connection between a machine on the SJSU wifi and a machine somewhere else, running on a common residential internet. This situation is an example of a hard-NAT to easy-NAT connection (I'm using terminology from [Tailscale's article on NAT traversal](https://tailscale.com/blog/how-nat-traversal-works)). I really only use Tailscale, so that's what I'm concerned with here. -Tailscale has an excellent relay service that can gaurentee _a_ connection between two machines even if it can't establish a direct connection. It has surprisingly good latency, mostly under 50ms for me going from SJSU wifi to a home server. But it has really limited bandwidth, on average 15Mbps based on a quick `iperf3` benchmark; this translates to about 1.2MB/s file transfer to my home server (from my experience), which isn't satisfactory for every task. +Tailscale has an excellent relay service that can guarantee _a_ connection between two machines even if it can't establish a direct connection. It has surprisingly good latency, mostly under 50ms for me going from SJSU wifi to a home server. But it has really limited bandwidth, on average 15Mbps based on a quick `iperf3` benchmark; this translates to about 1.2MB/s file transfer to my home server (from my experience), which isn't satisfactory for every task. # Some Background SJSU's network infrastructure works as follows (as of writing this, 2024-05-01): - There are 2 wifi, `SJSU_Premier` and `SJSU_Guest` available to students and faculty. - The subnet is `10.0.0.0/8`. This means, for our purposes, every machine connected to the wifi will get a Local-Area Network/*LAN* ("the wifi") IP address between `10.0.0.1` to `10.255.255.254`. A *subnet* is, for our purposes, just a range of IP address that all machines connected in a LAN will get their local IP address from. - - Both of them seems to be on the same subnet, i.e. machine A in `SJSU_Guest` can reach machine B in `SJSU_Premier` directly. This is based on my testing that joining to either one seems to allow connecting to another machine on the VPN. + - Both of them seem to be on the same subnet, i.e. machine A in `SJSU_Guest` can reach machine B in `SJSU_Premier` directly. This is based on my testing that joining to either one seems to allow connecting to another machine on the VPN. - The gateway of the network is an endpoint-dependent firewall and endpoint-dependent NAT (this combination is what "hard NAT" describes). I assume this is some enterprise grade equipment from Cisco, though that's not super relevant. - No IPv6 support whatsoever, both when connecting to the internet and inside the LAN. @@ -23,28 +23,28 @@ SJSU also provides a VPN service based on the Cisco AnyConnect software. It is d I wanted to utilize the second feature, to make Tailscale connect to my home server over "LAN" created by the VPN. For example if my home server had IP `10.0.12.1` from the VPN, my laptop will be able to connect by that IP directly. Tailscale will pick this up, avoiding having go through their relay. -My home server is running Linux. You can very much accomplish the same thing on Windows or macOS since Cisco provides VPN software for those too. You also won't need to jump through the hoops I did for Linux. +My home server is running linux. You can very much accomplish the same thing on Windows or macOS since Cisco provides VPN software for those too. You also won't need to jump through the hoops I did for linux. # My Journey -What I need to do is basically two things. (1) Setup Cisco Anyconnect on my home server. (2) Make it so that only the LAN subnet goes through the VPN, not all internet traffic. (I don't need to pretend, for example github.com, to be coming from SJSU's network). Number (2) is technically optional but a nice to have. +What I need to do is basically two things. (1) Setup Cisco AnyConnect on my home server. (2) Make it so that only the LAN subnet goes through the VPN, not all internet traffic. (I don't need to pretend, for example github.com, to be coming from SJSU's network). Number (2) is technically optional but a nice to have. ## Setting up the VPN TL;DR: I used [`openconnect-sso`](https://github.com/vlaci/openconnect-sso) on my browser to generate the VPN session token, and copy that to my home server over ssh, and launch OpenConnect with said token. This is because SJSU's account needs to authenticate with Okta/Duo, and that needs a browser. -I can either use Cisco's official Linux software, or use a 3rd-party, open source reimplementation like [OpenConnect](https://www.infradead.org/openconnect/). I _strongly_ prefered the latter since Cisco's official software wants me to download a blob of bash script to do installation, in addition to downloading another "Cisco Secure Desktop" executable from the internet, and running it locally on running. +I can either use Cisco's official linux software, or use a 3rd-party, open source reimplementation like [OpenConnect](https://www.infradead.org/openconnect/). I _strongly_ preferred the latter since Cisco's official software wants me to download a blob of bash script to do installation, in addition to downloading another "Cisco Secure Desktop" executable from the internet, and running it locally on running. - Install `openconnect-sso` using your method of choice. I got it from https://aur.archlinux.org/packages/openconnect-sso - Run `openconnect-sso --server vpn.sjsu.edu --authgroup Student-SSO --user YOUR_SJSU_ID --authenticate` - - Replace *YOUR_SJSU_ID* with, well, your SJSU ID (the 7 digit numbber) - - The flag `--authenticate` tells it to only generate the session token, don't try to create a tunnnel. + - Replace *YOUR_SJSU_ID* with, well, your SJSU ID (the 7-digit number) + - The flag `--authenticate` tells it to only generate the session token, don't try to create a tunnel. - This should print out something like ``` HOST=https://vpn.sjsu.edu/ COOKIE=<a very long hexdecimal string> FINGERPRINT=<a slightly shorter hexdecimal string> ``` - - From what I understood, `COOKIE` is Cisco Anyconnect's session token, which is only usable once. (That is to say, once you've connected to the VPN once with the step below, you need to do this current step again to get a new `COOKIE`.) + - From what I understood, `COOKIE` is Cisco AnyConnect's session token, which is only usable once. (That is to say, once you've connected to the VPN once with the step below, you need to do this current step again to get a new `COOKIE`.) - Then, go to your machine that you actually wish the VPN to run on. In my case, it's my personal server `ssh rtk0c@my-priv-server` @@ -60,11 +60,11 @@ I can either use Cisco's official Linux software, or use a 3rd-party, open sourc - Test with `curl http://icanhazip.com`, it should return an IP that belongs to SJSU. I got `130.65.9.242`. ## Un-route the internet from the VPN -TL;DR: use `ip route del default dev tun0` to get rid of the routing rule for all traffic, and then use `ip route add 10.0.0.0/8 dev tun0` to make the LAN subnet accesible. +TL;DR: use `ip route del default dev tun0` to get rid of the routing rule for all traffic, and then use `ip route add 10.0.0.0/8 dev tun0` to make the LAN subnet accessible. `openconnect` automatically sets up a routing rule in the linux kernel that sends all internet traffic (i.e. every non-*private-use* IP address) *and* the subnet `10.0.0.0/8` through its *tunnel*, except those going to IP address of SJSU VPN server. -A *tunnel* manifests itself as a *network interface* in the linux kernel, in this case named `tun0`, just like a your WiFi card shows up as a network interface. Routing rules tell the kernel, when you see *packets* coming from such and such, and going to such and such IP address, send it through this network interface. A *private-use* IP address is one reserved by the IP standard, such that it will never appear on the internet. They're only used inside a LAN. +A *tunnel* manifests itself as a *network interface* in the linux kernel, in this case named `tun0`, just like a wifi card shows up as a network interface. Routing rules tell the kernel, when you see *packets* coming from such and such, and going to such and such IP address, send it through this network interface. A *private-use* IP address is one reserved by the IP standard, such that it will never appear on the internet. They're only used inside a LAN. I want to get rid of the routing rules for all internet traffic. You can list routing rules with `ip route`[^ip-route], in which you should see something like: ``` @@ -80,7 +80,7 @@ Each line here is a routing rule. They rules take priority not by their order, b *Subnet prefix* length is the number of bits in the subnet mask. For example, `10.0.0.0/8`'s prefix is length is 8, so it's *less specific* than `10.40.16.0/20`, which has 20 bits. See [your favorite search engine for more](https://www.google.com/search?client=firefox-b-1-d&q=subnet+prefix) if you're curious—the details don't matter here. -The first line, `default via 10.40.25.168 dev tun0`, means that if the destination IP address doesn't match anything below ("default"), send it to the device `tun0` ("dev tun0"). The 2nd line is the normal rule for my local WiFi connection (internet traffic goes to the router). The 3rd, 4th, and 5th lines all come from openconnect. 3rd says if the destination IP is in the `10.40.16.0/20` subnet, send it over `tun0`; even if this rule didn't exist, packets going to the whole SJSU LAN subnet will be caught by the first rule, so it's unnecessary<sup>citation needed</sup>. 4th says if the destination IP is exactly `130.65.8.242`, which is SJSU's VPN sever, send it over my actual WiFi interface ("dev wlp1s0"); 5th is a duplicate but with a higher *metric*. I'm not sure why it writes these rules with so much redundency. +The first line, `default via 10.40.25.168 dev tun0`, means that if the destination IP address doesn't match anything below ("default"), send it to the device `tun0` ("dev tun0"). The 2nd line is the normal rule for my local wifi connection (internet traffic goes to the router). The 3rd, 4th, and 5th lines all come from OpenConnect. 3rd says if the destination IP is in the `10.40.16.0/20` subnet, send it over `tun0`; even if this rule didn't exist, packets going to the whole SJSU LAN subnet will be caught by the first rule, so it's unnecessary<sup>citation needed</sup>. 4th says if the destination IP is exactly `130.65.8.242`, which is SJSU's VPN sever, send it over my actual wifi interface ("dev wlp1s0"); 5th is a duplicate but with a higher *metric*. I'm not sure why it writes these rules with so much redundancy. *Metric* is a number indicating the cost of a route. The higher this number, the less likely the kernel will consider it if other options exist. @@ -93,7 +93,7 @@ $ sudo ip route add 10.0.0.0/8 dev tun0 Now test with `curl http://icanhazip.com` again. I got my normal, home IP address back! And test if SJSU's LAN subnet is reachable with `ping 10.0.0.1`. (I need a machine on the SJSU network, typically the ...1 machine is used by the router, I tried it, and indeed it exists—though I'm not sure what it is, but existence is all that matters). # Script -I wrote a bash script `sjsu.vpn.sh`, to update the token I just copy paste them to the top of the file, as varaibles. +I wrote a bash script `sjsu.vpn.sh`, to update the token I just copy paste them to the top of the file, as variables. ```bash #! /bin/bash @@ -130,17 +130,17 @@ wait ``` # Results -`iperf` (and `iperf3`) speed went from ~15Mbps on tailscale relay to ~55Mbps over the cisco vpn; ping didn't change meaningfully. +`iperf` (and `iperf3`) speed went from ~15Mbps on tailscale relay to ~55Mbps over the Cisco VPN; ping didn't change meaningfully. # Closing Thoughts -I'm not sure if SJSU's Cisco Anyconnect service is going through another hop on a relay server of their own, or it's just a direct connection. I was more or less expecting the latency to be better than going through Tailscale's relay in SFO, though it is what it is. +I'm not sure if SJSU's Cisco AnyConnect service is going through another hop on a relay server of their own, or it's just a direct connection. I was more or less expecting the latency to be better than going through Tailscale's relay in SFO, though it is what it is. -I use ZeroTier for setting up game servers with my friends (advantage over Tailscale: no need for signing up an account). ZT doesn't not want to listen on the `10.xxx.yyy.zzz` address associated with the VPN, so even with the VPN in place, it still uses its own relay. I have no idea why, it could be its discovery mechanism (UDP local broadcast) is blocked by SJSU's network, or there is some kind of internal blacklist mechanism for blocking the `tun0` device used by OpenConnect. A quick github search in their source yield too many results for me to dig through; google did not hint at anything relevant. +I use ZeroTier for setting up game servers with my friends (advantage over Tailscale: no need for signing up an account). ZT doesn't want to listen on the `10.xxx.yyy.zzz` address associated with the VPN, so even with the VPN in place, it still uses its own relay. I have no idea why, it could be its discovery mechanism (UDP local broadcast) is blocked by SJSU's network, or there is some kind of internal blacklist mechanism for blocking the `tun0` device used by OpenConnect. A quick github search in their source yield too many results for me to dig through; google did not hint at anything relevant. [^1]: Some software like Tailscale have some heuristics to more-or-less brute force a direction connection between hard-NAT and easy-NAT. It takes quite a bit of luck for this to happen in my experience: for the close to 1 year I've been here, direction connection only ever happened once. -[^2]: "VPN allows users outside of the SJSU network access to restricted resources (like file shares, servers, and desktops) on the SJSU network, as if they are physically located on the SJSU campus network behind secured firewalls." https://sjsu.edu/it/services/network/internet-access/vpn.php +[^2]: "VPN allows users outside the SJSU network access to restricted resources (like file shares, servers, and desktops) on the SJSU network, as if they are physically located on the SJSU campus network behind secured firewalls." https://sjsu.edu/it/services/network/internet-access/vpn.php -[^ip-route]: Linux has the concept of different routing tables. `ip route` only shows the `main` routing table, but that's all we care about here. You can use `ip route show table <table name>` to show a specific table. Tailscale routes packets to the Tailnet IP addresses (the ones like 100.xxx.xxx.xxx) in the routing table `52`. +[^ip-route]: Linux has the concept of different routing tables. `ip route` only shows the `main` routing table, but that's all we care about here. You can use `ip route show table <table name>` to show a specific table. Tailscale routes packets to the tailnet IP addresses (the ones like 100.xxx.xxx.xxx) in the routing table `52`. diff --git a/content/blog/vim-kitty-compat.md b/content/blog/vim-kitty-compat.md index 67debeb..af6f1b9 100644 --- a/content/blog/vim-kitty-compat.md +++ b/content/blog/vim-kitty-compat.md @@ -5,7 +5,7 @@ ShowToc: false --- **TL;DR**: kitty uses a custom terminfo `xterm-kitty`. Vim doesn't like it. -If you're in a pinch, commit a [crime](#i-just-want-it-work-right-now) and hopefully it works fine. +If you're in a pinch, commit a [crime](#i-just-want-it-work-right-now), and hopefully it works fine. If you're not, switch to another terminal for vim, or switch to neovim, or [attempt to teach vim to speak kitty](#configure-vim). --- @@ -13,11 +13,11 @@ If you're not, switch to another terminal for vim, or switch to neovim, or [atte If you use Vim in kitty, local machine or going through SSH, and (at least) one of these is happening: 1. Paste <kbd>Ctrl+Shift+V</kbd> from system clipboard is egregiously slow. Like two lines per second slow[^arch]. -2. Paste is glitchy. All the whitespaces get eaten, nowhere to be seen. Lines get jumbled together, parts of the clipboard overwrite another, etc[^debian]. +2. Paste is glitchy. All the whitespace get eaten, nowhere to be seen. Lines get jumbled together, parts of the clipboard overwrite another, etc[^debian]. 3. kitty tells you your clipboard contains terminal escape sequences. Except it absolutely does not. Pasting elsewhere, still in kitty, like into `bash` or `nvim` works completely fine[^debian]. [^arch]: happened on a local ArchLinux machine -[^debian]: happened on SSH to an Debian Bookworm arm64 supplied by AWS EC2 +[^debian]: happened on SSH to a Debian Bookworm arm64 supplied by AWS EC2 then congratulations, you have just discovered that Vim isn't very compatible with kitty as a terminal emulator. Instead of trying to poorly summarize _why_, you can instead read the problem being extensively discussed _con fuoco_ in the [Vim issue tracker](https://github.com/vim/vim/issues/11729). @@ -32,7 +32,7 @@ Try `TERM=xterm-256color vim /my/file.txt`. It seems like by setting `TERM` to `xterm-256color`, Vim will understand at least the paste part mostly fine. I don't know if bracketed paste is happening. **This is highly discouraged** per kitty's [documentation](https://sw.kovidgoyal.net/kitty/faq/#i-get-errors-about-the-terminal-being-unknown-or-opening-the-terminal-failing-or-functional-keys-like-arrow-keys-don-t-work) and [opinion](https://github.com/kovidgoyal/kitty/issues/2192). -Don't use it long term, or you'll find other inexplicable weirdness (which I had, but it's all a blurry mess so I can't recite to you the war story. alas). +Don't use it long term, or you'll find other inexplicable weirdness (which I had, but it's all a blurry mess, so I can't recite to you the war story, alas). # Other solutions As far as I know, all other terminals pretend to be xterm well enough that Vim plays happily long. So you use them instead. |
