Linux

Raspberry Pi 4: Minecraft Server

A quick overview and review of the Pi 4 as a Minecraft server! This is a pretty well known use for the Pi 4; here is my take on how easy it is to set up and how well the Pi 4 works as a gaming server.
Minecraft gameplay on a minecraft server

Background: Pi 4 Applications

I've previously written a few articles on the Raspberry Pi 4 as desktop replacement; the gist of my review was basically, "... yes, you can--but, would you really want to?" Don't get me wrong.

Bash: Using '$_' and '$1' to Manage Repetitive Command Line Tasks

A few examples of how you can recycle arguments in Bash commands using the '$_' and '$1' shorthand aliases. This is a great way to save time and keystrokes when working in Bash

Background: Just Too Many Keystrokes

The more time you spend on the command line, the more you realize much of your time there is occupied by typing out the same thing (i.e., a filename, or certain command) over and over. Bash shines in its ability to take long complicated commands and store them in aliases. No matter how many aliases you create, though, you'll still need to dedicate a little brain power to your command line surfing. Sometimes, aliases just don't apply.

Nano: Forgot Sudo and Need to Save A File You Don't Have Permissions to Save

You've opened a file from the root system without using sudo and you're editting it without realizing you don't have write permissions. After all your edits, what do you do? Don't lose your file!--you just need to change the save path! You can do that in Nano's save prompt!

So I'm racing to get a LAMP stack up and going on one of my computers. I need to update the php.ini file which resides in the root file-system at /etc/php/7.4/cli/php.ini. In my haste, I opened up the document from within its file path using $ nano php.ini and started any number of edits. I hit ctl-o to save, and Nano gives me an unsurprising line about how I don't have permissions to save the file. Ever seen something like this?

Linux: Setting Up Google Talk/Chat on Pidgin

It looks like there are a lot of people out there having trouble getting Google Talk to play nice with Pidgin. If you're running into an authentication error, the culprit may have nothing to do with your credentials or Pidgin. Google just doesn't recognize the app as "secure", so they'll deny the login unless you adjust your account settings. Here's a walkthrough, if you need it.

I kind of doubt Pidgin actually falls within whatever Google defines as an insecure third party application: it's more likely that they just don't want you leaving the Google ecosystem. Either way, I wound up hitting my head against a wall recently when trying to get my Google Talk/Chat account setup on Pidgin. The trick is to login into Google and adjust the security settings on your account. Let's start with setting up your credentials on Pidgin; I'll cover where/how to adjust your Google account afterwards.

Bash: Interactive Script to Bring Window to Front or Open App

Ever find yourself rotating between multiple applications within the same single workflow? For me, I like to call it the holy trinity: VS Code, GitKraken and Firefox. When I'm working on a site, I'll inevitably spend almost as much time cycling from one of these applications to the other as I do writing code. I finally got so sick and tired of this that I decided to write a little Bash script to make rotating between applications just a little less cumbersome. Since VS Code has a terminal emulator, I can run the script from there to jump quickly to the next application(s) in my workflow.

Background: Multitasking Wears You Down!

Web development is a conglomeration of tasks; there's really no way around it. Having two monitors is a good way to get a bird's-eye view of everything going on within your workflow. If you like to maximize your windows, though, you're only ever going to get two applications to work with at any given time. On an average day, I'll have roughly 3 Firefox windows, a terminal, VS Code (with its own terminal emulator), GitKraken, Koala (SASS compiler) and maybe Virtual Box--all open at the same time.

Bash: An Easier Way to Check File Permissions (Octal Mode & Stat)

File permissions on Linux can be a pain. You can either understand them in symbolic mode (basically, alphabet soup--i.e., drwxrwxrwx), or you can master them in octal mode (i.e., 777--which roughly translates to "Open the gates of Mordor!"). While symbolic mode might acutually be the more human-readable format; octal mode feels a bit more intuitive, and in my experience is what I see referenced more often on the interwebz (i.e., StackOverflow). The problem?--Linux generally defaults to symbolic mode on the command line--such as when you run ls -l. Here's a short script that helps cope with this. Run it, and it'll give you the permissions for a file, directory, or contents of a directory in octal mode.

Lost in Translation

First off: I'll assume this isn't your first time dancing the permissions tango--i.e., you have a basic understanding of symbolic and octal permissions. So, I won't go into the nitty gritty, here, of what each and every number combination means--let alone the existential implications of what your permissions should be for any given use-case.

Bash: A Simple Script for Copying Files and Directories with SCP

This is a followup, of sorts, to an earlier post on file sharing in Xubuntu--which can be kind of a pain. I never looked seriously at SCP as a solution for file sharing because it's honestly tedious--true for both in-network and out-of-network sharing. With a little Bash scripting, though, SCP can be made a lot more practical. Here are a couple of short scripts that take the edge off.

Background

SCP is a command-line tool for passing files from one computer to another with SSH. That makes it a valuable tool no matter where those computers are: inside your home network, or off on some remote. The trouble I've always had with it, though, is remembering addresses: I can never remember the IP address of each and every device on my network, and some of the remotes I work with have really convoluted sub-domains. If it weren't for this, SCP would be a really great way to pass files from one place to another.

Bash: A Simple Script for Automating Git Reset

Don't you just hate doing Git Log, sifting through a bunch of commit hashes and then copy-pasting--all so you can reset to an earlier commit? I do--particularly the part where I need to select, copy and then paste the stupid hash. Today was a breaking point, actually. I finally wrote a script that will find the hash I want and pass it to Git Reset for me. My day is finally looking up.

Background

I needed to un-merge a branch today (stakeholders backed out--it happens). This meant reverting my preview branch to a commit just before the merge. This is exactly the kind of thing, I think, that pushes so many devs to graphical Git clients (like, GitKraken, et. al.); doing a reset on the command line is kind of pain. You need to run git log, find the earlier hash for a commit you want to reset to, copy it, and then paste it into a git reset command.

Bash: A Simple Script for Changing Display Brightness with XRANDR

I run two external displays on my laptop; the brightness keys on the laptop don't affect them. I could probably find an app or extension for Xubuntu to handle dimming the displays, but since I spend a lot of time on the command line, it's just as easy to dim them from there with the help of XRANDR and a simple Bash script. This post outlines how to set the script up. I'll also cover an optional "night mode" that reduces blue gamma from the display.

If you're on Xubuntu, Ubuntu, or just about any other flavor of Linux, you're probably using the X server to handle your display configurations. That should also mean that you have XRANDR available on the command line. XRANDR can change display configurations in any number of ways, but today I wanna look at it for controlling brightness. Here's the deal, though: I don't wanna have to memorize yet another command line syntax just to dim my monitors. Whichever way XRANDR handles the dimming, I'm gonna move it into a Bash script and alias it so I can adjust brightness on the fly!

Git: Add, Commit and Push All at Once (Bash Function)

Git is a powerful tool, but sometimes the redundant keystrokes are a pain in the butt. Should you really Add, Commit and Push all in one fell swoop?--No. There are plenty of good reasons not to. Can you? Yes. All it takes is a little scripting with Bash.

Use Case

I love Git. It can sometimes suck the life out of you, though. That may not be the case for everyone. How much time you spend banging your fingers on the command-line kind of depends on your workflow. If you're a front-end dev, for example, and you spend a lot of time tweaking CSS (or SASS, or whatever), a good way to minimize your use of Git is to simply leverage your browser's Developer Tools more efficiently. Another good strategy is to focus on your localhost--reducing the number of pushes you need to make.