wdn v3.1.0: ssh support & breaking change in warp point storage

Well, I don’t think anyone is actually using my wdn reimplementation of wd, but it’s been a fun project for me, so let me tell you what’s new in the latest version.

When I pushed from v2.x to v3.x, I changed the way warp points are stored on disk from a one-file-per-point to a one-file-per-scope deal. This breaks the existing points on anyone (no one but myself :P) who migrated from 2.x to 3.x, but allowed me to implement the one feature I was originally wanting to implement from the moment I started this project: ssh support.

Basically, local warp points are now stored in ~/.config/wdn/local and for every remote host you have set up in your ~/.ssh/config, a new file is created there to hold an array of remote points.

Check out the readme on the GitHub page if you want to know more, but here’s an example of how it works.

wdn example

Check it out if you think it looks interesting. Feedback, ideas, bug reports, critiques and pull requests welcome!

clg: command-line goodness for working with static site generators

I’ve been playing with preact in my archives but for the most part, this blog is statically generated with hexo. Pretty happy with my setup but the other day I was thinking about using metalsmith for a new project.

Turns out I really like it. However, I wrote the hexo-cli-extras plugin some months ago to make command-line blogging more convenient for myself. Now, I found myself inconvenienced without it.

I googled around, but nothing. So, what the hey, I blew off the original project for a while and built a simple filesystem-based metalsmith version of my plugin. Today I looked at the code though and started thinking. Aren’t all static site generators kind of the same? If it works on one, it’ll work on others.

So I’ve started work on clg (command-line goodness). If you use a static site generator and you love the command line, you might like this!


Read More

Faster and more convenient file system navigation with wd or warp-dir -- or wdn?

I trust most of you know the basics of navigating the file system on the command line. cd, pwd, ls and all that jazz. Maybe you’ve got some tricks under you belt too. Things like cd -, CTRL-R, ls -alh, cd *somewhere* and a whole lot more (check out this resource if any of this sounds new to you).

But that’s not what this post is about. This is about taking shortcuts on the command line. More precisely, making warp points out of specific directories and then warping to it using wd. Here’s an example of how it works (assume that the path at the beginning of each line represents the current working directory):

[~/some/crazy/path]$ wd add myproject
[~/some/crazy/path]$ cd ~
[~] wd myproject
[~/some/crazy/path]$ wd list
myproject -> ~/some/crazy/path

You wouldn’t believe (or maybe you would) how convenient and awesome this is, and that’s just the basic functionality. There are a couple of easy ways to add this feature to your own command-line, each with their pros and cons.

Read More

Playing videos with mpv and a wrapper for immediately disowning a process

Oof, two months without updates! This is starting to look like a typical developer blog! Well, I won’t bore you with the reasons behind my temporary absence and get right to the content: I’ll be explaining below how to write a wrapper for a program (in this case, mpv) that automatically detaches itself from the terminal window from which you run it. Enjoy!

Years ago, I discovered VLC and started using it for all my video watching, as it is in my opinion by far the best option on Windows. When I switched to Linux full-time though, I found out there is another piece of open source software that does the same thing, and by golly, it does it even better: mpv

mpv website

If you’ve read this blog before, you probably know I love the command line, and that’s exactly why I ended up using mpv for all my videos. VLC is still great, mind you, but configuring it can be time-consuming with its many dialog windows - trust me, a long time ago, someone actually paid me to write tips for a VLC blog..

In contrast to the typical Windows-centric approach VLC uses, mpv’s configuration options are at the same time mind-bogglingly elaborate and as simple as running a command from the terminal and/or editing the config file with your favorite editor (vim).

Maybe I’ll share some of my other mpv settings later, but right now I’d like to focus on this little tip for playing videos from the terminal in mpv. You might find it very useful if you live in the terminal like I do, and particularly if you use a tiling window manager like i3 or awesome.

You might also use the same simple wrapper for running other scripts/programs in the background and immediately disown them.

Read More

Command-line mdn, or how to make a great thing even greater

How do you make a fantastic online collaborative resource website even better than it already is? Right! You write a command-line interface for it!

I had been toying with the idea of writing a CLI for everyone’s favorite webdev reference site, MDN, but never really got round to it. A few days ago, I set out to finally write the thing, but after doing a little bit of work on it, I did what smart people do and searched more thoroughly for existing projects on GitHub.

And what do you know, an awesome dev called Rafael Rinaldi had just published his own command-line mdn tool. Not only that, but his approach was better than mine too! I was thinking more of using man to page through the entire contents of a given article, but Rafael’s idea to print just the first paragraph of the description along with the API and a link is much better.

mdn example

Besides JavaScript, it also supports searching for CSS definitions and I submitted a few pull requests to add an -o option to open the relevant page in your local browser as well as some general formatting fixes.

Anyway, Rafael’s mdn tool is awesome and it’s become an integral part of my workflow already - I mean, come on, with all this new JS stuff coming out every minute, who has time to read stuff in a browser anymore! If you like both MDN and the command-line (and if you’re reading this, then you probably do), I highly recommend you use his tool and of course contribute if you can!