Instagram Terminal Feed

Forget about that Instagram for Windows 95, and go for the real deal: Instagram on the CLI:

Sometimes checking your instagram during work is kind of strange, so why not check your instagram inside your terminal? OK… I know checking this during work is still strange… 😑 To be honest, I did this just for pure fun.

A color mode is also available.

Instagram Terminal Feed →

Trigger macOS notifications from the CLI with node-notifier-cli

$ notify -t "Hello" -m "My Message" -s --open http://github.com
$ notify -t "Agent Coulson" --icon https://raw.githubusercontent.com/mikaelbr/node-notifier/master/example/coulson.jpg
$ notify -m "My Message" -s Glass
$ echo "My Message" | notify -t "Hello"

Installation per NPM/Yarn:

yarn global add node-notifier-cli

TIP: As with many packages you can also run it using the aforementioned npx:

npx -p node-notifier-cli notify -t 'Hello' -m 'My message'

node-notifier CLI →

Easily Start and Stop Docker Compose Projects with Captain

Jens Segers has created a handy shell script to easily start/stop Docker Compose based projects:

Captain searches for docker-compose projects in your $HOME folder and allows you to start and stop those projects by passing a part of the parent directory name.

Let this small recording of Captain in action convince you:

Captain →

Related: Recently bumped into this basic instructional video to get WordPress up and running using a Docker setup containing a Caddy, Apache2/PHP7 and a MySQL container. Good one if you’re looking to get started with Docker.

Axel — Command Line Download Accelerator

Via @benschwarz:

Axel tries to accelerate the downloading process by using multiple connections for one file, similar to DownThemAll and other famous programs. It can also use multiple mirrors for one download.

Axel →

Getting sudden flashbacks to this old fart here:

Think it was 1999 or 2000 when I first use FlashGet (then named JetCar) to more efficiently use my 56kbps dial-up connection (where you had to pay by the minute, not megabyte) 😃

Interacting with the iOS Simulator from the Command Line using simctl

Wasn’t aware of this, but turns out one can control (and interact with) the iOS Simulator straight from the command line.

There’s no need to install anything new though. The tool we’re going to be using is already on our Mac, hiding inside the xcrun command, which gets installed with Xcode.

It’s called simctl.

Here’s a few examples:

# open a URL
xcrun simctl openurl booted "https://littlebitesofcocoa.com"

# upload an image to the iOS Simulator
xcrun simctl addmedia booted ~/images/image1.png ~/images/image2.jpg

# Take a screenshot
xcrun simctl io booted screenshot ~/Desktop/screenshot.png

# Record a video
xcrun simctl io booted recordVideo --type=mp4 ~/Desktop/movie.mp4

Other commands include booting/stopping a device, clipboard operations, launching/terminating processes, installing/uninstalling apps, etc. — No touch events though, that would’ve been real fun.

Little bits of Cocoa: Interacting with the iOS Simulator using simctl

Sidenote: digging a bit deeper into this I stumbled upon fbsimctl. Their features are quite the same which makes me wonder if fbsimctl uses simctl underneath its hood, or if simctl came later and copied features from fbsimctl.

Run a Terminal task list with listr

With listr one can define a set of tasks to run:

const execa = require("execa");
const Listr = require("listr");

const tasks = new Listr([
    {
        title: "Git",
        task: () => {
            return new Listr([
                {
                    title: "Checking git status",
                    task: () => execa.stdout("git', ['status', '--porcelain"]).then(result => {
                        if (result !== "") {
                            throw new Error("Unclean working tree. Commit or stash changes first.");
                        }
                    })
                },
                {
                    title: "Checking remote history",
                    task: () => execa.stdout("git", ["rev-list", "--count", "--left-only", "@{u}...HEAD"]).then(result => {
                        if (result !== "0") {
                            throw new Error("Remote history differ. Please pull changes.");
                        }
                    })
                }
            ], {concurrent: true});
        }
    },
    {
        title: "Install package dependencies",
        task: () => execa("npm", ["install"])
    },
    {
        title: "Run tests",
        task: () => execa("npm", ["test"])
    },
    {
        title: "Publish package",
        task: () => execa("npm", ["publish"])
    }
]);

tasks.run().catch(err => {
    console.error(err);
});

It’s also possible to dynamically skip a task in the series, and to run tasks concurrently.

A standalone binary to pass in a .json file with tasks would nicely compliment this.

listr – Terminal task list →

Find relevant emoji from text on the command-line with emoj

Geekfun:

emoj

emoj is written in Node and uses the Dango API, which helps you quickly find emoji by understanding what you type using deep learning.

Installation via npm (requires Node >= 4):

npm install --global emoj

emoj Source (GitHub) →
Dango: Teaching Robots to Feel: Emoji & Deep Learning 👾 💭 💕 →

Easily create new CLI aliases with `new-alias`

I love stuff like this:

1-uE8FMv0eWNQChRKyBrWR8Q

It’s a handy little alias to create aliases for commands you just ran … an “alias-generating alias”; my inner geek rejoices 🙂

Here’s the code (add it to your .bash_profile):

new-alias() {
  local last_command=$(echo `history |tail -n2 |head -n1` | sed 's/[0-9]* //')
  echo alias $1="'""$last_command""'" >> ~/.bash_profile
  . ~/.bash_profile
}

Usage: new-alias name-for-the-alias

An alias for new aliases →