I rarely have the need to generate man pages for a project, but I realized they could be useful for spot(1). For those situations, the solution by TJ Holowaychuk is one curl
and handy Heroku-hosted web service away:
curl -s -F page=@file.md http://mantastic.herokuapp.com > file.1
In my computer and slow connection at home, it took 1 second to run this task as measured by time(1)
. Not bad for something that was already in my computer (curl
), that prevented me from needlessly having to run the easy_install
/npm
/gem
/brew
/package manager of the day
.
As a matter of fact, while installing a Python CLI utility the other day, I pressed tab to autocomplete and was met with a few options:
∞ easy_install
easy_install easy_install-2.5 easy_install-2.6 easy_install-2.7
The reality is that a lot of the tools we use or could be using in our terminals could be run somewhere else, and their installation could consist in setting up an alias in your bash profile. Do you need to do syntax highlighting but don’t care for installing a bunch of things?
alias pygmentize="ru pygmentize"
My suggestion here is the creation of a ru
command (codename remote unix
) whose job would be to provide the same interface as the original command, but execute it remotely. If you pass it -h
to get help, it takes that to the web service and outputs its response.
Other examples of potentially useful cloud-run tasks include any text compilers (eg: mantastic, markdown, textile), file type conversion and manipulation (eg: png2gif, trimage), and more.
if ( comments_open() ) { ?>
8 Comments
What you’re looking for is probably ssh. It’s installed by default and opens an encrypted connection to a shell on a remote server. You probably know it. What you don’t know perhaps is that you can pipe stuff there:
cat File.markdown | ssh user@host markdown | less
Outsourcing computations to larger machines has been ingrained in the UNIX philosophy for quite a while now :)
Why not as a JS library?
Worth an experiment: Pipe certain useful commands together to create a web app. On top of ru.js & a server only client side is code allowed.
I keep my laptop lightweight, so I don’t keep a ton installed on it. I usually just run those commands over ssh on one of my other machines, but it would be nice if it kept the local environment (transparently copy files over ssh as needed perhaps?)
TL;DR Yes, that sounds like a useful command :)
@Wander
Not looking for ways on how to _implement_ this (that’s why
ru
is a placeholder, not an actual project).It’s more like, is this something that could be potentially useful enough for everyone that it’s worth setting it up in a similar way to how Travis CI has been set up?
I think this is a really neat idea, for the benefits of keeping a lightweight installation locally and not having to worry about installing programs with complex dependencies, source builds, packages, etc.
What’d be really neat is if there was a pretty web interface to go with it where you could register an account, attach ssh keys (I imagine using ssh is one good way of implementing this idea), and then pick and choose which programs you want to be able to use remotely. You could even automate the creation of the aliases for the user, like they could download a configuration file to feed into ru or a shell script to set them up.
SSH to a remote machine suits most of my needs.
However the last part of your idea(about text compilers / file type manipulation) seems interesting. It would be nice to perform an occasional one-time task without clogging your box with more soft.
Too bad Heroku’s client doesn’t support regular UNIX options. If it did, you could do something like:
$ heroku run bash -c “echo hi”
You could also use a custom buildpack to install your favorite binaries on the heroku app. For instance, if you vendored PV(1) into the app your could run:
$ heroku run bash -c “pv”
Jeremy: if you’re looking for an actual solution to your setup, check out GNU Parallel; it can run the command in one or more remote machines using SSH and the options –transfer and –return are used to transfer files to the remote machine before the command is run and to retrieve resulting files after it, respectively.