alex-d dotfiles

repository·main·Indexed 42 days ago

https://github.com/alex-d/dotfiles

A collection of dotfiles and setup guides for a Windows 10 development environment optimized for WSL 2, featuring configurations for zsh, GitBash, Docker, and IntelliJ IDEA, as well as installation guides for macOS.

Tokens
8.6K
Snippets
37
Records
37
Agent score
53%

What's inside alex-d dotfiles

  1. Setup Git with SSH keys

    main

    Generate an RSA SSH key for Git authentication and add it to the ssh-agent.

    #!/bin/bash
    
    email="contact@alex-d.fr"
    
    # Generate a new SSH key
    ssh-keygen -t rsa -b 4096 -C "${email}"
    
    # Start ssh-agent and add the key to it
    eval $(ssh-agent -s)
    ssh-add ~/.ssh/id_rsa
    
    # Display the public key ready to be copy pasted to GitHub
    cat ~/.ssh/id_rsa.pub
  2. Install Git autocompletion for zsh

    main

    Manually download and install Git completion scripts for zsh into the ~/.zsh directory.

    # Git autocompletion
    mkdir -p ~/.zsh
    cd ~/.zsh
    curl -o git-completion.bash https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash
    curl -o _git https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.zsh
  3. Setup Git Filter Repo

    main

    Clones git-filter-repo and installs it into the Git execution path along with its documentation.

    # Setup git-filter-repo
    git clone git@github.com:newren/git-filter-repo.git /tmp/git-filter-repo
    cd /tmp/git-filter-repo
    make snag_docs
    sudo cp -a git-filter-repo $(git --exec-path)
    sudo cp -a Documentation/man1/git-filter-repo.1 $(git --man-path)/man1
    sudo cp -a Documentation/html/git-filter-repo.html $(git --html-path)
    cd -
    rm -rf /tmp/git-filter-repo
  4. Install dependencies on macOS

    main

    Use Homebrew to install the required system dependencies: gnupg, tig, and tree.

    # Install brew
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    
    # Install dependencies
    brew install \
    	gnupg \
    	tig \
    	tree
  5. Configure MySQL backups via Cron

    main

    Schedule regular MySQL database backups.

    1. Create the backup config directory: mkdir -p ~/.config/backup.
    2. Copy the MySQL config template: cp ~/dev/dotfiles/server/config/mysql ~/.config/backup/mysql.
    3. Edit ~/.config/backup/mysql with your database user and password.
    4. Add a cron job to run mysql_backup.sh daily at 3:00 AM.
    #!/bin/zsh
    
    databaseName="<databaseName>"
    newCron="0 3 * * * $HOME/dev/dotfiles/server/mysql_backup.sh $databaseName"
    (crontab -l ; echo "$newCron") | crontab -
  6. Install kubectl

    main

    Installs kubectl on Debian/Ubuntu using the official Kubernetes package repository.

    # Install kubectl
    sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg
    echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
    sudo apt-get update
    sudo apt-get install -y kubectl
  7. Restore or create a GPG key

    main

    Restore an existing key

    1. On the old system, export the secret key: gpg --list-secret-keys gpg --export-secret-keys {{KEY_ID}} > /tmp/private.key
    2. On the new system, import it: gpg --import /tmp/private.key
    3. Important: Delete /tmp/private.key from both systems.

    Create a new key

    Run gpg --full-generate-key to start the generation process.

    # Export (Old System)
    gpg --export-secret-keys {{KEY_ID}} > /tmp/private.key
    
    # Import (New System)
    gpg --import /tmp/private.key
    
    # Create New
    gpg --full-generate-key
  8. Configure hostname and timezone

    main

    Update the system hostname and timezone settings.

    Hostname Configuration: Use hostnamectl to set the name and update /etc/hosts. If the hostname does not have a global internet DNS entry, use 127.0.1.1 instead of 127.0.0.1 in /etc/hosts.

    Timezone Configuration: Use timedatectl to set the system timezone.

    #!/bin/bash
    
    hostname="alexandredemode.fr"
    
    sudo hostnamectl set-hostname "${hostname}"
    echo "127.0.0.1 ${hostname}" | sudo tee -a /etc/hosts
    
    timedatectl set-timezone Europe/Paris
  9. Install common dependencies on Linux / WSL 2

    main

    After setting up WSL 2 and installing a distribution (such as Ubuntu from the Microsoft Store), use the following script to install essential development dependencies including git, zsh, make, and various system utilities.

    #!/bin/bash
    
    sudo apt update && sudo apt install -y \
        apt-transport-https \
        ca-certificates \
        curl \
        gnupg-agent \
        software-properties-common \
        git \
        make \
        tig \
        tree \
        zip unzip \
        zsh