Shell

75 Zsh Commands, Plugins, Aliases and Tools — SitePoint – Website Design Article

I spend a lot of my day in the terminal, and my shell of choice is Zsh — a highly customizable Unix shell that packs some very powerful features. As I’m a lazy developerTM, I’m always looking for ways to type less and to automate all the things. Luckily this is something that Zsh lends itself well to. In this post, I’m going to share with you 75 commands, plugins, aliases and tools that will hopefully save you some keystrokes…

Read More

How to Set a Default Commit Message – Website Design Article

Having a default commit message is really useful for a number of reasons: It can formalize your commit messagesIt serves as a good reminder for the information you should add to your commit message, like issue numberIf you set it to “Drunk AF, don’t accept this” To set a default commit message on your local machine, start by executing the following from command line: git config –global commit.template ~/.gitmessage This tells your local git config to pull the text from…

Read More

How to Specify User Agent with cURL – Website Design Article

Over the years I’ve shared how to perform a number of actions with cURL: how to send POST data, how to retrieve headers, follow redirects, check GZIP encoding, and more. Another useful cURL directive is sending the user agent, as some servers respond with different content or headers depending on the user agent. Let’s have a look at how easy it is to send the user agent with cURL! The user agent may be sent with the -A or –user-agent…

Read More

View Mac Calendar from Command Line – Website Design Article

As someone that loves using UI tools, I do pride myself in learning how to accomplish the same feats from command line. Don’t believe me? Check out my Command Line tutorials section — I guarantee you’ll learn quite a bit. Recently I learned that you can view basic calendars from command line with the cal command: ~ $ cal February 2020 Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12…

Read More

Git Branch Autocompletion – Website Design Article

Naming git branches is something most of us have down to a science. My branch naming pattern is usually {issue number}-short-feature-description, though many developers prefer to lead with the description and end with the issue. Regardless of the pattern you use, having a feature like autocomplete can save you a lot of time typing or copy/pasting. Here’s how you can implement autocomplete for git branches! Start by downloading the git-completion.sh file from GitHub: curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash -o ~/.git-completion.bash Next, add the…

Read More

Validate CSP from Command Line – Website Design Article

The content security policy spec has been an amazing front-end security tool to help prevent XSS and other types of attacks. I’d go as far to say that every site should implement as specific CSP as possible. If you aren’t familiar with CSPs, here’s a quick example: Content-Security-Policy: default-src ‘self’; img-src *; media-src media1.com media2.com; script-src userscripts.example.com If a linked resource or content on the page doesn’t pass a given CSP rule, it wont be loaded. Of course getting a…

Read More

Mirror Android Device to Computer – Website Design Article

As I continue my adventure into Android development, pair programming has been a huge help in learning this new platform. When it’s time to build and run the app, relying on the emulator is a fools’ game — the emulator is slow and it’s hard to reliably simulate gestures. If you have an android device, like a phone or tablet, you can plug it into your computer and mirror the display to your computer using an awesome utility called scrcpy!…

Read More

How to Create a QR Code – Website Design Article

QR codes aren’t everyone’s cup of tea but I quite like them. If I see something I want to remember or check out later, especially when on the road, it’s super easy to take a quick picture — it’s much easier than trying to remember a URL and much faster than typing it in on a tiny keyboard. If you need to generate QR codes, for a client or yourself, there’s a really nice JavaScript project: node-qrcode. Let’s look at…

Read More

Firefox Kiosk Mode – Website Design Article

As someone who loves the HTML and web APIs, I want to see them used in all different types of devices and mediums. Being that I work for the amazing Mozilla Corporation, seeing Firefox and the gecko web engine thrive in those spaces is important to me. Firefox was recently featured in the Firefox OS phone, Firefox OS TV, and a host of IoT devices. I was pleased to see our platform team recently created a new mode for launching…

Read More

How to Reverse a Video – Website Design Article

One of my favorite media utilities is ffmpeg. This command line utility allows us to do some pretty amazing stuff like; Every once in a while I see a meme or funny video that reverses a video for effect. Since ffmpeg does just about everything I can imagine, I turned to it. To reverse a video, use the following ffmpeg command: ffmpeg -i my-video.mp4 -vf reverse my-video.mp4 Remember that you can simply change the video format via the output video’s…

