How To Prettify Using Vim and Prettier

Author: , Posted on Friday, March 7th, 2025 at 6:20:45am

If you’re a Vim user and want to integrate Prettier for automatic code formatting, follow these steps to set it up on your system.

Install Prettier Globally

Before installing the Vim plugin, you need to have Prettier installed globally via npm:

Install vim-prettier Plugin

To use Prettier inside Vim, install the vim-prettier plugin. Clone the repository into your Vim plugin directory:

Enable Plugin in Vim

Ensure that Vim loads the plugin by adding the following line to your ~/.vimrc file:

Format Code in Vim

You can now invoke Prettier inside Vim using the command:

This will format your current file based on Prettier’s default rules or your .prettierrc configuration.

Final Thoughts
With this setup, you can seamlessly format your code within Vim using Prettier, making your workflow more efficient and consistent. Happy coding!

How To Disable Bracketed Paste in BASH and ZSH

Author: , Posted on Wednesday, March 5th, 2025 at 6:30:55am

Bracketed paste is a feature in modern shells that helps prevent accidental execution of pasted commands by wrapping them in special escape sequences. However, some users find this behavior annoying, especially when pasting multi-line commands. Fortunately, it’s easy to disable bracketed paste in both BASH and ZSH.

Disabling Bracketed Paste in BASH

To turn off bracketed paste in BASH, modify your ~/.inputrc file by adding the following line:

You can apply this change immediately by running:

Otherwise, restart your terminal or open a new session for the changes to take effect.

Disabling Bracketed Paste in ZSH

For ZSH users, disable bracketed paste by adding the following line to your ~/.zshrc file:

After saving the file, reload your ZSH configuration with:

Bonus: Enhancing TAB Completion

If you’re customizing your shell, consider tweaking TAB completion behavior to improve your experience. Add these lines to ~/.inputrc for a more intuitive tab completion experience:

After modifying ~/.inputrc, apply the changes with:

### Explanation of TAB Completion Tweaks:

  • set bell-style none – Disables the terminal bell sound.
  • set completion-ignore-case on – Makes tab completion case-insensitive.
  • set show-all-if-ambiguous on – Displays all possible completions when multiple matches exist.
  • TAB: menu-complete – Enables menu-based tab completion.

With these tweaks, you can optimize your shell experience and eliminate unwanted behavior while improving command-line efficiency!

Extra Bonus: Dynamic Terminal Title

Sometimes my Terminal title gets stale, so I wanted a command to dynamically set it to the hostname and current working directory.

This will set your terminal title to display the short hostname and current working directory, making navigation easier when working across multiple terminals.

How To Fix MacOS Safari’s Connectivity Issues: Disabling Private Relay and Hide IP Address

Author: , Posted on Monday, March 3rd, 2025 at 9:52:06am

If you’ve ever encountered a scenario where Safari on macOS Sonoma cannot reach a local or internal web service (while Firefox and curl work just fine), the issue may be due to Apple’s strict security features. Specifically, iCloud Private Relay and the Hide IP Address from Trackers option can interfere with certain local network connections.

This blog post will walk you through how to disable these settings to restore proper connectivity.

Issue: Safari Cannot Access Internal or Local Services

In my case, Safari was unable to reach a local project listening on port 8000 on the same FQDN while Firefox and curl could access it without issue. If you’re facing a similar problem, read on!

Solution 1: Disable iCloud Private Relay

Private Relay is an iCloud+ feature that reroutes your internet traffic through Apple’s servers, potentially blocking access to local network services.

Here are the steps to disable Private Relay:

  • Go to System Settings → Click on your Apple ID (top-left corner).
  • Select iCloud.
  • Scroll down and locate Private Relay.
  • Toggle Private Relay Off.
  • Click Done and restart Safari.

Solution 2: Disable “Hide IP Address from Trackers”

Safari’s Hide IP Address from Trackers setting can also interfere with local connections by modifying how network requests are sent.

Here are the steps to disable Hide IP Address:

  • Open Safari → Settings.
  • Navigate to the Privacy tab.
  • Uncheck “Hide IP Address from Trackers”.

