Skip to content

Commit fef3ae8

Browse files
committed
Init commit
0 parents  commit fef3ae8

File tree

155 files changed

+9510
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

155 files changed

+9510
-0
lines changed

.editorconfig

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
indent_style = space
8+
indent_size = 2
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.idea
2+
vendor

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2025 Morten Rugaard
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# Dotfiles
2+
3+
The purpose of this repository is to automate as much as possible, when setting up and maintaining a Mac machine. It takes the effort out installing and configuring everything manually.
4+
5+
You are more than welcome to fork the entire repository or cherry-pick anything you feel like.
6+
7+
## 📖 Table of contents
8+
9+
- [Installation](#-installation)
10+
- [Setup](#️-setup)
11+
- [Acknowledgements](#-acknowledgements)
12+
- [License](#-license)
13+
14+
## 📦 Installation
15+
16+
To install the dotfiles, run the following command:
17+
18+
> [!CAUTION]
19+
> Before running [the script][setup script], be absolutely sure, you know what it does.
20+
> If you're not, then **DO NOT** run the script. Seriously, **DON'T**.
21+
22+
```shell
23+
bash -c "$(curl -LsS https://raw.github.com/rugaard/dotfiles/main/setup.sh)"
24+
25+
# Skip all questions by saying "yes" everything
26+
bash -c "$(curl -LsS https://raw.github.com/rugaard/dotfiles/main/setup.sh -y)"
27+
```
28+
29+
That's it! ✨
30+
31+
## ⚙️ Setup
32+
33+
During installation the setup script will perform the following steps:
34+
35+
- Download the dotfiles
36+
_(by default it will suggest `~/.dotfiles`)_
37+
- Install [Homebrew][install homebrew]
38+
- Install [Xcode command-line tools][install xcode cli tools] and [agree to license][xcode license agreement]
39+
- Install [Xcode][install xcode]
40+
- Install [applications][install applications]
41+
- Install [command-line tools][install tools]
42+
- Install [cron jobs][install cron]
43+
- Install [Quick Look][install quicklooks] addons
44+
- Install developer environments, [personal][install developer] and [work][install work] _(apps, cli tools, local server and services)_
45+
- Install and configure [ZSH][install zsh] shell with [Prezto](https://github.com/sorin-ionescu/prezto)
46+
- Configure [`git` profile][install git]
47+
- Set custom [icons][install icons] (system and applications)
48+
- Set custom preferences for [system][preferences system] and [applications][preferences applications]
49+
- Install and configure [local settings][local script] _(ID keys, licenses and configs)_
50+
- [Initialize][git init] and [update content][git update script] from git repository
51+
- Set [computer name](computer-name)
52+
- [Restart machine][setup script restart]
53+
54+
## 🏆 Acknowledgements
55+
56+
- [Cătălin Mariș’ dotfiles](https://github.com/alrra/dotfiles) is the base of my entire set of dotfiles. A huge **thank you** goes out to his hard work 🙏🏻
57+
- [Mathias Bynens](https://github.com/mathiasbynens/dotfiles) for his legendary collection of macOS default configuration settings.
58+
- [Zach Holman](https://github.com/holman/dotfiles) and [Mislav Marohnić](https://github.com/mislav/dotfiles) for their collection of `bin` scripts.
59+
60+
## 📝 License
61+
62+
This project is available under the [MIT license][license].
63+
64+
<!-- Link labels: -->
65+
[computer-name]: macos/set_computer_name
66+
[install applications]: macos/install/applications
67+
[install cron]: macos/install/cron
68+
[install git]: macos/git_profile
69+
[install developer]: macos/install/developer
70+
[install homebrew]: macos/install/homebrew
71+
[install icons]: macos/install/icons
72+
[install quicklooks]: macos/install/quicklooks
73+
[install tools]: macos/install/tools
74+
[install work]: macos/install/work
75+
[install xcode cli tools]: https://github.com/rugaard/dotfiles/blob/main/macos/install/xcode.sh#L53-L67
76+
[xcode license agreement]: https://github.com/rugaard/dotfiles/blob/main/macos/install/xcode.sh#L15-L30
77+
[install xcode]: https://github.com/rugaard/dotfiles/blob/main/macos/install/xcode.sh#L102-L111
78+
[install zsh]: macos/install/zsh
79+
[preferences applications]: macos/preferences/applications
80+
[preferences system]: macos/preferences/system
81+
[setup script]: https://github.com/alrra/dotfiles/blob/main/src/os/setup.sh
82+
[setup script restart]: https://github.com/rugaard/dotfiles/blob/main/setup.sh#L306-L315
83+
[local script]: local
84+
[git init]: https://github.com/rugaard/dotfiles/blob/main/setup.sh#L266-L273
85+
[git update script]: update
86+
[license]: LICENSE

bin/$

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env sh
2+
3+
# Ever pasted "$ somecommand" into the terminal and gotten this error?
4+
# -bash: $: command not found
5+
6+
# Begone, silly errors! Lazy copy + paste forever!! ETCETERA!!!!
7+
8+
$@

bin/clean-whiteboard-photos

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/bin/bash
2+
3+
# DESCRIPTION:
4+
#
5+
# Cleans up and beautifies photos of whiteboards.
6+
#
7+
# SOURCE:
8+
#
9+
# https://gist.github.com/lelandbatey/8677901
10+
#
11+
# USAGE:
12+
#
13+
# clean-whiteboard-photos FILE ...
14+
15+
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
16+
17+
clean_whiteboard_photos() {
18+
find . -type f \
19+
-name "$1" \
20+
-exec printf "%s\n" {} \; \
21+
-exec convert {} \
22+
-morphology Convolve DoG:15,100,0 \
23+
-negate \
24+
-normalize \
25+
-blur 0x1 \
26+
-channel RBG \
27+
-level 60%,91%,0.1 \
28+
{} \;
29+
}
30+
31+
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
32+
33+
main() {
34+
35+
# Check if ImageMagick's convert command-line tool is installed.
36+
37+
if ! command -v "convert" $> /dev/null; then
38+
printf "Please install ImageMagick's 'convert' command-line tool!"
39+
exit;
40+
fi
41+
42+
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
43+
44+
while [ $# -ne 0 ]; do
45+
clean_whiteboard_photos "$1"
46+
shift
47+
done
48+
49+
}
50+
51+
main "$@"

bin/fix-valet

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env sh
2+
3+
# Due to Aller machines using FortiClient as VPN clients,
4+
# the firewall rules of the machine are being changed in a way
5+
# that when we're using Valet, it ends up in some kind of loop.
6+
#
7+
# This script should fix the issue, by resetting the firewall rules.
8+
9+
# Reset the rules based off the on-disk version.
10+
sudo pfctl -N -f /etc/pf.conf
11+
12+
# Clear the DNS cache on system.
13+
sudo dscacheutil -flushcache
14+
sudo killall -HUP mDNSResponder

bin/git-copy-branch-name

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/sh
2+
#
3+
# Copy the current branch name to the clipboard.
4+
5+
branch=$(git rev-parse --abbrev-ref HEAD)
6+
echo $branch
7+
echo $branch | tr -d '\n' | tr -d ' ' | pbcopy

bin/git-housekeeping

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/usr/bin/env bash
2+
3+
# Removes old Git branches and does other cleanup
4+
#
5+
# Usage:
6+
# git-housekeeping [--force]
7+
#
8+
# See explanation here: http://erikaybar.name/git-deleting-old-local-branches/
9+
#
10+
# Author: Artem Sapegin, sapegin.me
11+
# License: MIT
12+
# https://github.com/sapegin/dotfiles
13+
14+
# Exit on any failed command
15+
set -e
16+
17+
CYAN="$(tput setaf 6)"
18+
UNDERLINE="$(tput sgr 0 1)"
19+
NOCOLOR="$(tput sgr0)"
20+
21+
function header() { echo -e "\n$UNDERLINE$CYAN$1$NOCOLOR\n"; }
22+
23+
function branches() {
24+
git branch -vv | grep 'origin/.*: gone]' | awk '{print $1}'
25+
}
26+
27+
if [[ "$1" != "--force" ]]; then
28+
branches
29+
exit 1
30+
fi
31+
32+
# Delete all unreachable objects from the object database
33+
header "Deleting unreachable objects..."
34+
git prune
35+
36+
# Delete all stale remote-tracking branches, these branches have already been
37+
# removed from the remote repository, but are still locally available in "remotes/".
38+
header "Deleting stale remote-tracking branches..."
39+
git remote prune origin
40+
echo "Done."
41+
42+
# Delete branches for which remote branches were removed
43+
header "Deleting branches with no longer existing remote branches..."
44+
branches | xargs git branch -D

bin/git-incoming

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/bin/sh
2+
#
3+
# Ryan Tomayko <r@tomayko.com>
4+
#
5+
# Usage: git-incoming [-d] [<upstream>] [<head> [<limit>]]
6+
#
7+
# Show commits on <upstream> that do not exist on current branch.
8+
9+
# bail out with message to stderr and exit status 1
10+
die() {
11+
echo "$(basename $0):" "$@" 1>&2
12+
exit 1
13+
}
14+
15+
# colors
16+
SHA=$(git config --get-color 'color.branch.local')
17+
ADD=$(git config --get-color 'color.diff.new')
18+
REM=$(git config --get-color 'color.diff.old')
19+
RESET=$(git config --get-color '' 'reset')
20+
21+
# check for -d / --diff argument
22+
diff=false
23+
if [ "$1" = '-d' -o "$1" = '--diff' ]
24+
then diff=true
25+
shift
26+
fi
27+
28+
# use tracking branch if no upstream given
29+
if [ $# -eq 0 ]
30+
then
31+
# get the current branch in refs/heads/<branch> form
32+
ref=$(git symbolic-ref -q HEAD)
33+
test -n "$ref" ||
34+
die "you're not on a branch"
35+
36+
# just the branch name please
37+
branch=$(echo "$ref" | sed 's@^refs/heads/@@')
38+
test -n "$branch" ||
39+
die "you're in a weird place; get on a local branch"
40+
41+
# grab remote name for current branch
42+
remote=$(git config --get "branch.$branch.remote" || true)
43+
44+
# grab tracked branch name for current branch
45+
merge=$(git config branch.$branch.merge) ||
46+
die "branch $branch isn't tracking a remote branch and no <upstream> given"
47+
48+
# make it so
49+
set -- "$remote/$(echo "$merge" |sed 's@^refs/heads/@@')"
50+
fi
51+
52+
if $diff
53+
then git diff HEAD..."$1"
54+
else
55+
git cherry -v HEAD "$@" |
56+
cut -c1-9 -c43- |
57+
sed -e "s/^\(.\) \(.......\)/\1 $SHA\2$RESET/" |
58+
sed -e "s/^-/$REM-$RESET/" -e "s/^+/$ADD+$RESET/"
59+
fi

bin/git-nuke

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/sh
2+
#
3+
# Nukes a branch locally and on the origin remote.
4+
#
5+
# $1 - Branch name.
6+
#
7+
# Examples
8+
#
9+
# git nuke add-git-nuke
10+
11+
git branch -D $1
12+
git push origin :$1

0 commit comments

Comments
 (0)