An introduction to the command line

Knowing your way around the commnand line has many benefits. With a bit of practice, you can accomplish many tasks much faster on the command line than using any other tool.

The command line is almost always available, unlike some GUI tools that must be installed. You can save frequently-used commands as aliases and save time. Your bash history will save your bacon at least once when you forget how to do something. …


Git is a powerful tool. Once you’ve mastered and , there are endless possibilities. A very useful one is . It helps you find a commit that introduced a certain change in behavior.

When you find a regression, something broken that used to work, use to find the commit that broke it. Mark the current commit as and mark an old commit, where that feature still worked, as . will then bisect all the changes between those two commits with a binary search. …


Counting sort with a twist

The problem: Given an unsorted array of numbers, find the maximum difference between the successive elements in its sorted form. The numbers can be negative or decimals.

Image for post
Image for post
Given [21, 41, 17, 45, 9, 28], the maximum difference is 13.

Straightforward Algorithm

const maxGap = input =>
input
.sort((a, b) => a — b)
.reduce((acc, cur, idx, src) =>
Math.max(acc, idx > 0 ? cur — src[idx — 1] : 0), 0);

This function first sorts the inputs. Resulting in for our example. Next, it iterates over the sorted array and keeps track of the maximum difference in the accumulator variable:

  • max(0, 0) = 0
  • max(0, 8) = 8
  • max(8, 4) =…


Bare -- in bash commands

Why do we sometimes use bare double dashes in commands like ? Isn’t just as good?

Image for post
Image for post

Bare double dashes signify the end of options. Anything after is a parameter. For example in git, you can checkout a file named :

git checkout master     # Checkout the master branch
git checkout -- master # Checkout the file named master

In proper documentation, we see when would work, too. safeguards against checking out branches when files have the same name as branches.

POSIX.1–2017 standard

12.2 Utility Syntax Guidelines

Guideline…


Simultaneously Working on Application and Dependency

Image for post
Image for post

Sometimes you need to work on application code and a dependency at the same time. You might be the author of a dependency and don’t have good test coverage yet. The application can serve as an end-to-end test for the dependency. Maybe you need to debug an issue in your application and the problem seems to be in the dependency sources.

Image for post
Image for post

You could make changes in and manually copy the changes to the repository of the dependency once you are done. But there is a much cleaner approach: .

Usage

Package linking is a two-step process:

  1. Create a global symlink for a dependency with . A symlink, short for symbolic link, is a shortcut that points to another directory or file on your system. …


When binary is useful outside of a coding interview

This article is available in Chinese.

V8 is Google’s open source JavaScript engine. Chrome, Node.js, and many other applications embed V8. If you have heard any talks about V8 or read any blogposts, you have surely heard about , small integers. This article digs into V8’s source code to discover how large actually are.

JavaScript, by specification, does not know about integers (with the exception of recently introduced BigInts). It only knows IEEE doubles. But many operations are based on integers, just think of loops. All JavaScript engines have a special representation for integers. …


We Care about Developers

I recently switched teams and have a fancy new title now: Cloud Developer Programs Engineer, short DPE. What’s that you ask? Well, I had to ask, too.

DPEs are at the intersection of Developer Advocacy, Technical Writing, Product Management, and Engineering.

We are engineers in Developer Relations in Google Cloud. DPEs are at the intersection of Developer Advocacy, Technical Writing, Product Management, and Engineering. We listen to the developer community’s feedback and bring it back to the product teams to improve our products. We write developer tools and samples. …


An Intro to the Node.js Client Library for Compute Engine

Google Compute Engine delivers virtual machines (VMs). Compute Engine supports scaling from single instances to global, load-balanced cloud computing.

On Compute Engine VMs, you can install any operating system or software and you have full control over the firewall. A Compute Engine VM is like your local workstation, except that it lives in the cloud. You can easily scale to more or fewer VMs at any moment as needed.

The easiest way to get started with Compute Engine is through the Cloud Console. You can configure and run virtual machines in the UI.

Image for post
Image for post
Configure Compute Engine instances in the Cloud Console.

But what if you want to automate the process of configuring and running VMs? That’s where the Compute Engine API comes in handy. It is a REST API for managing virtual machines on Google Cloud Platform. The Client Library for Node reduces the amount of code you need to write and makes your application more robust. It’s easy to manage your VMs programmatically with Node.


List of Lovely Tech Blogs

Image for post
Image for post

Nothing to do over the holidays? Read these inspiring blogs about software development. Listed in alphabetical order.

Amy Nguyen

Amy Nguyen writes about software engineering, e.g., how she hacked Ticketmaster with DevTools to get Taylor Swift tickets, interviewing, and speaking at tech conferences: blog.amynguyen.net

Erica Sadun

Author of Swift Style, Erica Sadun writes about Swift and news from the Apple ecosystem. Check her out at ericasadun.com.

Jessie Frazelle

Jessie Frazelle writes about containers and Linux and anything cool. Have a look at her blog at blog.jessfraz.com.

Julia Evans

Julia Evans writes about Linux and How to teach technical concepts with cartoons. If anybody knows how to do that, it’s her, because she has published eight zines about systems and debugging tools. …


What’s faster, C++ or JavaScript?

JavaScript is a ridiculously fast scripting language. But how fast is JavaScript compared to C++? Let’s look at this example that computes prime numbers in Node with JavaScript and with a native C++ addon.

The JavaScript and the C++ implementation use the same algorithm. My measurements show that calling into the addon and running the computations in C++ is faster than staying in JavaScript except for small prime numbers.

If your Node app’s sole purpose is to compute prime numbers and you don’t want to use a fast lookup table, please rely on this benchmark 100%. …

About

Franziska Hinkelmann

Senior Engineer at Google. Node.js Monkey Patcher.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store