Skip to content

Instantly share code, notes, and snippets.

View chuckntaylor's full-sized avatar

Charles Taylor chuckntaylor

View GitHub Profile
@chuckntaylor
chuckntaylor / MongoDB-Commands.md
Last active February 15, 2025 07:41
MongoDB Commands

Copying MongoDB Data

In these examples, we will assume we are copying data from a source database to a destination database.

1. Using mongodump and mongorestore

This is the simplest method.

  1. Dump the source database to a file.
mongodump --uri="your-mongodb-connection-uri" --db=source --out=backup/
@chuckntaylor
chuckntaylor / deleteDotUnderscoreFiles.md
Last active January 29, 2025 04:13
Delete ._ files

To delete dot underscore files, you can use the following command:

sudo find . -name "._*" -exec rm -rf {} \;

This will start in the current directory and recursively search for files that start with ._ and delete them.

@chuckntaylor
chuckntaylor / autosizeGrid.html
Last active September 4, 2024 15:28
Auto-sizing Grid Column
<!-- Using Unocss or Tailwind -->
<div class="grid grid-cols-[auto_1fr]">
<div>A column that will be limited to the size of the content</div>
<div>A column that will take up the remaining space</div>
</div>
@chuckntaylor
chuckntaylor / gitRenameLocalAndRemote.md
Last active July 19, 2024 13:48
Git: Rename local and remote branch

Renaming both a local and remote branch

First, rename the local branch by typing:

git branch -m <old_name> <new_name>

Then push the new branch to the remote repository:

@chuckntaylor
chuckntaylor / gitCommands.md
Last active April 10, 2024 13:39
Git branch commands

Common Git Branch Commands

A collection of git commands that I commonly use, but can never remember.

Pushing a new branch to a remote repository

git push -u origin branchName
@chuckntaylor
chuckntaylor / closingPort.md
Last active April 5, 2024 15:04
Closing a port

How to close a port on Mac

In Terminal, type the following command to find the process ID (PID) of the port. Replace PORT_NUMBER with the actual port number you want to close.

sudo lsof -i :PORT_NUMBER

Copy the PID number, then use the following command to kill the process using the PID you found.

@chuckntaylor
chuckntaylor / gpg_yubikey_switch.md
Last active November 16, 2021 02:39
Remove GPG Yubikey, and enable another one

[OPTIONAL] list the keygrip IDs using

gpg --list-secret-keys --with-keygrip

If ALL your private keys are on external cards like the Yubikey, you can delete them all using:

rm -r ~/.gnupg/private-keys-v1.d