FeaturesDocs

Install Doctor Blog

Explore engaging articles from the Install Doctor dream team and thriving community! Learn about amazing free open-source software and how to integrate your workflow with the cloud.

Elevating Workflows: 11 Essential Command-Line Utilities

The command-line interface is a powerhouse for software developers and system administrators, offering tools that streamline operations, boost efficiency, and simplify complex tasks. This guide focuses on a select group of command-line utilities that are indispensable for GitHub power users. This list is all-encompassing by no means but, rather, a list of some of my top picks. Embracing these tools can significantly enhance your operational capabilities and enjoyment in daily tasks.

1. Enhanced Code Viewing with bat

Supercharged cat Alternative: bat reinvents the cat command with syntax highlighting and line numbering, transforming code review into a visually engaging and efficient process. It can be used to seamlessly replace cat when enhanced readability and functionality are desired. In fact, it can be used as a drop-in replacement for cat when line-numbering and paging are disabled (as long as coloring does not mess with your scripts).

Screenshot of bat output
Screenshot of bat

2. Dotfile Management Simplified with chezmoi

Robust Configuration Keeper: Chezmoi offers a streamlined solution for managing dotfiles. It powers the configuration management and templating of the Install Doctor provisioning system, providing a reliable and mature platform for organizing and version-controlling system configurations, backed by an active and responsive development community.

3. Docker Optimization with dockerslim

Slimmer Containers, Safer Deployment: dockerslim meticulously analyzes and optimizes Docker images, significantly reducing their size while adhering to security best practices. This tool is essential for anyone looking to minimize resource usage and enhance container security. It can sometimes reduce Docker container sizes by up to 90%.

4. Streamlining Development with Automated Commit Generators

Effortless Commit Messages: Tools like opencommit and aicommits automate the creation of commit messages, improving workflow efficiency and maintaining code consistency. The popularity and user-friendly interfaces of these tools make them a must-have for developers seeking to streamline their version control processes. Although aicommits has slightly more stars on GitHub (i.e. over 7000), opencommit has a well-polished TUI experience even though it only has roughly 5000 stars. Both of these tools offer the ability to install into your projects as Git commit hooks which allow you to leverage them by simply running git commit. In order to use these tools, you have to define an OPENAI API key somewhere in your ~/.bashrc or ~/.zshrc setup.

Screenshot of opencommit TUI experience
Screenshot of opencommit TUI experience

5. Directory Navigation Redefined by zoxide

Quick Folder Access: zoxide revolutionizes directory navigation by enabling quick access to frequently used folders with just parts of their names, drastically reducing the time spent navigating file systems. After including zoxide initialization code into your ~/.bashrc or ~/.zshrc file, zoxide will remember folders you have been to and allow you to cd to them by using partial paths / folder names. In other words, cd ~/.local/share/chezmoi/home/dot_config becomes z dot_config.

There are several other competeting packages like autojump but zoxide is written in Rust (i.e. it is fast) and it is very well-received by the community.

6. Scripting Made Easy with zx

JavaScript Meets Shell Scripting: ZX, a Google product, enhances shell scripting by allowing the incorporation of JavaScript/TypeScript alongside shell scripting commands, making scripts more readable and maintainable. It combines several useful packages for creating scripts (like NPM-based progress spinners and prompt packages) into an executable that can be invoked by running zx myscript.js. It handles all this by allowing you to Promisify shell commands so they look more like this:

await $`echo "Heyyy yooo"`

Install Doctor utilizes ZX to handle the installation of software on multiple different platforms as well as handle the execution of package-dependent post-installation scripts. Check out the installx executable in our GitHub repository to see how we handle installations on so many different operating systems.

7. WiFi Password Retrieval with wifi-password

Instant Network Credentials: wifi-password is the go-to utility for quickly retrieving the password of the current WiFi network, proving itself as an essential tool for both personal and professional use. It is easy to remember. Just run wifi-password and the password will be printed to your terminal.

8. Node.js Version Management by Volta

Consistent Development Environments: Volta provides a streamlined approach to managing Node.js versions, ensuring that development environments remain consistent across projects and teams by specifying versions in package.json. By adding an initialization code to your ~/.bashrc or ~/.zshrc, Volta will automatically load the proper versions of Node.js, etc. whenever you enter into a directory.

9. Multi-Language Version Control with mise

Flexible Dependency Management: mise (once known as rtx) offers a versatile solution for managing versions of various programming languages, presenting a compelling alternative to other version management tools (like the current market leader asdf) with its flexibility and Rust-based efficiency. The mise website dives into detail on why mise is better than asdf on their website.

10. Command-Line AI Integration via sgpt

Enhance Productivity with AI: SGPT merges command-line functionality with AI, enabling creative and practical applications such as generating eCommerce product descriptions quickly and efficiently, showcasing the tool’s potential to revolutionize content creation processes.

Recently, I leveraged it to take a CSV dump of WordPress WooCommerce products and add both short and long descriptions for each product. This reduced what would have been a mind-blowingly long process of writing hundreds of product descriptions into something that only took a few minutes. Here’s the code I used to do this:

#!/usr/bin/env bash

