Skip to content

NdagiStanley/dotfiles

Repository files navigation

dotfiles

OS OS OS

Summary

  1. Install GIT

  2. Clone this repo

  3. Scripts

    Use this repo's scripts to set up machine (In six modes: Basic, Core, and the following four under Advanced Setup: Python, JavaScript, Work, and Pro.

    For a recurrent server or workstation (that's not personal), there are two options: (The aliases are a time-saver)

    • (Easy and quick) Copy .aliases-basic to .aliases and run source .aliases for every new shell session

      curl https://raw.githubusercontent.com/NdagiStanley/dotfiles/main/.aliases-basic > .aliases
      source .aliases
    • Install zsh, install oh-my-zsh, copy .zshrc-basic to .zshrc and run source .zshrc

  4. Et al (Others)

Please note that:

  • The steps below are for macOS (Unix) and Linux (*nix). For Windows, follow the instructions in windows_os. Find more specific notes on macOS and Linux in mac_os and linux_os.

  • After installing GIT, there will be very little difference between Unix and Linux setup, for steps 2 and 3, especially since I'm using HomeBrew which works for both.

1. GIT

macOS

First, install Xcode Command Line Tools from the App Store:

xcode-select --install

, and agree to the license by opening Xcode.app or running:

sudo xcodebuild -license

HINT: Since this app is huge, you can transfer Xcode from a similar macOS machine via AirPlay to fast track this OR downloading Xcode from http://developer.apple.com/download/all/

Linux

Run:

sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"

then:

test -d ~/.linuxbrew && eval $(~/.linuxbrew/bin/brew shellenv)
test -d /home/linuxbrew/.linuxbrew && eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
test -r ~/.bash_profile && echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.bash_profile
echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.profile

and finally:

sudo apt-get install build-essential curl file git

2. Clone repository

git clone https://github.com/NdagiStanley/dotfiles.git && cd dotfiles

3. Scripts

Basic

Note: Using source script.sh (OR its alias ./script.sh [script needs to be made executable with command chmod +x < fileName >]) loads and executes a shell script into the current shell process.
Using sh script.sh you initiate a fork (sub-process or child) that runs a new session of /bin/sh (which is often a symbolic link to bash).

In these dotfiles, sh is only used with link.sh!

Install homebrew and add 'brew' to PATH.

You'll be prompted for your password

source install.sh homebrew

Note: You might get an error "error: RPC failed; curl ...". If you do, here are the options for fix this:

  • change the network to a faster one
  • Configure your network settings to use the IP addresses 8.8.8.8 and 8.8.4.4 as your DNS servers. This is Google's Public DNS.
  • There are other prescribed solutions here.

Install basic brew packages and oh-my-zsh.

source setup.sh basic

Press Enter when prompted to change your default shell.

...
Do you want to change your default shell to zsh? [Y/n]

To use the new shell, open a new terminal window/ tab and navigate to dotfiles to continue.

cd dotfiles

Core

You'll be prompted for your password Ensure you've run source setup.sh basic before you proceed

source setup.sh core
source setup.sh finish

Advanced setup (Optional)

Collapse this to see CLI scripts for my Python, JavaScript, Work, and Pro setups

Python

There's an option for running setup specific to python by running:

Ensure you've run source setup.sh basic before you proceed

source setup.sh python
source setup.sh finish

JavaScript

There's an option for running setup specific to JavaScript by running:

Ensure you've run source setup.sh basic before you proceed

source setup.sh javascript
source setup.sh finish

Work

Ensure you've run source setup.sh basic before you proceed

Work mode includes the Python and JavaScript modes. I use mainly these two programming languages. Take a look at my GitHub profile.

source setup.sh work

Pro

To have my setup (which has a bit more installs and configuration); install homebrew, oh-my-zsh, npm packages & pypi packages by running:

source install.sh --all

You'll be prompted for your password

then run:

source setup.sh pro

4. Et al

macOS settings

Find macOS settings and app settings in mac_os.

Code

Find code-specific dotfiles in code.

GIT

Collapse this to see GIT setup steps including SSH keys, commitizen, and GPG.

SSH keys

ssh-keygen -t ed25519 -C ".."
eval $(ssh-agent -s)
ssh-add ~/.ssh/id_ed25519
pbcopy < ~/.ssh/id_ed25519.pub

The last command is different in Linux and Windows (Reference)

The SSH Public Key is now in your clipboard. Navigate to this page, click on New SSH key, enter a title, paste the Public Key and click on Add SSH key. (Use the default selection - Authentication Key)

Configuration

To set the email (globally or locally respectively), run:

git config --global user.email <email>  # global
git config user.email <email>           # per repo

Commitizen

To use Conventional Commits, use commitizen CLI. For *nix (macOS (Unix) and Linux), use Homebrew to install commitizen. The default Brewfile has it.

Common commands below. Find more here.

cz c # OR cz commit               - commit
cz ch # OR cz changelog           - Changelog
cz changelog 0.0.1                # Changelog for specific version

GPG

Have gpg installed. For *nix (macOS (Unix) and Linux), use Homebrew. The default Brewfile has it.

gpg --version # version 2+
gpg --full-gen-key
gpg --list-secret-keys --keyid-format LONG <email>
gpg --armor --export <KEY>

Making commits

git commit -S -m "commit message"       # Signed commit
cz commit -s # OR cz commit --signoff   # Signed commit using commitizen

Automatic signed commits

git config --global user.signingkey <KEY> # global
git config user.signingkey <KEY>          # per repo

Maintenance

Once in a while I run:

  • sh sync.sh --complete

    to sync up the dotfiles and push to GitHub. This applies to you if you forked this repo

  • update

    to run a system-wide update (I do it almost weekly) πŸ™‚

  • cleanup

    to clean .Trashes, .DS_Store among others, plus docker system prune

About

Personal set-up for macOS, Windows and Linux machines. Gitbook linked below is a work-in-progress πŸ‘‡

Topics

Resources

Stars

Watchers

Forks