Collect your thoughts and notes without leaving the command line #

jrnl is a great little text-based journaling tool with a command line interface. Why plain text files? I love this tidbit from the readme:

you can put them into a Dropbox folder for instant syncing and you can be assured that your journal will still be readable in 2050, when all your fancy iPad journal applications will long be forgotten.

At first blush, the interface looks really well thought out. I don’t journal much, but jrnl just might get me started.

Xiki is reimagining the shell #

I’m a huge user/advocate of the traditional command shell, but as a teacher I know the troubles people have getting started.

Xiki looks like a great effort at bringing the power of the shell to everyone while adding some nice features for power users. They’re in the middle of a Kickstarter to fund further development, so it’s a great time to show your support.

docopt gets CLI argument parsing right

Brilliant ideas can be painfully obvious in retrospect. They’ll leave you thinking, “Why didn’t we I think of that before?!” Docopt is that for parsing CLI arguments.

Trash – a safer and cross-platform `rm` #

Instead of permanently deleting files from the command line, this little tool moves them to the trash.

Like me, you might be thinking, “But I can do the same thing with mv.” To this Sindre writes:

Not really. The mv command isn’t cross-platform and moving to trash is not just about moving the file to a “trash” directory. On all OSes you’ll run into file conflicts. The user won’t easily be able to restore the file. It won’t work on an external drive. The trash directory location varies between Windows versions. For Linux there’s a whole spec you need to follow. On OS X you’ll loose the Put back feature.

Who knew?

Git your game on with Githug! #

Githug is a cool new way to learn git by Gary Rennie. From the readme:

Githug is designed to give you a practical way of learning git. It has a series of levels, each utilizing git commands to ensure a correct answer.

Game on!

#108: Exercism.io with Katrina Owen

Adam and Jerod talk with Katrina Owen – Panelist on Ruby Rogues, Instructor at Jumpstart Lab and creator of Exercism.io, an open source platform for crowd-sourced code reviews on daily practice problems.

Pynt versus Invoke

Just the other day I saw someone mention on Twitter that Pynt was their new favorite pure Python replacement for make. I have some minor experience using Invoke, a very similar tool. This prompted me to experiment with both utilities and report on my findings. Background Both tools take great advantage of decorators in Python […]

Multi-user tmux made easy with wemux #

Two of the many things in the development community that are growing in popularity are remote work and pair programming. Traditionally, pairing meant you had two people looking at the same computer and one person doing the typing. This is great, as long as you are in the same room.

What about those developers, like myself, who rarely (if ever) find themselves in the same room as their coworkers? Enter wemux by Matt Furden, the tmux tool that makes it simple for multiple users to connect to the same tmux session so you can see the same thing.

The only requirement, according to the README, is tmux >= 1.6. Installation is simple, with the preferred method being Homebrew:

>> brew install https://github.com/downloads/zolrath/wemux/wemux.rb

After installation, you — the host — would start a new wemux server:

>> wemux start

At this time, anyone else — the clients — could connect with any of the following three commands:

  • wemux mirror – attach to the server in read-only mode.
  • wemux pair – attach to the server in pair mode, where both the client and the host can control the terminal.
  • wemux rogue – attach to the server in rogue mode, where the client and host can work independently of eachother.

There are plenty of other features, from listing users to running multiple wemux servers at once. Once you get the hang of it, pairing while working remotely becomes much simpler than screen sharing on Skype!

You can find out everything you need to know in the README or discuss this post on HackerNews.

Searching, improved with The Silver Searcher #

The Silver Searcher by Geoff Greer is a tool which aims to take searching to the next level. Installation is simple:

brew install the_silver_searcher

If you aren’t on a Mac, or using homebrew, there are other installation instructions on the README. Using it is very straightforward, especially if you have used ack (or grep) in the past:

ag stringtofind ~/code

I know what you’re thinking, what is ag? Well, Ag is the chemical symbol for silver, and it’s a lot easier to type than the_silver_server, so Geoff went with it! There are a number of features that make The Silver Searcher worth giving a try:

  • Speed: 3-5x faster than ack
  • It honors .gitignore, .hgignore, and .agignore
  • ag is 33% shorter than ack (admittedly this is silly, but you can’t argue the facts!)

Discuss this on HackerNews or view the repo on GitHub.