cat csv.csv | while read LINE; do
    sleep 2
    SKU="$(echo "$LINE" | sed 's/,.*//')"
    NAME="$(echo "$LINE" | sed 's/.*,//' | tr "[A-Z]" "[a-z]" | sed -e "s/\b\(.\)/\u\1/g")"
    CHATGPT_GPT_PRE="$(echo "$NAME" | sgpt "Write an eCommerce product description. Assume description is used in a Mediterranean grocery product catalog that specializes in delivering high quality products at unbeatable prices. After it is generated, randomize the text.")"
    CHATGPT_GPT="$(echo "$CHATGPT_GPT_PRE" | sgpt "Re-write this eCommerce product description to encourage bulk purchases. Shorten it a little and use synonyms wherever it might improve the quality of the writing.")"
    CHATGPT_SHORT_GPT="$(echo "$NAME" | sgpt "Write a 20 - 40 word eCommerce product description assuming the description is for a Mediterranean grocery product catalog. Generate 10 responses and randomly return one of them.")"
    CHATGPT="$(echo "$CHATGPT_GPT" | tr -s ' ' | sed -E ':a;N;$!ba;s/\r{0,1}\n/\\n/g')"
    CHATGPT_SHORT="$(echo "$CHATGPT_SHORT_GPT" | tr -s ' ' | sed -E ':a;N;$!ba;s/\r{0,1}\n/\\n/g')"
    echo "\"$SKU\",\"$NAME\",\"$CHATGPT\",\"$CHATGPT_SHORT\"" >> chatgpt.descriptions14.txt
done
echo "All done!"

Note: Just like the ChatGPT auto-commit generators, this package requires you to specify an OpenAI API key as an environment variable.

11. Secure Connections with cloudflared

Effortless and Secure Web Access: cloudflared facilitates the secure connection of web services to the internet without complex configurations. Integrated into the Install Doctor system, it offers a streamlined, automated setup process, leveraging CloudFlare’s impressive free services to enhance accessibility and security.

Install Doctor has implemented a headless implementation of cloudflared that completely automates the process of authenticating and integrating cloudflared into the stack. You can see the implementation by searching for cloudflared in the software.yml file. CloudFlare’s free service offering is wild - does anybody know how they offer all these amazing services for free and still turn a profit? Their stock has been going up last I checked.

While this list represents a selection of noteworthy command line utilities, it’s important to note that the command line ecosystem is vast and continually evolving. These tools, integrated into the Install Doctor provisioning system, exemplify the power and versatility of the command line interface in modern software development and system administration workflows. Whether you’re a seasoned developer or a newcomer to the command line, exploring these utilities can enhance your productivity and streamline your workflows on GitHub and beyond.

Install Doctor installs and configures all of these tools and more with a one-liner. Consider giving it a spin and joining our community of passionate technology enthusiasts.

Continue reading ->

Gas Station, the Ansible-Based Predecessor of Install Doctor

Embarking on a journey to create a code-driven solution for seamlessly provisioning complete workstations without the need for post-deployment tweaks, we initially turned to Ansible. However, our journey led us to a superior alternative.

Our Journey Begins with Ansible

Ansible, a widely recognized standard for automation tasks similar to ours, initially seemed like the perfect fit. Our approach of choosing the best software, with a preference for popular options, aligned well with choosing Ansible. Its sophisticated features, such as script idempotence checking and a robust testing framework named Molecule (which we enhanced to support a variety of operating systems including Archlinux, CentOS, Debian, Fedora, macOS, Ubuntu, and Windows, as seen in this example), made it our tool of choice for an extended period. Over time, our unique software stack expanded significantly within the Ansible ecosystem.

Encountering Ansible’s Limitations

Despite its strengths, we eventually encountered limitations with Ansible. The most significant was the realization that simpler shell scripts could accomplish our goals more efficiently, reducing the complexity and size of our codebase. Our original endeavor, dubbed Gas Station, grew unwieldy with its numerous roles and variables for customization, highlighting the need for a more streamlined approach.

Transitioning to Chezmoi

Our search for a better solution led us to Chezmoi, a tool adept at managing dotfiles with essential features like encryption, templating, and file change detection. The transition to Chezmoi was facilitated by an innovative installx script, simplifying cross-OS software installations. This approach, supported by a software.yml file, allowed for concise, effective management of software installations, significantly reducing the complexity of adding new software to our stack.

The Ease of Chezmoi

In comparison to Ansible, Chezmoi was not only easier to adopt but also enjoyed popularity on GitHub, aligning with our philosophy of choosing highly-regarded software. Its capability to efficiently manage dotfiles—crucial to our project—stood out as particularly valuable, offering a rich array of features for Bash and ZSH configurations.

Embracing Scripting with Chezmoi

Chezmoi’s flexibility further enabled us to incorporate Bash and PowerShell scripts into our workflow, enhancing our ability to manage installations across different operating systems. While we haven’t completely phased out Ansible—still finding it useful for certain applications, particularly in SSH deployments for larger server clusters—we’ve recognized the benefits of simplifying our approach for single devices or smaller groups, often opting for a straightforward Bash script execution method.

Future Plans with Ansible

Although we’re moving towards Chezmoi for most of our needs, we value the contributions we’ve made using Ansible and plan to share our roles on Ansible Galaxy. For those interested in exploring our Ansible-based solutions, they remain accessible in the roles/ directory of the Gas Station project.

Continue reading ->

About the Install Doctor Blog

Our articles are written by the Install Doctor team and community. If you would like to post on our blog, you can do so by opening up a pull request against our website's repository on GitHub. There, you can also browse through our site's source code which is a modified version of the Capacitor's open-source website project. If you would like to base your next website off of this modified version of the Capacitor website that removes the Prismic dependency (among a few other features), then please join our community and ask for help.