iPad Screenshots

Dr. Drang:

On the iPad, ⇧⌘3 captures the whole screen, just like the Mac (and just like capturing with the top and volume up buttons). The ⇧⌘4 shortcut also captures the whole screen, but in a neat analogy to the Mac, it immediately puts you into editing mode so you can crop the capture down to a smaller size.

I don’t find these keyboard shortcuts surprising, but it is surprising that I never thought to try it on an iPad. With the new screenshot tool in macOS Mojave, I wonder what other features will reach parity on macOS and iOS in the future.

Removing Local Git Branches That Aren't `master`

Every so often, I’ll want to delete all of my local branches for a repository that aren’t the master branch. An easy command to do this is:

$ git branch | grep -v "master" | xargs git branch -d

(If you want to keep multiple branches, such as master and develop, you can chain them together using grep -v "master\|develop")

git branch lists all of the local branches for the repo, grep -v prints all of the lines from the previous command that don’t match “master”, and xargs takes each line from the previous output and runs git branch -d <output_line>.

I recommend using -d rather than -D in case git recommends not deleting the branch.

How To Change a Git Repo's Authentication Protocol

HTTPS to SSH Key

Often I need to change a git repository to use an SSH key instead of my username and password to authenticate with the remote server. In order to do so, type the following in the repository’s folder on your machine:

$ git config remote.origin.url git@github.com:username/repository_name.git

(Make sure to include the .git at the end of the repository name.)

SSH Key to HTTPS

In order to change it to do the reverse, type:

$ git config remote.origin.url https://github.com/username/repository

Auto Login for PuTTY (Windows)

Often I find myself wanting to have an easy way to SSH into a server on a Windows PC. Unfortunately, SSH keys on Windows can often be a challenge, but there’s an easy way to have PuTTY connect without needing to type in a password every time.

To create a shortcut for a PuTTY connection to automatically log in, you only need two things: the name of the profile (in PuTTY) that has the connection and appearance settings, and the password to your account (for the server). Right click on the desktop to create a new shortcut, then for the link type:

"C:\Program Files (x86)\PuTTY\putty.exe" -load "<profileName>" -pw "<password>"

If you saved PuTTY to a different location other than Program Files (x86), then you’ll also need to change the location of putty.exe in the command above.

Once you’ve created the shortcut, you can pin it to the taskbar or the start menu for easy access!

These instructions were inspired by the instructions for the Purdue ECE 264 course page.

Pointing a Github Pages Repo to a Hover Domain

My blog is currently hosted using GitHub Pages—which is a great way to host your static site or blog for free—by linking it to my custom domain that I purchased through Hover. While both of these services are amazing, connecting the two required many open tabs and several waiting periods. This post will explain the steps needed to point a GitHub Pages repo to a custom domain on Hover.

Preflight Check

Before connecting GitHub Pages to a custom domain, I first updated my blog on my repository nickymarino.github.io, and checked that it was displaying properly at its default website (normally https://nickymarino.github.io).

First you need to update your repository with your custom domain. In the settings for the repo, enter the domain in the “Custom domain” in the GitHub Pages section.

GitHub Pages settings for the repo

A Records on Hover

The next step is to configure Hover. Find GitHub’s current list of IP addresses to create records with. Then, go to your Hover account, select your domain, and go to the DNS tab) to add to the DNS tab on Hover. At the time of writing, these are:

185.199.108.153
185.199.109.153
185.199.110.153
185.199.111.153

Then, go to your Hover account, select your domain, and go to the DNS tab. Delete any DNS records that have an “A” under “Records”.

For each IP address on GitHub’s help pages, add a DNS record. For each, the “Type” will be A, the “Hostname” will be @, and the “TTL” can be left as the default value.

Hover DNS settings

It may take several hours (or up to about a day) for the changes to take effect. Take a break, get some sleep, and then come back to your domain to make sure everything’s working. Now we can enforce HTTPS!

Create HTTPS certificate

If you head back to your repo’s settings page to enforce HTTPS, you might see the following “not yet available” error:

GitHub Pages HTTPS error

Per GitHub’s troubleshooting page, you need to remove and then re-add your custom domain for your repository. Wait around 24 hours for the certificate to be generated, and you should be good to go!

A New Look

I’ve owned this domain (nickymarino.com) for roughly three years now, and so far I’ve only used it as a resume/portfolio site. I’ve finally found a theme that I both appreciate and can spend time modifying to fit my needs.

My goal is to start writing (and podcasting!) more often, whether it’s a technical detail I found interesting, an overcome challenge I want to record for when I encounter it again, or anything else I can think of.

I have a few ideas up my sleeve.

You can stay updated via the site feed or on Twitter.

Let's Use LaTeX!

LaTeX is a beautiful documentation system. It’s similar to Markdown1, but has many more features and is commonly used for academic papers and other publications that require a lot of equations. In this quick how to, we cover how to install LaTeX and use Visual Studio Code as an editor/previewer.

Installing LaTeX

I recommend downloading TeX Live for Windows/Linux, and MacTex for macOS.

Setting up our editor

If you haven’t already, install Visual Studio Code and go through a tutorial. Then, we need to install our extension for LaTeX itself. Head over to LaTeX Workshop and click install.

Using LaTeX

Now that we have our editor setup, we can write our first project. All LaTeX documents have a (non-blank) file that ends with .tex, which is the “main” file that has all of the text of the document. Since LaTeX usually generates more files (such as .log, etc.) while building the document, it’s recommended that every document you want to write has its own folder.

For starters, create a file named example.tex:

\documentclass{article}
    % General document formatting
    \usepackage[margin=0.7in]{geometry}
    \usepackage[parfill]{parskip}
    \usepackage[utf8]{inputenc}

\begin{document}
% Put your text here
This is starter text.
\end{document}

Press Ctrl-Alt-B to build your project (or use the Command Palette), then Ctrl-Alt-T to view the pdf in a new tab. The end result should look like this:

picture

Conclusion

LaTeX and VSCode are a great combination that you can use to write beautiful reports and papers. Check out a tutorial or two to realize the full experience LaTeX has to offer.

Edit: Fanny recommends another great tutorial as well.

Edit 2: Fixed a tutorial link.

  1. Well, this depends on your definition of “similar”, but I feel it is.