If you can script it you can HTTP it with Kapow!
What’s Kapow!?
Say we have a nice cozy shell command that solves our problem. Kapow! lets us easily turn that into an HTTP API.
What’s Kapow!?
Say we have a nice cozy shell command that solves our problem. Kapow! lets us easily turn that into an HTTP API.
What is this sorcery?
This post is part of a sample chapter from Essential Tools and Practices for the Aspiring Software Developer — a self-published in-progress book by Balthazar Rouberol and Etienne Brodu.
I estimate that I spend around 50% of my day working in my text editor and my terminal. Any way I can get more productive in these environments has a direct and measurable impact on my daily productivity as a whole.
If you spend a good chunk of your day repeatedly hitting the left and right arrow keys to navigate in long commands or correct typos, or hitting the up or down arrow keys to navigate your command history, this chapter should help you get more done quicker. We will cover some shell features you can leverage to make your shell do more of the work for you.
On a personal level, I probably use some of these up to 30 times a day, sometimes even without thinking about it, and it gives me a real sense of ownership of my tool.
zoxide
keeps track of your most frequently used directories and uses a ranking algorithm to navigate to the best match. It was inspired by z and z.lua, but it’s written in Rust and out-performs both:
On my system, compiled with the
x86_64-unknown-linux-musl
target,hyperfine
reports thatzoxide
runs 10-20x faster thanz.lua
, which, in turn, runs 3x faster thanz
. This is pretty significant, since this command runs once at every shell prompt, and any slowdown there will result in an increased loading time for every prompt.
awk
is an incredibly powerful tool, you just have to know how to harness it. Learning by example is so often the best way to do that!
Don’t use this, but do check it out if you want to learn more about how Git works. Or about how POSIX shell works. Or both!
This is a full-featured replacement for many of your shell’s built-ins.
Jonathan Turner, Andrés Robalino, and Yehuda Katz joined the show to talk about Nushell, or just Nu for short. It’s a modern shell for the GitHub era. It’s written in Rust, and it has the backing of some of the greatest minds in open source. We talk through what it is, how it works and cool things you can do with it, why Rust, ideas for the future, and ways for the community to get involved and contribute.
Place this pure sh
bible next to the pure bash bible in your collection. Then, let me tell you a little story about a man named sh
! I have a whole bag of sh
with your name on it. (Sorry, I couldn’t help myself.)
A modern, GitHub-era shell written in Rust.
Today, we’re introducing a new shell, written in Rust. It draws inspiration from the classic Unix philosophy of pipelines, the structured data approach of PowerShell, functional programming, systems programming, and more.
It’s called Nushell, or just Nu for short.
They have a work-in-progress book for nushell too.
It’s also a wrapper script around several security tools such as Mozilla Observatory and Nmap NSE.
Jessie Frazelle spells out why she loves the |
command. Here’s the brief:
In brief, the
|
allows for the output of one program (on the left) to become the input of another program (on the right). It is a way of connecting two commands together.
Did you know pipes pre-dated Unix?! 1964! Lots of good stuff in this post, highly worth the click.
I’m a looooong time rvm user, but I don’t have a similar tool for my Elixir and Node installs. asdf
looks like a potentially nice way to unify all of my language/runtime versioning under a single tool.
It’s amazing what a little bit of grease can do to the skids. Put this rb
file in your $PATH
and get ergonomic access to all of Ruby’s text processing skills. The very first example sold me:
docker ps | rb drop 1 | rb -l split[1]`
# ubuntu
# postgres
Max wrote an excellent intro (for his past self) to using the Shell. He covers what it is, common actions, package managers, dotfiles, aliases, and more. Check this out as a refresher, or send it to a friend who needs a nudge in the right direction. ✊
Safia Abdalla continues her excellent series of “what happens when” posts, this time tackling sudo !!
:
One thing I’m sure everyone has done on the command line is to use the
!!
shortcut to run the command run previously with sudo.
Don’t be so sure, Safia. It took me literally years of command-lining around before I learned that trick. I bet you taught more than a few people about its existence with this very article. 👌
Graphpath is a shining example of the Unix philosophy’s virtues.
it’s just a shell script using standards tools (route, arp and ifconfig on *BSD and ip on Linux)
The results? Super useful.
Yesterday’s coverage of CloudFlare’s new DNS service (1.1.1.1) was met with a few cries of “SLOWER FOR ME”!
Is it faster or slower in your neck of the woods? You can find out easily by running the linked script. CloudFlare wins easily from where I’m sitting (see below). Off to go change my settings!
Register an alias like goto -r dev /home/jerod/dev
. From then on out, you can just goto dev
. Lazarus says:
It comes with a nice auto-completion script so that whenever you press the tab key after the
goto
command, bash or zsh prompts with suggestions for the available aliases.