Conclusion

If you’re experiencing Safari connectivity issues on macOS Sonoma while other browsers work fine, disabling Private Relay and Hide IP Address might be the fix you need. These settings, designed to enhance privacy, can unintentionally block local services and internal network access. By making these adjustments, Safari should function as expected.

If you found this guide helpful, let me know in the comments!

How To Combine Directories From Multiple Hosts Into a Single Git Repository

Author: , Posted on Sunday, March 2nd, 2025 at 8:19:01am

If you have multiple ~/bin/ directories across different hosts and want to consolidate them into a single Git repository hosted on your own Git server, follow these steps.

1. Create a New Bare Git Repository on Your Git Server

First, log in to your Git server and create a new repository:

This repository will serve as the central location for all your ~/bin/ directories.

2. Initialize a Local Git Repository on the First Host

Choose one of the three hosts to start with:

This establishes the initial version of your ~/bin/ directory in the Git repository.

3. Merge ~/bin/ from the Second and Third Hosts

On the second host, execute:

You now have a new bin directory with everything from Host1, and a bin.old directory with the original files from Host2.

Compare the trees:

Copy/edit any needed files:

Commit and push to git repo:

If there are any conflicts, resolve them before committing.

Now, all hosts can push and pull updates to and from the central Git repository, ensuring that the ~/bin/ directory remains consistent across systems.

How To Restore the Full Desktop Bar in Mission Control on macOS

Author: , Posted on Wednesday, February 26th, 2025 at 7:59:58am

With macOS Sonoma, Apple changed the way Mission Control displays virtual desktops, reducing them to small slivers that require hovering to expand. If you prefer the previous behavior—where the full desktop bar opened automatically—there’s a simple solution using a third-party tool.

How to Restore the Full Desktop Bar in Mission Control

Follow these steps to bring back the full desktop bar when using Mission Control:

  1. Download and Install MissionControlFullDesktopBar.app
    The open-source MissionControlFullDesktopBar.app restores the expanded desktop bar in Mission Control.

  2. Grant Full Disk Access to Shortcuts
    For the app to work properly, ensure Shortcuts has the necessary permissions:

    • Open System Settings from the Apple menu.
    • Navigate to Privacy & Security.
    • Scroll down and select Full Disk Access.
    • Click the + (Add) button at the bottom of the list.
    • Navigate to Applications, select Shortcuts.app, and click Open.
    • Ensure that Shortcuts is toggled ON in the Full Disk Access list.
  3. Assign Fn + Up Arrow to Open the App
    To make launching Mission Control with the full desktop bar seamless, use the Shortcuts.app to assign a keyboard shortcut:

    • Open Shortcuts.app on your Mac.
    • Click the + (Create Shortcut) button to create a new shortcut.
    • In the right panel, search for Open App and drag it into the shortcut workflow.
    • Click App in the newly added action, then choose MissionControlFullDesktopBar.app from the list.
    • Click the Settings (i) button in the top-right corner of the shortcut window.
    • Click Add Keyboard Shortcut, then press Fn + Up Arrow.
    • Close the settings and Save the shortcut.

Once set up, pressing Fn + Up Arrow will launch Mission Control with the full desktop bar, bringing back the experience many users prefer.

With this simple tweak, you can enjoy Mission Control as it was meant to be—giving you quick and easy access to all your virtual desktops without the extra hover step.

How To Add and Associate a New AWS Elastic IP (EIP) Address Via the Command Line (CLI)

Author: , Posted on Tuesday, February 11th, 2025 at 7:56:54am

How To Add and Associate a New AWS Elastic IP (EIP) Address Via the Command Line (CLI):

How To Set an Entire AWS S3 Bucket to Public Read Using a Policy

Author: , Posted on Monday, February 10th, 2025 at 3:02:57pm

I needed to get all files in a bucket readable by the public easily.

Here is the S3 Bucket Policy I applied:

To do this via the aws cli command, create the file s3_read_policy.json containing the policy above, with your bucket name in place of BUCKET_NAME_HERE:

