Skip to content

Instantly share code, notes, and snippets.

@bitmvr
Last active November 14, 2023 15:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bitmvr/98088b7015769c40decd96b115f46b22 to your computer and use it in GitHub Desktop.
Save bitmvr/98088b7015769c40decd96b115f46b22 to your computer and use it in GitHub Desktop.
S4M - My default system configuration

S4M

S4M is a numeronym for SYSTEM. S4M is my default system configuration for *NIX based workstations.

Operating System Agnostic

Dot Files

.bash_profile

touch $HOME/.bash_profile

Paste the following into .bash_profile

# bash_profile
#   - Traditional *NIX systems only run this file during log in. macOS deviates from this norm and runs this for every new instance of a shell. To keep things consistent across platforms, the .bashrc file is sourced if it exists.

if [ -e $HOME/.bashrc ]; then
  source $HOME/.bashrc;
fi

.bashrc

touch $HOME/.bashrc

Paste in the following into .bashrc

# bashrc
#   - .bashrc is traditionally loaded for every new instance of a shell. This is not true for macOS which calls .bash_profile instead. This file is being sourced from .bash_profile for consistency. 

.aliases

touch $HOME/.aliases

Paste the following into .aliases

# aliases
#   - .aliases is the location to store all desired aliases for your system. .aliases is sourced from the .bashrc file.

alias ll="ls -FlahGs"
alias cls="clear"

Paste the following into .bashrc

if [ -e $HOME/.aliases ]; then
  source $HOME/.aliases;
fi

.functions

mkdir -p $HOME/.functions/

Connectivity

Install SSH Key

Copy key from existing machine or backup into $HOME/.ssh

Set Permissions

In order for a key to successfully work, we need to set the proper permissions for the $HOME/.ssh and its subsequent files.

chmod 700 $HOME/.ssh
chmod 600 $HOME/.ssh/*
chmod 644 $HOME/.ssh/*.pub

Bitmvr Binaries

Create Binary Directory

mkdir -p .bitmvr_bins

Installs

Secrets Management

mkdir -p $HOME/.secrets/store
touch $HOME/.secrets/secrets.sh

Paste the following into $HOME/.secrets/secrets.sh

#!/usr/bin/env bash
  
store="$HOME/.secrets/store"
mkdir -p "$store"

secrets=$(find "$store" -type f -name '*.secret')

for secret in $secrets; do
  source "$secret"
done

Add the following to your .bashrc

###################################################################
# Secrets
###################################################################

if [ -e $HOME/.secrets/secrets.sh ]; then
  source $HOME/.secrets/secrets.sh;
fi

macOS Specific

I believe in creating a seperate location for Operating System specific configurations. For macOS, I do this by creating the following:

Default Writes

Configure Shell

Set Shell to Close on Exit

Note: This command exits successfully but not sure it actually is taking affect. Need to review.

defaults write com.apple.Terminal shellExitAction -int 0

Configure Dock

I prefer to not have any persistant applications during a fresh configuration. I've also set me prefered size for the dock.

defaults delete-all com.apple.dock "persistent-apps" \
  && defaults write com.apple.dock tilesize -integer 42 \
  && killall Dock
mkdir -p $HOME/.os-specific/macos/
touch $HOME/.os-specific/macos/.macosrc

Once that it complete, add the following to your .bashrc

###################################################################
# MacOS Specific
###################################################################

source $HOME/.os-specific/macos/.macosrc

Homebrew

Homebrew Install

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Homebrew Brewfile Install

Create Homebrew File

mkdir -p $HOME/.os-specific/macos/Brewfiles
touch $HOME/.os-specific/macos/Brewfiles/personal.Brewfile

Add the following to the Brewfile

# Brewfile - Personal

### taps
tap 'teamookla/speedtest'

## Forumulas

### Development
brew 'bash-completion'
brew 'git'
brew 'graphicsmagick'
brew 'jq'
brew 'nmap'
brew 'p7zip'
brew 'qrencode'
brew 'shellcheck'
brew 'sqlite'
brew 'tesseract'
brew 'tmux'
brew 'yamllint'
brew 'watch'
brew 'speedtest'
brew 'gnupg'

### Media
brew 'ffmpeg'
brew 'flac'
brew 'lame'
brew 'yt-dlp'

## Casks

### Browsers
cask 'brave-browser'
cask 'firefox'

### Communications
cask 'element'

### Productivity
cask 'rectangle'
cask 'jiggler'

### Development
cask 'visual-studio-code'

### Media
cask 'vlc'
cask 'mpv'
cask 'spotify'
cask 'inkscape'

Install programs from Homebrew file

brew bundle --file="$HOME/.os-specific/macos/Brewfiles/personal.Brewfile"

Set Default Browser

Firefox

/Applications/Firefox.app/Contents/MacOS/firefox --setDefaultBrowser

Font Installation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment