Skip to content

Instantly share code, notes, and snippets.

View ammarshah's full-sized avatar

Ammar Shah ammarshah

View GitHub Profile
@ammarshah
ammarshah / all_email_provider_domains.txt
Last active November 16, 2025 19:58
A list of all email provider domains (free, paid, blacklist etc). Some of these are probably not around anymore. I've combined a dozen lists from around the web. Current "major providers" should all be in here as of the date this is created.
0-mail.com
007addict.com
020.co.uk
027168.com
0815.ru
0815.su
0clickemail.com
0sg.net
0wnd.net
0wnd.org
@ammarshah
ammarshah / git_rebase_with_filter_repo.md
Created October 16, 2023 15:21
Remove commit(s) from git repository using rebase while keeping the original commit dates

Example Usage of git-rebase with git-filter-branch and git-filter-repo

You can rewrite commits using either git-filter-branch or git-filter-repo but the latter one is recommended. See why.

1. Check Logs

There are two types of dates in a git commit: AuthorDate and CommitDate.

When you run git log, the date you see with every commit is the AuthorDate while GitHub repository shows the CommitDate.

@ammarshah
ammarshah / manage_multiple_ruby_versions_with_rbenv_in_ubuntu24_04.md
Last active September 16, 2025 08:47
Setup rbenv on Ubuntu 24.04 and use .ruby-version file to install the version your project requires

How to setup rbenv on Ubuntu 24.04

This guide will not install a specific Ruby version you want, although, it will setup rbenv so you can manage multiple Ruby versions.

It assumes that the project that requires a specific Ruby version has a file .ruby-version in the root of the project. So, simply running rbenv install from project root directory will use the version specified in that file and install it.

But if you still want to install a specific version of Ruby without using .ruby-version file, you can do so using:

$ rbenv install 3.4.1
@ammarshah
ammarshah / install_postgresql_17_on_ubuntu.md
Last active November 16, 2025 12:46
Install PostgreSQL 17 on Ubuntu 24.04

Install PostgreSQL 17 on Ubuntu 24.04

1. Import the repository signing key:

$ sudo apt install curl ca-certificates
$ sudo install -d /usr/share/postgresql-common/pgdg
$ sudo curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc

2. Create the repository configuration file:

@ammarshah
ammarshah / install_postgresql_18_on_fedora.md
Last active November 4, 2025 06:18
Install PostgreSQL 18 on Fedora 43

Install PostgreSQL 18 on Fedora 43

1. Installation

You can follow the PostgreSQL installation steps from its official website and you'll be good to go but I prefer to keep only the latest version's repo i.e. pgdg18, since the first command would add pgdg repos for version 13 through 18.

# Add the pgdg repo
sudo dnf install https://download.postgresql.org/pub/repos/yum/reporpms/F-43-x86_64/pgdg-fedora-repo-latest.noarch.rpm

# Disable all pgdg repos except pgdg18
@ammarshah
ammarshah / transfer_data_between_fedora43_and_windows10.md
Last active November 4, 2025 06:36
Transfer Data between Two Laptops (Fedora 43 and Windows 10) using a LAN Cable and FileZilla

Transfer Data between Two Laptops (Fedora 43 and Windows 10) using a LAN Cable and FileZilla

Transferring files between a Fedora 43 machine and a Windows 10 machine over a LAN using FileZilla involves a few key steps. The general process is to set up one machine as an FTP server (Fedora) and the other as an FTP client (Windows). Here's how you can do that:

1. Connect Both Computers via LAN Cable

  • Plug one end of the LAN cable into the Ethernet port of the first laptop.
  • Plug the other end of the LAN cable into the Ethernet port of the second laptop.

2. Configure Network Settings

@ammarshah
ammarshah / manage_multiple_ruby_versions_with_rbenv_in_fedora43.md
Last active November 4, 2025 06:38
Setup rbenv on Fedora 43 and use .ruby-version file to install the version your project requires

How to setup rbenv on Fedora 43

This guide will not install a specific Ruby version you want, although, it will setup rbenv so you can manage multiple Ruby versions.

It assumes that the project that requires a specific Ruby version has a file .ruby-version in the root of the project. So, simply running rbenv install from project root directory will use the version specified in that file and install it.

But if you still want to install a specific version of Ruby without using .ruby-version file, you can do so using:

$ rbenv install 3.4.6
@ammarshah
ammarshah / how_to_create_dummy_files_in_linux.md
Created October 6, 2025 04:26
How to Create Dummy/Test Files in Linux

How to Create Dummy/Test Files in Linux

TL;DR

  • fallocate: Allocates actual disk space (reserves it upfront)
  • truncate: Changes file size without allocating space (creates sparse files)

What are "Sparse Files"?

Sparse files have "holes" - regions that claim to exist but have no actual data. When read, the OS returns zeros for holes without storing them on disk. This saves space but may cause issues if the disk fills up later when you try to write real data.

@ammarshah
ammarshah / force_garbage_collection_of_dangling_objects_in_git.md
Created October 6, 2025 06:48
Git: Force Garbage Collection of Dangling Objects

Git: Force Garbage Collection of Dangling Objects

What Are Dangling Objects?

Dangling objects are commits, blobs, or trees that are no longer referenced by any branch, tag, or the reflog. They exist in Git's object database but aren't part of any reachable history.

commit A -- commit B -- commit C (HEAD)
            \
 commit B' (dangling after amending B)
@ammarshah
ammarshah / an_encrypted_ssh_and_gpg_keys_backup_and_restore_guide.md
Last active October 9, 2025 02:33
Encrypted SSH and GPG Keys Backup & Restore

Encrypted SSH and GPG Keys Backup & Restore

A pair of bash scripts to securely backup and restore your SSH keys, GPG keys, and Git configuration with symmetric encryption.

Backup Script (backup-keys.sh)

This script creates an encrypted backup of the following:

  • All SSH keypairs in ~/.ssh/ starting with id_ (e.g., id_rsa, id_ed25519)
  • All GPG keys (private keys, public keys, and trust database)