Ghost means never having to touch ssh/config again (either) #

As a throwback to our original coverage of Ghost back in 2010, I wanted to share a hidden feature I just discovered in Ghost.

Two years ago Felipe Coury submitted a pull request to add ghost-ssh to manipulate ~/.ssh/config files. If it weren’t for Google pointing me to this pull request, I would have never known ghost-ssh existed. The readme says nothing about it!

This is what Felipe had to say when he submitted his patch:

I had a need to manipulate ~/.ssh/config file the same way I can manipulate my hosts entries, so I made this change.

Not sure if it will be useful for the upstream project, but be welcome to merge if you like.

An intro to ghost-ssh

Just like with ghost on the command line, ghost-ssh has basic list, add, and delete options, as well as an import operation to import files.

To save you some time, here’s the contents of ghost-ssh --help:

$ ghost-ssh --help
USAGE: ghost-ssh add <host> <hostname> [--user=<user>] [--port=<port>]
       ghost-ssh modify <host> <hostname> [--user=<user>] [--port=<port>]
       ghost-ssh delete <host>
       ghost-ssh list
       ghost-ssh empty
       ghost-ssh export
       ghost-ssh import <file>

An example of adding a new entry to your ssh/config might look something like this:

$ ghost-ssh add tclprod xxxxxx.gridserver.com --user=tcladmin
  [Adding] tclprod -> xxxxxx.gridserver.com

You can confirm the entry was added to ssh/config by running the ghost-ssh list command:

$ghost-ssh list                                             
Listing 1 configs(s):
  tclprod -> tcladmin@xxxxxx.gridserver.com:22

Now that I have this new entry in place, I can easily ssh into the server by running ssh tclprod and boom goes the dynamite!

Checkout the source for Ghost on GitHub for install and usage details.

Discuss on Hacker News if you’d like.

Nodefront – Node.js-powered rapid front-end development utility #

Nodefront from Karthik Viswanathan aims to make a front-end developer’s life easier. Built in Node.js, Nodefront bundles a local web server for serving up HTML, CSS, and JavaScript assets and supports live reloading via web sockets. Additionally it ships with a command line interface:

  • nodefront compile – Compiles Jade and Stylus files to HTML and CSS. Can compile upon modification, serve files on localhost, and even automatically refresh the browser/styles when files are changed.

  • nodefront fetch – Automatically fetches CSS/JS libraries for use in your project. Provides an interactive mode to add new libraries.

  • nodefront insert – Inserts CSS/JS libraries directly into your HTML or Jade files.

  • nodefront minify – Minifies CSS and JS files. Can also optimize JPG and PNG images.

Karthik has put together a twenty minute screencast for a full demonstration.

Check out the project web site or source on GitHub for more.

ascii.io – Python-powered terminal recording and sharing #

Yesterday we featured codestre.am, a Node.js app that lets you record and livestream your terminal to others. Łukasz Korecki was quick to point us to ascii.io:

Powered by Python, ascii.io from Marcin Kulik is fully open source, both client and server. You can install the client with a simple shell script:

$ curl -sL get.ascii.io | bash

Once installed, use the asciiio command line interface to record your session, optionally logging in with GitHub or Twitter to store your recordings under your profile at ascii.io.

ascii.io screencap

Check out the source on GitHub for info on usage and how to contribute.

Bonus: Nyan Cat!

noexec – Run Ruby scripts without bundle exec #

We’ve covered a few of Josh Hull’s projects on this blog. His latest is so simple, yet quite useful. If you use Bundler, you probably spend a good part of your day running bundle exec. I even use a zsh alias be for this purpose. Well now, we can stop.

With noexec, Josh has created a small script that will walk up your directory structure until it can find a Gemfile. If the executable you’re running is in that Gemfile, it will use it instead of Bundle.setup.

Simply install the gem:

gem install noexec

… and be sure to export the following environment variable in your shell profile:

RUBYOPT="-r`noexec`"

Check the source on GitHub for more.

httpie – Python-powered HTTP CLI for humans #

Although cURL is great, we’re always looking for great console tools for working with HTTP. Jakub Roztocil has released HTTPie. Built on Requests, HTTPie provides a clean command line interface for HTTP requests:

http PATCH api.example.com/person/1 X-API-Token:123 name=John email=john@example.org

