Easy find and replace is one of those quality of life improvements that make Vim great. With one quick command, and a little regex, you can replace a pattern across an entire file. Here’s how: Find and replace in the entire file with Vim:%s This is my most-used version of Vim find and replace. :%s […]
Productivity
Regex Cheatsheet
Regex is very powerful and available in virtually every language. Eventually I’ll write a whole post about why every engineer should know some Regex, but this post is all about common regex patterns, flags, etc—in easy-to-read table form. First, here are some patterns similar to ones I’ve used in recent memory: Pattern Meaning Example Match […]
Developer workflow tips no one tells you about
As developers, we’re expected to know a lot of random things. Sure, you can learn data structures and algorithms from a CS class, and you can learn frameworks from online tutorials or a bootcamp, but what about the other things? How to be more effective on the command line? How to increase productivity on your […]
Dedupe a list in Vim
Tldr: use :sort u Surprisingly often, I find myself needing to dedupe a list, usually when digging through logs. There are many ways to dedupe a list, but Vim might just be the fastest one. Take this list of UUIDs I pulled when investigating a recent issue: From a quick look, I can see that […]
Save your shell history to log files
Every command I enter on my computer is written to a log file. These logs have come in handy countless times; I tell anyone who will listen to save their logs too. My inspiration for doing this came from this atomic object post many years ago, and I am so glad I followed their advice. […]
Copy and paste from the command line
We use copy and paste all the time, so why not use them from the command line? I do it all the time, so let’s do a quick run down. First, the commands: Copy something from the web and paste it to a file This is my most frequent usage of either of these commands, […]
How to find files on linux / mac
Command line find is a powerful, underutilized tool. In this post, I’ll go through the following use cases: Find files by name I use this all the time. Let’s say I’m in my ~/Downloads directory. That directory has several hundred files in it—and quite a few subdirectories—so it’s a bit hard to comb through in […]
Grep, grep options, and grep’s faster open-source alternative: ripgrep
Tldr: Grep In large codebases just finding the things you need can be hard. The built-in solution on linux/unix is grep. The basic format is grep {search_term} {file_path}. Here are a few simple examples: Here are a few commonly-used useful flags for grep: Flag Effect -i makes search case-insensitive -r recursively search directories -n show […]