Fixing macOS Dock Focus Issue: Make App Windows Active on Click

Author: , Posted on Saturday, February 8th, 2025 at 7:28:01am

If you’re using macOS 14.7.3 and experiencing an annoying issue where clicking a running app’s icon in the Dock doesn’t immediately make it active for typing, you’re not alone. Instead of the expected behavior—where the app comes to the forefront, ready for interaction—you might find yourself having to click inside the app’s window before you can start working. This extra step is frustrating and unnecessary.

The Problem: App Selection Requires a Second Click

When you select a running app by clicking its Dock icon, the expected behavior is that the app window becomes active immediately. However, on macOS 14.7.3, some users have found that the focus remains on the previous application, requiring an additional click inside the newly selected app’s window before they can start typing. This can slow down workflow and make switching between applications feel sluggish.

The Fix: A Simple Terminal Command

Fortunately, there’s a quick and effective fix using the Terminal. Running the following command will ensure that clicking an app in the Dock makes its window active immediately:

Step-by-Step Guide to Apply the Fix

1. **Open Terminal:** You can find it in Applications > Utilities > Terminal, or simply search for “Terminal” using Spotlight (Cmd + Space).
2. **Enter the Command:** Copy and paste the following command into Terminal:

3. **Press Enter:** This will apply the changes and restart the Dock automatically.
4. **Test the Fix:** Click on a running app’s Dock icon and verify that its window becomes active immediately.

Why This Works

macOS includes a hidden setting called single-app mode, which, when enabled, modifies how the Dock handles app switching. Some users might inadvertently have this setting turned on, causing the behavior described above. Running the command above explicitly disables this setting, restoring normal functionality.

Additional Troubleshooting

If the issue persists after running the command, consider the following additional steps:
– Restart your Mac to ensure all changes take effect.
– Check **System Settings > Desktop & Dock** and make sure the following options are enabled:
– “When switching to an application, switch to a Space with open windows for the application.”
– “Group windows by application.”
– If the issue only occurs with specific apps, try quitting and reopening them or reinstalling them.

Conclusion

By running a simple Terminal command, you can restore the correct app-switching behavior on macOS 14.7.3 and eliminate the need for extra clicks when selecting apps from the Dock. This fix helps streamline workflow and ensures a smoother user experience.

Have you encountered this issue before? Let us know in the comments below if this fix worked for you or if you found alternative solutions!

Zsh Auto-Return on Paste

Author: , Posted on Friday, January 17th, 2025 at 9:20:32am

Have you ever found yourself frustrated when copying and pasting commands in the Apple terminal no longer behaves as expected? If you used to work with Bash on older macOS versions, you might recall that pasting a command into the terminal automatically executed it—no extra steps required. However, with the switch to Zsh as the default shell in newer macOS versions, this behavior has changed. Now, pasting doesn’t automatically press return, and that can feel like an unnecessary hurdle.

The reason for this change lies in how Zsh and terminal emulators handle pasted content. Specifically, it’s due to a feature called bracketed paste mode, which prevents commands from executing immediately upon being pasted. While this feature is useful for security and preventing accidental execution, it’s not always convenient. Fortunately, you can adjust Zsh to restore the old behavior and automatically press return after a paste.

If you’d like to go back to the simpler behavior of pasting and executing commands automatically, you can disable bracketed paste mode. This reverts Zsh to behave more like Bash in this regard.

Here’s how to disable Bracketed Paste Mode:

Open your .zshrc file in a text editor:

Add the following line to disable bracketed paste mode:

Save the file and reload your configuration to apply the change:

With this change, Zsh will no longer block the automatic execution of pasted commands.

By following these steps, you can bring back the seamless pasting experience you enjoyed with Bash. Whether you’re writing scripts, testing commands, or just trying to save time, this small adjustment can make a big difference in your workflow. Happy coding!

R.I.P. Jimmy Carter

Author: , Posted on Monday, December 30th, 2024 at 4:05:47am

James Earl Carter Jr. (October 1, 1924 – December 29, 2024) served as the 39th president of the United States