PATCH /person/1 HTTP/1.1
User-Agent: HTTPie/0.1
X-API-Token: 123
Content-Type: application/json; charset=utf-8

{"name": "John", "email": "john@example.org"}

I appreciate the colored terminal output:

HTTPie output

Source on GitHub.

Methadone – Build better Ruby-based CLI’s with logging and Cucumber support #

There’s no shortage of projects to build CLI apps in Ruby, but few ship with as many tools to help you build better command line interfaces as David Copeland’s Methadone. Features include bootstrapping, logging, command DSL, and even Cucumber support via Aruba.

The DSL aims to be a readable, convenience wrapper around OptionParser:

#!/usr/bin/env ruby

require 'optparse'
require 'methadone'

include Methadone::Main

main do |name,password|
  name # => guaranteed to be non-nil
  password # => nil if user omitted on command line
  options[:switch] # => true if user used --switch or -s
  options[:s]      # => ALSO true if user used --switch or -s
  options[:f]      # => value of FILE if used on command-line
  options[:flag]   # => ALSO value of FILE if used on command-line

  ...
end

description "One line summary of your awesome app"

on("--[no-]switch","-s","Some switch")
on("-f FILE","--flag","Some flag")
on("-x FOO") do |foo|
  # something more complex; this is exactly OptionParser opts.on 
end

arg :name
arg :password, :optional

go!

Since Methadone also scaffolds out your Cucumber features, you can test your CLI via Aruba:

Feature: My bootstrapped app kinda works
  In order to get going on coding my awesome app
  I want to have aruba and cucumber setup
  So I don't have to do it myself

  Scenario: App just runs
    When I run `newgem --help`
    Then the exit status should be 0
    And the output should contain:
    """
    Usage: newgem [options]
    """

Check out the README for advanced usage or the roadmap to see how you might contribute.

Cement2, Python CLI framework nears beta #

Cement2, the next version of the Python application framework is almost ready for a beta release. I love Command Line Interfaces, and Cement2 is a slick way to create a CLI in Python. The canonical Hello World CLI is just five lines:

from cement2.core import foundation
app = foundation.lay_cement('helloworld')
app.setup()
app.run()
print('Hello World')

With the single call to lay_cement, this Python script is a full-fledged CLI complete with usage and help information:

$ python helloworld.py --help
usage: helloworld.py [-h] [--debug] [--quiet]

optional arguments:
  -h, --help  show this help message and exit
  --debug     toggle debug output
  --quiet     suppress all output

I especially like how Cement separates interfaces and handlers, allowing for swappable implementations of features based on command line arguments. There is also a robust plugin architecture for those that want to extend it. Be sure and check out the Portland branch for the source as Cement2 is still under active development.

JazzLibs – Ruby CLI to rollout and manage JavaScript libraries #

JazzLibs is a small Ruby library from Paul Engel to stamp out a repository structure and manage JavaScript libraries. The simple Thor-based CLI unfurls a new project that includes:

  • a source folder
  • a demo folder and nice looking HTML page with your assets wired up
  • default license
  • Rakefile for managing releases

Screenshot

The bundled Rakefile includes a release task that lets you easily version and deploy new versions of your script. Check out the GitHub repo to fork and contribute.

capt: Command line tool for creating Backbone.js apps #

If you set out to use Backbone.js for a client-centric application, one thing you might miss coming from a server-side MVC framework is some basic file structure, dependency managment, and generator support. To solve this problem Ben Nolan has created Capt.

Capt is aimed at developers building single page, stand alone applications as well as server-backed applications using Node.js, bundling the following projects and languages:

Languages

  • Coffeescript
  • JavaScript
  • SCSS
  • LESS

Testing frameworks

  • Qunit
  • Jasmine [planned]

Libraries

  • jQuery
  • Backbone.js
  • Underscore.js
  • json2.js

Installation

You can grab Capt from npm

npm install capt

To check your installation and see usage help, just run capt in your
terminal:

Usage:

capt new projectname 
  - create a new project

capt server
  - serve the current project on port 3000

capt watch
  - watch the current project and recompile as needed

There’s also generators to create Backbone models and controllers:

capt generate model <model name>

capt generate controller <controller name>

Capt is still in alpha but is under active development. Got ideas? Why
not contribute?

[Source on GitHub] [Web
site
]

