Yesterday a program made my terminal’s cursor disappear! I was really surprised because programs so rarely mess up my terminal these days. (fish prevents almost all problems like this) the problem was that it printed out "\033[?25l" to make the cursor invisible without printing out a corresponding "\033[?25h” to make it visible again like most "my terminal is broken" problems you can fix this by running `reset` but it was VERY disorienting until I realized what had happened screenshots:
Show previous comments
@b0rk it is a bit annoying that there's nothing you can sensibly do before printing a shell prompt that resets _everything_. The 'reset' program sends ESC c, which resets the terminal completely to its power-on state, including clearing the screen. But you don't want to clear the screen before every shell prompt. You'd like a sequence that does all of ESC c _except_ that! So instead the shell has to think of every individual setting that might need to be reset, and likely forget one :-( @b0rk i still remember the day I first met "reset". If there were an oscar nomination for cli utilities, I'd certainly name it. spent some time today working on this diagram of how the ASCII control characters work in unix there are a lot of mistakes/missing nuance but I think it's really interesting how little structure there is. Special codes (like `3` for SIGINT) that are handled by the OS are mixed with just regular keypresses (like `13` for "enter”) which are mixed with codes that are handled by the application (like `1` for Ctrl-A in readline) (not looking for history lessons right now)
Show previous comments
@b0rk This may be a silly question, but how do some of these key combinations work with different keyboard layouts? For example, on a Swedish (mac) layout, the @-symbol is alt-gr-2; Do you type ctrl-alt-gr-2 to get the null character?
Show previous comments
Show previous comments
@b0rk I recently implemented a db struct based on the sqlite article you referenced, and this is how it came out: https://gist.github.com/llimllib/2d03a8da46bbd3d247d2492849e3dc4e I'd love to see how other people have implemented it! @b0rk thanks, I'm using mux routing but my handlers can be a bit complex so this will help simplify them I really love https://diffdiff.net for quickly looking at diffs -- it does a great job of highlighting diffs inside a single line used it yesterday to debug a networking issue by diffing two tcpdump outputs and it was SO helpful, it made it immediately obvious that the MSS was different between the two connections (the screenshot isn't the actual bug, just a diff of two tcpdump outputs)
Show previous comments
@b0rk git-diff can be used with the files outside of the repository and you probably already know about its --color-words option. Otherwise there's https://github.com/ymattw/ydiff and is multiple forks called cdiff. @b0rk `git diff --no-index before after` can be nice too, if you have configured a nice diff pager like delta! i quit my job just over 5 years ago to explain computer things (https://jvns.ca/blog/2019/09/13/a-year-explaining-computer-things/). I had no idea if I would like being my own boss but ultimately it's been really cool and I'm happy to have this weird job writing zines about computers. ("I’m not planning to hire employees or anything” turned out to not be an accurate prediction, now I work with 2 part-time employees who I don't know how I would manage without)
Show previous comments
@b0rk someone asked me recently how long it took me to get used to the rhythm of working for myself and I said “uh, maybe 3 years?”. I thought working for myself would be hard to adjust to and it was, but I'm happy I did it anyway the debugging manifesto poster I've been talking about is finally available for sale! You can get it here for $20 US + shipping: https://store.wizardzines.com/products/poster-debugging-manifesto it was redesigned and riso printed by Inner Loop Press and I'm SO delighted with how it turned out (https://www.innerloop.press/)
Show previous comments
@b0rk I was sitting next to another programmer who, after much trying, threw his hands up and exclaimed, "Well, it won't work," then a half-hour later had it working. A puree of 2 and 4. it's been really fun to see zines in libraries -- the folks from Swarthmore (https://www.swarthmore.edu/news-events/diy-publications-find-a-home-mccabe-library) sent me this photo of How Git Works in their zine library
Show previous comments
@b0rk thanks for the post. I learned new things from it. I love your approach to learning. I did a similar investigation some time ago. In the end I made a game in the terminal to make it more interesting. :)
Show previous comments
@b0rk I was wondering if this was Risograph, or something similar, because it feels so perfect for that. Awesome. I know $12 USD is a lot of money for some people, so to celebrate 1000+ sales (!!!), I'm giving away 1000 PDF copies of How Git Works (honour system: only if $12 is a lot of money for you!) Here's the link, enter code BUYONEGIVEONE at checkout to get a free copy https://wizardzines.com/zines/git/ (it'll ask you for a billing address but you can enter a fake address if you'd prefer)
Show previous comments
I think a lot about how 1. a lot of command line UIs are kind of bad anyway i've been trying to summarize my relationship with git (which I love) in a single panel and this is where I landed today knowing where you are in git https://wizardzines.com/comics/knowing-where-you-are-in-git/
Show previous comments
poll: do you use git on the command line or in a GUI? (you can pick more than one option if it’s a mix of both, sorry magit users I didn't have space for you in this poll) Anonymous poll
Poll
command line, regularly
1,832
0%
GUI, regularly
666
0%
command line, occasionally
290
0%
GUI, occasionally
0 people voted. 375
0%
Voting ended 1 March at 13:22.
Show previous comments
@b0rk I voted command line + GUI, with the latter being for my Magit usage (and I guess Github blame view). I use the command line for pull, rebase, log, diff, and many blame operations. I use Magit for committing things, especially selective commits, and thus for checking diffs before I commit and so on. (And some use of git-timemachine in Emacs to move back and forth through the history of a file to track things.) But my git use is odd since I track and monitor a lot of upstream repos. I work in IntelliJ, and it’s Git UI is so good (or I spent enough time to get used to it’s rough edges, too), that I feel much less productive on the CLI. I wonder why IntelliJ users still use the git CLI, esp. for staging, writing commit messages, diffs and git blame. But also branch operations and git log are good enough or even really good, depending on the use case. I totally recommend the interactive rebase UI! i really appreciate that we can have great conversations here on mastodon if I’m extremely careful about every single thing I post and often include disclaimers (“please don’t explain rebase to me”) to avoid repetitive annoying replies that I can predict but I still feel like I need to be SO much more careful about my posts than I was on Twitter and I wish it wasn’t like that
Show previous comments
@b0rk FWIW I like reading your posts. At the moment, I really need reading about tech stuff from the perspectives of people who *aren't* total assholes. For myself I gave up on writing anything substantial online for many reasons, one of which is that I don't have the psychological constitution for potential large audiences (and hence, maintaining a "real" social media presence). I wish it wasn't like this, and I hope doing what you do doesn't burn you out. @b0rk I feel you. Try to ignore this stuff if you can. You're doing important work here 🙏 @b0rk This has been my experience as well. And I’m a middle-aged white dude. I imagine it’s even worse for people in other demographics
Show previous comments
@b0rk There's a fourth option though: The "student has their first merge conflict, panics and tries to sort it out themself instead of asking for help"-option. - Checked in conflict-markers: ☑️ @b0rk Perfect. What an elegant way to represent commit graphs. And thank you for articulating my dread of merge graphs A squash + rebase looks almost ideal to me. I'm going to do that more often. The negatives of squash + rebase look minor to me though. Is a 3000-line PR any better with the other options?
Show previous comments
@b0rk this is making me want to finally sit down and work through https://shop.jcoglan.com/building-git/ where you build a simplified working git clone @b0rk great content! (As always). I recently found https://pre-commit.com/ as a really useful tool for distributing coding standards inside a git repo. A bit different than what your current content, but one of worst sort of merge conflicts on teams is formatters gone rogue, IMO. do we think of git commits as diffs, snapshots, or histories? https://jvns.ca/blog/2024/01/05/do-we-think-of-git-commits-as-diffs--snapshots--or-histories/
Show previous comments
@b0rk Thanks, I liked that! This post woke something in me re the discussion on rebase vs merge the other day. I think I prefer rebase/linear history because it maps very well to a sequence of patch files that could be copied around and applied independent of git itself. Not sure why that feels so "pure" to me, but it does. @b0rk Speaking of this, before git, I worked a lot with monotone, which has quite a lot of similarities to git... however, storage wasn't one of them. Monotone stored commits as diffs, so there were situations where they had to be replayed en masse. That could be quite a performance hit...
Show previous comments
a bunch of folks have mentioned that they use rerere to avoid solving the same merge conflict a million times during a rebase. If you use it, do you find it works well? are there any downsides to using it? @b0rk If rebase is going badly I sometimes do `git reset main` instead and craft the commits I need. A lot of the times it’s a single commit anyway! @b0rk I literally told my 2 juniors today to stop force-pushing rebased versions of their PRs to GitHub if there are already comments on some of the old commits, and to instead merge over them... turns out a lot of nice GitHub stuff breaks when you rewrite history |
@b0rk maybe mention that with set -o vi you get from weird emacs to weird vi keys
@b0rk I did not know about rlwrap. (I did know about readline, this image is great, and "readline but worse" is totally reasonable commentary)
@ed1conf `rlwrap ed` is basically quick'n'dirty en/ex enhancements for `ed(1)`. I'm probably still going to just use vanilla ed(1), but having the arrow keys work was interesting.
@b0rk My personal taxonomy puts prompt_toolkit (the custom lib used by ipython) at the same level as readline and libedit.
It's a reusable component, and it definitely aims to be the Python version of readline. I've used it to add line editing to a personal project and I quite like it.