All posts tagged 'Bash'
-
Grepping Through Your Dotfiles
I manage my dotfiles with a bare git repository, as described in this post. One issue I have run into is remembering where exactly I added this or that alias. Did I place it in .bash_aliases, or did I create a separate file, like the file for my Git aliases. And what exactly does it do, anyway? Here...
Read article -
A Bash Function for Easy Zipping
I work as a tutor in a software engineering bootcamp, and earlier on in the project students submit their projects, and pass them to us for help, as zip archives. Unzipping an archive at the command line is rather easy. unzip foo.zip But zipping is a bit trickier, and I'd always forget the syntax....
Read article -
On Yargs Autocompletion
Yargs provides some rather nice autocompletion for commands and flags with some minimal setup, but I wanted autocompletion of positional arguments for one of the commands in the CLI clipboard manager I'm making. This clipboard manager (cb) basically does one thing: let's me quickly save the contents...
Read article -
A custom edit action for todo.txt-cli
Frequently I find myself looking for a better way to keep track of my todo list, and I may have found the ideal solution for me: todo.txt. It's a simple plain text syntax for writing todo lists. I've been using it with the todo.txt CLI lately, on Ubuntu and WSL2, syncing the documents with...
Read article -
Automating Tasks in Rails with VS Code
I've begun working through the new edition of Michael Hartl's excellent Ruby on Rails Tutorial and found that I had to run a number of commands each time I open my repository, so I decided to try to automate them with VSCode tasks. It's worked fairly well, so here are my results. Before starting, I...
Read article -
Backing Up WSL2 part 3 of 3
Last time, I automated my backup script with a cron job, but realized it still wasn't automated enough. So I had to automate the automation. Well, that's what I started doing, at least. Then I did something easier. Start cron service with Windows Task Scheduler Following this how to I scheduled a...
Read article -
Backing Up WSL2 part 2 of 3
In my previous entry, I detailed a simple Bash script I wrote to backup my WSL files. I noted that there was still one major problem with the setup — it wasn't automated. This post explains how I resolved that. My first attempt involved writing a cronjob. I'll summarize that attempt here. How to set...
Read article -
Backing Up WSL2 part 1 of 3
This is the first in a three part series detailing my setup for backing up WSL2 files. I'm sure it's not optimal, but it's been working for me so far. The Basic Script First, I started off by writing a simple bash script, based off of one found in this great article: Automatic Backups for WSL2. The...
Read article -
Dotfiles in Version Control
A few months back I set up my first dotfiles repo.undefined I chose the simplest option — turning my $HOME directory into a repo with a .gitignore of *. This went ok, and I was able to set up a new computer with relative ease. But the setup was not without its problems, most of which stemmed from...
Read article -
Accessing Windows User Directory in WSL2
Not as easy as it sounds.
Read article -
How to search through text with grep
Here are a few ways to use grep — a command line program that allows you to search through text. 1. Search for a pattern in a file The basic syntax is grep <pattern> <filename> where <pattern> is a string or regex. Running this will print each line in <filename> that contains a...
Read article -
Automating the Creation of New Github Repos
Today I'm going to walk you through writing a Bash script to automate a common task: creating a new repo on GitHub, setting it as the remote of a local repo, and making your first push to the new repo. This will require you to use GitHub's command line interface, so make sure you've got that set up...
Read article -
A Script to Create React Components. Part 2 of 2
This is the second part of this post on writing a bash script to automate some parts of creating React components. In the first part, we left off with a functioning, but pretty much useless, bash script. Now, let's make it useful. Recall that our proposed script will take an argument representing...
Read article -
A Script to Create React Components. Part 1 of 2
After creating new React components manually for the umpteenth time I decided that the process could be automated a bit. We have CRA for React apps. Why not CRC, for React components? This is part one of a two part article that will walk you through writing a Bash script to automatically create the...
Read article