#!/bin/bash| #!/usr/bin/env

The program /bin/bash is one of many shells, which is a program that interprets command-line input.

Before the /bin/bash, you might have noticed “#!”. This is a special type of comment that tells the system which interpreter (shell) to use to evaluate the file.

Execute the specified interpreter directly

#!/bin/bash

Execute the specified interpreter via theenv command

A common use of the env command is to launch interpreters, by making use of the fact that env will search $PATH for the command it is told to launch. Since the shebang line requires an absolute path to be specified, and since the location of various interpreters (perl, bash, python) may vary a lot, it is common to use:

#!/usr/bin/env python3

--

--

Do You frequently need to verify that you’re logged into the correct AWS EC2 instance?

Photo by Kevin Horvat on Unsplash

I frequently need to verify that I’m logged into the correct AWS EC2 instance. This turned out to be a simple task since all EC2 instances expose metadata.

Start By Querying the “meta-data” endpoint via curl.

> curl -s http://169.254.169.254/latest/meta-data | head -10

ami-id
ami-launch-index
ami-manifest-path
block-device-mapping/
events/
hostname
iam/
identity-credentials/
instance-action
instance-id

We care about instance-id, so let’s issue another curl call with instance-id appended to the URL.

> curl -s http://169.254.169.254/latest/meta-data/instance-id

i-095dae599ecc6310d

--

--

Learn to combine the properties of multiple JavaScript objects with ES6.

How to merge objects in JavaScript (with ES6 and above):

> node
Welcome to Node.js v12.3.1.
Type ".help" for more information.

> const init = { first: 'First', last: 'N/A', email: 'first.last@example.com' }

> const fin = { last: 'Last' }

> { ...init, ...fin }
{
first: 'First',
last: 'Last',
email: 'first.last@example.com'
}

--

--

I wanted to automate capturing page 1 of my PDF-based resume as a PNG file. I found out that I could accomplish the task with a tool called ghostscript.

Ghostscript is an interpreter for PostScript and Portable Document Format (PDF) files. It is available both under the GNU GPL Affero license and for commercial licensing from Artifex. It has been under active development for over 20 years and has been ported to many different systems during this time.

Export page 1 to .png

> brew install gs
> gs -dNOPAUSE -dBATCH \
-sDEVICE=png16m \
-dFirstPage=1 \
-dLastPage=1 \
-sOutputFile=resume.png resume.pdf

Resources

--

--

Wil (₩) Moore III

Wil (₩) Moore III

Full-Stack Software Engineer, DevOps, Developer Relations, Technical Writer & CTO (Mentorship Available) 🤙🏾💜🌈🦄