I tweet about Regex, Python, Linux CLI one-liners, Vim and interesting tech nuggets.
✍ Author of several programming ebooks and devourer of fantasy books 🧙
A quick update on the Ebook:
- I've updated the PDF with better styling - great to read on devices.
- And, there is also an EPUB version available now.
These days whenever I need a database I reach out for sqlite that comes preinstalled with most Linux.
But most Unix systems have always shipped with a (non-relational) database library called dbm. It was written by Ken Thompson in 1979 and has shipped with all Unix and Unix like systems ever since.
It is a simple C based library to read/write key-value pairs. Under the hood it uses a hash-based index and a binary file format.
When BSD was being opensourced, they rewrote it and also added b-tree indexing. This later became Berkely DB.
Awesome reddit thread about "unexpectedly" useful Linux commands - https://t.co/AAknLnk9CK
Have been using the CLI for years and I still keep finding small things that make me think how have I never seen this before...
My favorites from the thread:
- tac
- namei -l
- less +F/+G
- fold
CLI text processing with GNU grep and ripgrep by Sundeep Agarwal is on sale on Leanpub! Its suggested price is $12.00; get it for $5.00 with this coupon: https://t.co/8W8qE7AsLu @learn_byexample#computer_programming
Took me almost a month, but it’s finally done.
I completely rewrote the first chapter of linux-insides about the Linux kernel initialization process. Now it should be aligned with modern kernels (up to master).
https://t.co/IHwrDtMSpw
Announcing Textual Diff View!
Add beautiful diffs to your terminal application.
⭐ Unified and split view
⭐ Line and character highlights
⭐ Many themes
⭐ Horizontal scrolling
https://t.co/c7Qm6IkzKd
I've been looking into autograd internals of Pytorch.
While I was aware of how backward mode autodiff works, I didn't know there was also forward mode autodiff. I had to read up on that. There is a very comprehensive article from an MIT course on that, I highly recommend it.
🐍 Struggling with Python regular expressions?
🔥 I wrote an interactive TUI app with 100+ exercises, covering both `re` and `regex` modules!
https://t.co/WPMHsMETy0
🐍 Struggling with Python regular expressions?
🔥 I wrote an interactive TUI app with 100+ exercises, covering both `re` and `regex` modules!
https://t.co/WPMHsMETy0
I just released v1.4 + v1.5 of "mkdocs-quiz" this week with some fun new features:
✍️ Fill-in-the-blank quizzes (not just multiple choice)
💾 QTI export for Canvas/Blackboard/Moodle
✨ Interactive terminal CLI quiz runner
https://t.co/zw23AVGq2c
This year I'm starting a habit of working on a book every day.
I have to write at least a paragraph for it to count.
(I set a small daily goal to make it RIDICULOUS for me to skip it.)
I'm 15 days in.
The progress accumulates fast!
Python has a "suppress" decorator in contextlib, which catches and ignores exceptions of a given type.
I didn't use this for the longest time. It felt like an import to do something so trivial. I didn't care too much about saving two lines.
Lately though, I prefer it. Not for saving lines, but because it is self documenting. The "suppress" is clearer when scanning code.
This can get lost in your mind's eye when scanning code:
try:
file.write(...)
except OSError:
pass
This feels more explicit, and easier to read at-a-glance
with suppress(OSError):
file.write(...)
This tweet brought to you from the "last humans still writing code" generation.
You can use the module `json` to read and write data in the JSON format, which is very suitable to represent the most common Python built-in types:
- lists
- dictionaries
- strings
- integers
- floats
- Booleans.
Wrote an essay on why time is such a hard problem in distributed systems.
This week, I went down the rabbit hole of clock drift, NTP, PTP, logical clocks, vector clocks, and how systems like Spanner and CockroachDB deal with ordering and causality at scale.
If you want to know how and why clocks break databases, why milliseconds matter, or how distributed systems deal with time, this essay will give you a solid mental model. Give it a read.