Read More

Convert Video to Grayscale – Website Design Article

I’m a JavaScript fanatic but I’ve always been fascinated with media manipulation. Maybe it’s because I’ve secretly always wanted to be a designer, but I’m fine with being able to manipulate art with software instead of create the art myself. One type of art I’ve always enjoyed was black and white (/grayscale) video. To convert a video to black and white, you can utilize ffmpeg with a few simple arguments: ffmpeg -i input.mp4 -vf hue=s=0 output.mp4 The preceding command turns…

Read More

Open FaceTime Call from Command Line – Website Design Article

Communication tools are always associated with UIs, and for good reason — if you want communication to be easy and intuitive, you need easy and intuitive interfaces. We need communication tools to provide the lowest barrier of entry, since not all users will be tech savvy. For tech experts like us, however, we love command line tools to automate just about everything. This led me to thinking: is it possible to initiate a FaceTIme call from command line? # Call…

Read More

Set Branch Alias with Git – Website Design Article

Version control systems can be difficult to use, especially when you don’t use a UI app. Just think about main branch or revision names: svn uses “trunk”, git uses “master”, and mercurial (hg) uses “tip”. I need to switch between mercurial and git frequently, so I end up reversing command and branch names constantly. To set a git branch alias, execute the following: # alias -> real branch git symbolic-ref refs/heads/trunk refs/heads/master With the alias in place, you can execute…

Read More

How to Set Commit Author – Website Design Article

I’ve worn dozens of hats on a dozen different teams during my time at Mozilla, but none has been as rewarding and challenging as community management. Whether it’s mentoring students, welcoming new contributors, or reviewing pull requests, there’s always so much to be done. There’s also the rare occasion where I need to submit a patch for a contributor. Since I work with both git and mercurial (hg), I’ve needed to learn how to set commit author in each version…

Read More

List USB Devices from Command Line – Website Design Article

I was recently creating a Recalbox with my 5 year old son and it was an awesome experience; I saw the excitement and curiosity in his eyes while helping him put together a video game machine. We added NES, SNES, and Nintendo 64 games to the device but it became apparent that the N64 controller needed its buttons reconfigured in a config file. To do so I needed to know the device’s USB name. You can use the following command…

Read More

Get File MIME Type from Command Line – Website Design Article

I’ve gotten skilled at shell scripting over the years. I love a good GUI but knowing how to automate makes you a much more powerful engineer. Much of my scripting requires recursing over directories and processing a file if it meets a given criteria, which is often file extension or MIME type. You can use the following shell command to get a file’s MIME type: file –mime-type -b Downloads/main.js # text/plain file –mime-type -b Downloads/logo.jpg # image/jpeg It’s important to…

Read More

Mac Dark Mode from Command Line – Website Design Article

One of the best professional decisions I ever made was switching to a dark text editor theme. I suffered from horrible headaches for years, partially caused by late night coding sessions with blindingly bright computer screens. Recently Apple implemented a dark OS theme which helps my eyes, and thinking in a command line state of mind, I was wondering if there was a way to change dark or light mode via command line…and I found out how! Switching between light…

Read More

Set Desktop Wallpaper from Command Line on Mac – Website Design Article

Whenever I need to accomplish a basic task that typically calls for interacting with a UI, I challenge myself to complete the task from command line. After all, most UIs are simply a mask over basic commands, especially when it comes to the operating system. Suddenly I feel like an automation or systems engineer! One task I can imagine an IT administrator would need to automate is setting the desktop wallpaper via a script, remotely, or simply by providing the…

Read More

How to Change Animated GIF Speed – Website Design Article

Comedians would tell you that timing is the most important part of any joke. The same could be said about animated GIFs; whether they’re used as a meme or to illustrate a process, the speed of an animated GIF can effect its effectiveness. With that idea in mind, I set about trying to figure out how to modify the speed of an animated GIF; let’s explore it! Let’s use the following GIF as our sample: The first step in modifying…

Read More