jsonpipe: Convert JSON to a UNIX-friendly line-based format using Python #

As the web seems to be moving to JavaScript Object Notation over XML for data transfer, it’s nice to find tools to help you work with JSON from the command line. Changelog listener Jason Williams pointed us to JSON Pipe, a simple Python command line utility for visualizing JSON document structure.

Installation and usage

Install JSON Pipe via pip

pip install jsonpipe

Now we can pipe data into jsonpipe to see a breakdown of the structure of the document:

$ echo '[{"a": [{"b": {"c": ["foo"]}}]}]' | jsonpipe
/   []
/0  {}
/0/a        []
/0/a/0      {}
/0/a/0/b    {}
/0/a/0/b/c  []
/0/a/0/b/c/0        "foo"

How about inspecting an NPM package?

curl https://github.com/jashkenas/coffee-script/raw/master/package.json | jsonpipe

/ {}
/name "coffee-script"
/description  "Unfancy JavaScript"
/keywords []
/keywords/0 "javascript"
/keywords/1 "language"
/keywords/2 "coffeescript"
/keywords/3 "compiler"
/author "Jeremy Ashkenas"
/version  "1.1.0-pre"
/licenses []
/licenses/0 {}
/licenses/0/type  "MIT"
/licenses/0/url "http://github.com/jashkenas/coffee-script/raw/master/LICENSE"
/engines  {}
/engines/node ">=0.2.5"
/directories  {}
/directories/lib  "./lib"
/main "./lib/coffee-script"
/bin  {}
/bin/coffee "./bin/coffee"
/bin/cake "./bin/cake"
/homepage "http://coffeescript.org"
/repository {}
/repository/type  "git"
/repository/url "git://github.com/jashkenas/coffee-script.git"

Since the output is regular STDOUT, JSON Pipe is piping hot:

curl https://github.com/jashkenas/coffee-script/raw/master/package.json | jsonpipe | grep "homepage"

/homepage   "http://coffeescript.org"

JSON Pipe will show you the key/value structure of your JSON documents faster than you can say XPath.

[Source on GitHub]

solarized: Light and dark precision color scheme for terminal apps, editors #

We developers spend as much time finding the right color scheme for our text editors and command line tools as we do using them. Normally, you find your tool of choice and then browse the gallery of themes to pick one to use or customize.

Ethan Schoonover has taken a different approach with Solarized, a theme that comes with support for a number of tools out of the box including:

  • Vim
  • Mutt e-mail client
  • Xresources / Xdefaults
  • iTerm2
  • OS X Terminal.app
  • Adobe Photoshop Palette (inc. Lab values)
  • Apple Color Picker Palette
  • GIMP Palette

Sample

Never before has so much design gone into a color theme. Ethan supports both light and dark variations to support selective contrast and other features

palette

There’s even a Sass implementation:

$base03:    #002b36;
$base02:    #073642;
$base01:    #586e75;
$base00:    #657b83;
$base0:     #839496;
$base1:     #93a1a1;
$base2:     #eee8d5;
$base3:     #fdf6e3;
$yellow:    #b58900;
$orange:    #cb4b16;
$red:       #d30102;
$magenta:   #d33682;
$violet:    #6c71c4;
$blue:      #268bd2;
$cyan:      #2aa198;
$green:     #859900;
@mixin rebase($rebase03,$rebase02,$rebase01,$rebase00,$rebase0,$rebase1,$rebase2,$rebase3) 
{
    background-color:$rebase03;
    color:$rebase0;
    * { color:$rebase0; }
    h1,h2,h3,h4,h5,h6 { color:$rebase1; border-color: $rebase0; }
    a, a:active, a:visited { color: $rebase1; }
}
@mixin accentize($accent) {
    a, a:active, a:visited, code.url { color: $accent; }
    h1,h2,h3,h4,h5,h6 {color:$accent}
}
/* light is default mode, so pair with general html definition */
html, .light { @include rebase($base3,$base2,$base1,$base0,$base00,$base01,$base02,$base03)}
.dark  { @include rebase($base03,$base02,$base01,$base00,$base0,$base1,$base2,$base3)}
html * {
    color-profile: sRGB;
    rendering-intent: auto;
}

We didn’t see TextMate support. Perhaps you could fork the project and contribute.

[Source on GitHub]