mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-02-23 14:56:39 +00:00
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3acc948c23 | |||
| 0f94386231 | |||
| 5e06a735cc | |||
|
|
9471a63475 | ||
|
|
01328498b6 | ||
|
|
bab6f7daab | ||
| 4baabbdd5d | |||
| d5757d231f | |||
| 6190be3bdd | |||
| 0db64845bc | |||
|
|
8a8699bf0c | ||
|
|
8814c777f5 | ||
| bf4b0c50f4 |
@@ -14,7 +14,6 @@ trim_trailing_whitespace = true
|
|||||||
indent_size = 2
|
indent_size = 2
|
||||||
|
|
||||||
[*.sh]
|
[*.sh]
|
||||||
indent_style = space
|
|
||||||
indent_size = 2
|
indent_size = 2
|
||||||
tab_width = 2
|
tab_width = 2
|
||||||
|
|
||||||
@@ -23,5 +22,8 @@ binary_next_line = true # like -bn
|
|||||||
switch_case_indent = true # like -ci
|
switch_case_indent = true # like -ci
|
||||||
space_redirects = true # like -sr
|
space_redirects = true # like -sr
|
||||||
keep_padding = false # like -kp
|
keep_padding = false # like -kp
|
||||||
function_next_line = false # like -fn
|
function_next_line = true # like -fn
|
||||||
never_split = true # like -ns
|
never_split = true # like -ns
|
||||||
|
|
||||||
|
[local/bin/antigen.zsh]
|
||||||
|
ignore = true
|
||||||
|
|||||||
5
.gitattributes
vendored
5
.gitattributes
vendored
@@ -205,7 +205,12 @@ Procfile text
|
|||||||
|
|
||||||
# Ignore files (like .npmignore or .gitignore)
|
# Ignore files (like .npmignore or .gitignore)
|
||||||
*.*ignore text
|
*.*ignore text
|
||||||
|
|
||||||
|
*.gitignore text
|
||||||
*.gitkeep text
|
*.gitkeep text
|
||||||
|
.gitattributes export-ignore
|
||||||
|
**/.gitignore export-ignore
|
||||||
|
**/.gitkeep export-ignore
|
||||||
|
|
||||||
# Repo specials
|
# Repo specials
|
||||||
local/bin/* text eol=lf
|
local/bin/* text eol=lf
|
||||||
|
|||||||
43
.github/workflows/linters.yml
vendored
Normal file
43
.github/workflows/linters.yml
vendored
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
name: reviewdog
|
||||||
|
on: [ push ]
|
||||||
|
jobs:
|
||||||
|
linters:
|
||||||
|
name: Linters
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: GitHub Actions
|
||||||
|
uses: reviewdog/action-actionlint@v1
|
||||||
|
with:
|
||||||
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
reporter: github-pr-review
|
||||||
|
|
||||||
|
- name: detect-secrets
|
||||||
|
uses: reviewdog/action-detect-secrets@master
|
||||||
|
with:
|
||||||
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
reporter: github-pr-review
|
||||||
|
|
||||||
|
- name: markdownlint
|
||||||
|
uses: reviewdog/action-markdownlint@v0
|
||||||
|
with:
|
||||||
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
reporter: github-pr-review
|
||||||
|
|
||||||
|
- name: shfmt
|
||||||
|
uses: reviewdog/action-shfmt@v1
|
||||||
|
with:
|
||||||
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
shfmt_flags: |
|
||||||
|
--find
|
||||||
|
--list
|
||||||
|
--write
|
||||||
|
--diff
|
||||||
|
--simplify
|
||||||
|
--language-dialect bash
|
||||||
|
--indent 2
|
||||||
|
--binary-next-line
|
||||||
|
--case-indent
|
||||||
|
--space-redirects
|
||||||
|
--func-next-line
|
||||||
14
Brewfile
14
Brewfile
@@ -11,6 +11,7 @@ tap "homebrew/core"
|
|||||||
tap "homebrew/services"
|
tap "homebrew/services"
|
||||||
tap "shivammathur/extensions"
|
tap "shivammathur/extensions"
|
||||||
tap "shivammathur/php"
|
tap "shivammathur/php"
|
||||||
|
tap "teamookla/speedtest"
|
||||||
# Interpreted, interactive, object-oriented programming language
|
# Interpreted, interactive, object-oriented programming language
|
||||||
brew "python@3.10"
|
brew "python@3.10"
|
||||||
# Automate deployment, configuration, and upgrading
|
# Automate deployment, configuration, and upgrading
|
||||||
@@ -173,8 +174,12 @@ brew "shivammathur/php/php"
|
|||||||
brew "shivammathur/php/php@7.4"
|
brew "shivammathur/php/php@7.4"
|
||||||
# General-purpose scripting language
|
# General-purpose scripting language
|
||||||
brew "shivammathur/php/php@8.0"
|
brew "shivammathur/php/php@8.0"
|
||||||
|
# Ookla Speedtest
|
||||||
|
brew "teamookla/speedtest/speedtest"
|
||||||
# Command-line helper for the 1Password password manager
|
# Command-line helper for the 1Password password manager
|
||||||
cask "1password-cli"
|
cask "1password-cli"
|
||||||
|
# Text editor
|
||||||
|
cask "coda"
|
||||||
# App to build and share containerized applications and microservices
|
# App to build and share containerized applications and microservices
|
||||||
cask "docker"
|
cask "docker"
|
||||||
# Reimagine your terminal
|
# Reimagine your terminal
|
||||||
@@ -189,6 +194,8 @@ cask "fork"
|
|||||||
cask "google-cloud-sdk"
|
cask "google-cloud-sdk"
|
||||||
# HTTP and GraphQL Client
|
# HTTP and GraphQL Client
|
||||||
cask "insomnia"
|
cask "insomnia"
|
||||||
|
# JetBrains tools manager
|
||||||
|
cask "jetbrains-toolbox"
|
||||||
# Kubernetes IDE
|
# Kubernetes IDE
|
||||||
cask "lens"
|
cask "lens"
|
||||||
# Reverse proxy, secure introspectable tunnels to localhost
|
# Reverse proxy, secure introspectable tunnels to localhost
|
||||||
@@ -203,10 +210,16 @@ cask "qlstephen"
|
|||||||
cask "quicklook-json"
|
cask "quicklook-json"
|
||||||
# QuickLook generator for Adobe Swatch Exchange files
|
# QuickLook generator for Adobe Swatch Exchange files
|
||||||
cask "quicklookase"
|
cask "quicklookase"
|
||||||
|
# Move and resize windows using keyboard shortcuts or snap areas
|
||||||
|
cask "rectangle"
|
||||||
# MySQL/MariaDB database management
|
# MySQL/MariaDB database management
|
||||||
cask "sequel-ace"
|
cask "sequel-ace"
|
||||||
# Collection of apps available by subscription
|
# Collection of apps available by subscription
|
||||||
cask "setapp"
|
cask "setapp"
|
||||||
|
# Team communication and collaboration software
|
||||||
|
cask "slack"
|
||||||
|
# Sound and audio controller
|
||||||
|
cask "soundsource"
|
||||||
# Application for inspecting installer packages
|
# Application for inspecting installer packages
|
||||||
cask "suspicious-package"
|
cask "suspicious-package"
|
||||||
# Quicklook extension for source files
|
# Quicklook extension for source files
|
||||||
@@ -218,6 +231,7 @@ cask "vlc"
|
|||||||
# Rust-based terminal
|
# Rust-based terminal
|
||||||
cask "warp"
|
cask "warp"
|
||||||
mas "1Password for Safari", id: 1569813296
|
mas "1Password for Safari", id: 1569813296
|
||||||
|
mas "Flow", id: 1423210932
|
||||||
mas "GarageBand", id: 682658836
|
mas "GarageBand", id: 682658836
|
||||||
mas "iMovie", id: 408981434
|
mas "iMovie", id: 408981434
|
||||||
mas "Keynote", id: 409183694
|
mas "Keynote", id: 409183694
|
||||||
|
|||||||
75
config/alias
75
config/alias
@@ -1,32 +1,69 @@
|
|||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
# macOS specific
|
# macOS specific
|
||||||
|
|
||||||
|
# Get installed php versions from brew and setup aliases
|
||||||
|
function x-set-php-aliases
|
||||||
|
{
|
||||||
|
local php_versions=()
|
||||||
|
while IFS="" read -r line; do php_versions+=("$line"); done < <(brew list | grep '^php')
|
||||||
|
|
||||||
|
php_error_reporting='-d error_reporting=22527'
|
||||||
|
|
||||||
|
for version in "${php_versions[@]}"; do
|
||||||
|
# drop the dot from version (8.0 -> 80)
|
||||||
|
local php_abbr="${version//\./}"
|
||||||
|
# replace "php@" with "p" so "php@80" becomes "p80"
|
||||||
|
local php_alias="${php_abbr//php@/p}"
|
||||||
|
|
||||||
|
# Skip php = php aliasing
|
||||||
|
# if [[ "$php_abbr" == "$php_alias" ]]; then continue; fi;
|
||||||
|
|
||||||
|
# Fetch the exec path once
|
||||||
|
php_exec="$(brew --prefix "$version")/bin/php"
|
||||||
|
|
||||||
|
# Raw PHP without error_reporting flag.
|
||||||
|
# shellcheck disable=SC2139
|
||||||
|
alias ${php_alias}r="$php_exec"
|
||||||
|
# PHP with error_reporting flag.
|
||||||
|
# shellcheck disable=SC2139
|
||||||
|
alias $php_alias="$php_exec $php_error_reporting"
|
||||||
|
# Local PHP Server.
|
||||||
|
# shellcheck disable=SC2139
|
||||||
|
alias ${php_alias}s="$php_exec -S localhost:9000"
|
||||||
|
# Use composer with specific PHP and error_reporting flag on.
|
||||||
|
# shellcheck disable=SC2139
|
||||||
|
alias ${php_alias}c="$php_exec $php_error_reporting $(which composer)"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
if [[ $(uname) == 'Darwin' ]]; then
|
if [[ $(uname) == 'Darwin' ]]; then
|
||||||
alias file_hide="chflags hidden"
|
|
||||||
alias file_show="chflags nohidden"
|
|
||||||
alias brewUp='brew update && brew outdated && brew upgrade && brew cleanup'
|
|
||||||
|
|
||||||
alias php74='$(brew --prefix php@7.4)/bin/php'
|
x-set-php-aliases
|
||||||
alias php80='$(brew --prefix php@8.0)/bin/php -d error_reporting=22527'
|
|
||||||
alias phpc='$(brew --prefix php)/bin/php -d error_reporting=22527'
|
|
||||||
alias php80raw='$(brew --prefix php@8.0)/bin/php'
|
|
||||||
|
|
||||||
alias php-server='php -S localhost:9000'
|
|
||||||
|
|
||||||
alias p74c='$(brew --prefix php@7.4)/bin/php -d error_reporting=22527 $(which composer)'
|
|
||||||
alias p80c='$(brew --prefix php@8.0)/bin/php -d error_reporting=22527 $(which composer)'
|
|
||||||
alias p8c='$(brew --prefix php)/bin/php -d error_reporting=22527 $(which composer)'
|
|
||||||
alias p7a='$(brew --prefix php@7.4)/bin/php artisan'
|
|
||||||
alias p8a='$(brew --prefix php)/bin/php artisan'
|
|
||||||
|
|
||||||
alias sail='[ -f sail ] && bash sail || bash vendor/bin/sail'
|
alias sail='[ -f sail ] && bash sail || bash vendor/bin/sail'
|
||||||
|
|
||||||
|
# Flush Directory Service cache
|
||||||
|
alias flushdns="sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder"
|
||||||
|
|
||||||
|
# Lock the screen
|
||||||
|
alias afk="osascript -e 'tell application \"System Events\" to keystroke \"q\" using {command down,control down}'"
|
||||||
|
|
||||||
|
# Empty the Trash on all mounted volumes and the main HDD
|
||||||
|
# Also, clear Apple’s System Logs to improve shell startup speed
|
||||||
|
alias emptytrash="sudo rm -rfv /Volumes/*/.Trashes; sudo rm -rfv ~/.Trash; sudo rm -rfv /private/var/log/asl/*.asl"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
alias watchx='watch -dpbc'
|
alias watchx='watch -dpbc' # watch with: differences, precise, beep and color
|
||||||
alias zapds='find . -name ".DS_Store" -print -delete'
|
alias zapds='find . -name ".DS_Store" -print -delete'
|
||||||
alias t='tail -f'
|
alias t='tail -f' # tail with follow flag on
|
||||||
alias dn='du -chd1'
|
alias dn='du -chd1' # directory usage, return only the total
|
||||||
|
|
||||||
alias codescanner='docker run --env SOURCE_CODE="$PWD" --volume "$PWD":/code --volume /var/run/docker.sock:/var/run/docker.sock registry.gitlab.com/gitlab-org/ci-cd/codequality:${VERSION:-latest} /code'
|
alias code_scanner='docker run \
|
||||||
|
--env SOURCE_CODE="$PWD" \
|
||||||
|
--volume "$PWD":/code \
|
||||||
|
--volume /var/run/docker.sock:/var/run/docker.sock \
|
||||||
|
registry.gitlab.com/gitlab-org/ci-cd/codequality:${CODEQUALITY_VERSION:-latest} \
|
||||||
|
/code'
|
||||||
|
|
||||||
alias composerUp='composer global update'
|
alias composerUp='composer global update'
|
||||||
alias npmUp='npm -g up'
|
alias npmUp='npm -g up'
|
||||||
|
|||||||
23
config/exports
Normal file
23
config/exports
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
# shellcheck shell=bash
|
||||||
|
|
||||||
|
export HIST_STAMPS="yyyy-mm-dd"
|
||||||
|
|
||||||
|
# Larger bash history (allow 32³ entries; default is 500)
|
||||||
|
export HISTSIZE=32768
|
||||||
|
export HISTFILESIZE=$HISTSIZE
|
||||||
|
export HISTCONTROL=ignoredups
|
||||||
|
|
||||||
|
# Make some commands not show up in history
|
||||||
|
export HISTIGNORE="ls:cd:cd -:pwd:exit:date:* --help"
|
||||||
|
|
||||||
|
# And include the parameter for ZSH
|
||||||
|
export HISTORY_IGNORE="(ls|cd|cd -|pwd|exit|date|* --help)"
|
||||||
|
|
||||||
|
# Highlight section titles in manual pages
|
||||||
|
export LESS_TERMCAP_md="$ORANGE"
|
||||||
|
|
||||||
|
# Don’t clear the screen after quitting a manual page
|
||||||
|
export MANPAGER="less -X"
|
||||||
|
|
||||||
|
# Always enable colored `grep` output
|
||||||
|
export GREP_OPTIONS="--color=auto"
|
||||||
67
config/functions
Normal file
67
config/functions
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
# shellcheck shell=bash
|
||||||
|
#
|
||||||
|
# shell functions
|
||||||
|
#
|
||||||
|
|
||||||
|
# Weather in Tampere, or other city
|
||||||
|
function weather
|
||||||
|
{
|
||||||
|
# https://github.com/chubin/wttr.in#usage
|
||||||
|
local city="${1:-Tampere}"
|
||||||
|
curl "http://wttr.in/${city// /+}?2nFQM&lang=fi"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Docker
|
||||||
|
function ssh-docker
|
||||||
|
{
|
||||||
|
docker exec -it "$@" bash
|
||||||
|
}
|
||||||
|
|
||||||
|
# Create a new directory and enter it
|
||||||
|
function mkd
|
||||||
|
{
|
||||||
|
mkdir -p "$@" && cd "$@" || exit
|
||||||
|
}
|
||||||
|
|
||||||
|
# All the dig info
|
||||||
|
function digga
|
||||||
|
{
|
||||||
|
dig +nocmd "$1" any +multiline +noall +answer
|
||||||
|
}
|
||||||
|
|
||||||
|
# Rector project to php version 8.0 by default.
|
||||||
|
function rector
|
||||||
|
{
|
||||||
|
local php="${1:-80}"
|
||||||
|
docker run -v "$(pwd)":/project rector/rector:latest process \
|
||||||
|
"/project/$1" \
|
||||||
|
--set "php${php}" \
|
||||||
|
--autoload-file /project/vendor/autoload.php
|
||||||
|
}
|
||||||
|
|
||||||
|
# Commit everything
|
||||||
|
function commit
|
||||||
|
{
|
||||||
|
commitMessage="$*"
|
||||||
|
|
||||||
|
if [ "$commitMessage" = "" ]; then
|
||||||
|
commitMessage="Automated commit"
|
||||||
|
fi
|
||||||
|
|
||||||
|
git add .
|
||||||
|
eval "git commit -a -m '${commitMessage}'"
|
||||||
|
}
|
||||||
|
|
||||||
|
function scheduler
|
||||||
|
{
|
||||||
|
while :; do
|
||||||
|
php artisan schedule:run
|
||||||
|
echo "Sleeping 60 seconds..."
|
||||||
|
sleep 60
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
function silent
|
||||||
|
{
|
||||||
|
"$@" >&/dev/null
|
||||||
|
}
|
||||||
@@ -13,15 +13,6 @@ _theme
|
|||||||
*.sql.gz
|
*.sql.gz
|
||||||
*.WordPress.*.xml
|
*.WordPress.*.xml
|
||||||
cachegrind.out.*
|
cachegrind.out.*
|
||||||
client-*.json
|
|
||||||
composer.phar
|
composer.phar
|
||||||
devops/.infra_ip_cache
|
|
||||||
wp_*.sh
|
wp_*.sh
|
||||||
|
|
||||||
redirectRules.csv
|
|
||||||
results_redirectRules.csv
|
|
||||||
testRedirect.sh
|
|
||||||
|
|
||||||
uploads-webpc
|
|
||||||
webpc-passthru.php
|
|
||||||
auth.json
|
auth.json
|
||||||
|
|||||||
@@ -58,3 +58,9 @@
|
|||||||
allowedSignersFile = ~/.ssh/allowed_signers
|
allowedSignersFile = ~/.ssh/allowed_signers
|
||||||
[commit]
|
[commit]
|
||||||
gpgsign = true
|
gpgsign = true
|
||||||
|
[credential "https://github.com"]
|
||||||
|
helper =
|
||||||
|
helper = !/opt/homebrew/bin/gh auth git-credential
|
||||||
|
[credential "https://gist.github.com"]
|
||||||
|
helper =
|
||||||
|
helper = !/opt/homebrew/bin/gh auth git-credential
|
||||||
|
|||||||
83
install.sh
83
install.sh
@@ -1,83 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
# Usage:
|
|
||||||
#
|
|
||||||
# sh install.sh
|
|
||||||
#
|
|
||||||
# Environment variables: VERBOSE, CP, LN, MKDIR, RM, DIRNAME.
|
|
||||||
#
|
|
||||||
# env VERBOSE=1 sh install.sh
|
|
||||||
#
|
|
||||||
# DO NOT EDIT THIS FILE
|
|
||||||
#
|
|
||||||
# This file is generated by rcm(7) as:
|
|
||||||
#
|
|
||||||
# rcup -B 0 -g
|
|
||||||
#
|
|
||||||
# To update it, re-run the above command.
|
|
||||||
#
|
|
||||||
: ${VERBOSE:=0}
|
|
||||||
: ${CP:=/bin/cp}
|
|
||||||
: ${LN:=/bin/ln}
|
|
||||||
: ${MKDIR:=/bin/mkdir}
|
|
||||||
: ${RM:=/bin/rm}
|
|
||||||
: ${DIRNAME:=/usr/bin/dirname}
|
|
||||||
verbose() {
|
|
||||||
if [ "$VERBOSE" -gt 0 ]; then
|
|
||||||
echo "$@"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
handle_file_cp() {
|
|
||||||
if [ -e "$2" ]; then
|
|
||||||
printf "%s " "overwrite $2? [yN]"
|
|
||||||
read overwrite
|
|
||||||
case "$overwrite" in
|
|
||||||
y)
|
|
||||||
$RM -rf "$2"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "skipping $2"
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
verbose "'$1' -> '$2'"
|
|
||||||
$MKDIR -p "$($DIRNAME "$2")"
|
|
||||||
$CP -R "$1" "$2"
|
|
||||||
}
|
|
||||||
handle_file_ln() {
|
|
||||||
if [ -e "$2" ]; then
|
|
||||||
printf "%s " "overwrite $2? [yN]"
|
|
||||||
read overwrite
|
|
||||||
case "$overwrite" in
|
|
||||||
y)
|
|
||||||
$RM -rf "$2"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "skipping $2"
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
verbose "'$1' -> '$2'"
|
|
||||||
$MKDIR -p "$($DIRNAME "$2")"
|
|
||||||
$LN -sf "$1" "$2"
|
|
||||||
}
|
|
||||||
handle_file_ln "/Users/ivuorinen/.dotfiles/bash_profile" "/Users/ivuorinen/.bash_profile"
|
|
||||||
handle_file_ln "/Users/ivuorinen/.dotfiles/bashrc" "/Users/ivuorinen/.bashrc"
|
|
||||||
handle_file_ln "/Users/ivuorinen/.dotfiles/config/alias" "/Users/ivuorinen/.config/alias"
|
|
||||||
handle_file_ln "/Users/ivuorinen/.dotfiles/config/antigen.zsh" "/Users/ivuorinen/.config/antigen.zsh"
|
|
||||||
handle_file_ln "/Users/ivuorinen/.dotfiles/config/gh/config.yml" "/Users/ivuorinen/.config/gh/config.yml"
|
|
||||||
handle_file_ln "/Users/ivuorinen/.dotfiles/config/git/config" "/Users/ivuorinen/.config/git/config"
|
|
||||||
handle_file_ln "/Users/ivuorinen/.dotfiles/config/git/gitignore" "/Users/ivuorinen/.config/git/gitignore"
|
|
||||||
handle_file_ln "/Users/ivuorinen/.dotfiles/config/wtf/config.yml" "/Users/ivuorinen/.config/wtf/config.yml"
|
|
||||||
handle_file_ln "/Users/ivuorinen/.dotfiles/git_profiles" "/Users/ivuorinen/.git_profiles"
|
|
||||||
handle_file_ln "/Users/ivuorinen/.dotfiles/huskyrc" "/Users/ivuorinen/.huskyrc"
|
|
||||||
handle_file_ln "/Users/ivuorinen/.dotfiles/local/bin/dotfiles" "/Users/ivuorinen/.local/bin/dotfiles"
|
|
||||||
handle_file_ln "/Users/ivuorinen/.dotfiles/local/bin/x-check-git-attributes" "/Users/ivuorinen/.local/bin/x-check-git-attributes"
|
|
||||||
handle_file_ln "/Users/ivuorinen/.dotfiles/local/bin/x-open-ports" "/Users/ivuorinen/.local/bin/x-open-ports"
|
|
||||||
handle_file_ln "/Users/ivuorinen/.dotfiles/rcrc" "/Users/ivuorinen/.rcrc"
|
|
||||||
handle_file_ln "/Users/ivuorinen/.dotfiles/ssh/allowed_signers" "/Users/ivuorinen/.ssh/allowed_signers"
|
|
||||||
handle_file_ln "/Users/ivuorinen/.dotfiles/ssh/config" "/Users/ivuorinen/.ssh/config"
|
|
||||||
handle_file_ln "/Users/ivuorinen/.dotfiles/vuerc" "/Users/ivuorinen/.vuerc"
|
|
||||||
handle_file_ln "/Users/ivuorinen/.dotfiles/zshrc" "/Users/ivuorinen/.zshrc"
|
|
||||||
@@ -24,7 +24,7 @@ if [[ $ANTIGEN_CACHE != false ]]; then
|
|||||||
for config in $ANTIGEN_CHECK_FILES; do
|
for config in $ANTIGEN_CHECK_FILES; do
|
||||||
if [[ "$config" -nt "$config.zwc" ]]; then
|
if [[ "$config" -nt "$config.zwc" ]]; then
|
||||||
# Flag configuration file as newer
|
# Flag configuration file as newer
|
||||||
{ zcompile "$config" } &!
|
{ zcompile "$config"; } &!
|
||||||
# Kill cache file in order to force full loading (see a few lines below)
|
# Kill cache file in order to force full loading (see a few lines below)
|
||||||
[[ -f "$ANTIGEN_CACHE" ]] && rm -f "$ANTIGEN_CACHE"
|
[[ -f "$ANTIGEN_CACHE" ]] && rm -f "$ANTIGEN_CACHE"
|
||||||
fi
|
fi
|
||||||
137
local/bin/dfm
Executable file
137
local/bin/dfm
Executable file
@@ -0,0 +1,137 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# Dotfiles manager and install helper
|
||||||
|
# (c) Ismo Vuorinen <https://github.com/ivuorinen> 2022
|
||||||
|
# Licensed under MIT, see LICENSE
|
||||||
|
#
|
||||||
|
# shellcheck source-path=$HOME/.dotfiles/local/bin
|
||||||
|
#
|
||||||
|
# Helper variables, override with ENVs like `VERBOSE=1 dfm help`
|
||||||
|
: "${VERBOSE:=0}"
|
||||||
|
: "${DOTFILES:=$HOME/.dotfiles}"
|
||||||
|
: "${INSTALL_SCRIPT:=$DOTFILES/scripts/install.sh}"
|
||||||
|
: "${BREWFILE:=$DOTFILES/Brewfile}"
|
||||||
|
|
||||||
|
SCRIPT=$(basename "$0")
|
||||||
|
|
||||||
|
function section_install
|
||||||
|
{
|
||||||
|
USAGE_PREFIX="-> $SCRIPT install"
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
all)
|
||||||
|
bash "$DOTFILES/scripts/settler.sh" && echo "🎉 Done!"
|
||||||
|
;;
|
||||||
|
antigen)
|
||||||
|
curl -L git.io/antigen > "$DOTFILES/local/bin/antigen.zsh" && echo "🎉 Done!"
|
||||||
|
;;
|
||||||
|
defaults)
|
||||||
|
bash "$DOTFILES/scripts/set-defaults.sh" && echo "🎉 Done!"
|
||||||
|
;;
|
||||||
|
gh-extensions)
|
||||||
|
bash "$DOTFILES/scripts/gh-extensions.sh" && echo "🎉 Done!"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "$USAGE_PREFIX [antigen | defaults | gh-extensions]"
|
||||||
|
echo " * antigen: Updates the antigen.zsh file"
|
||||||
|
echo " * defaults: Setup nice macOS defaults"
|
||||||
|
echo " * gh-extensions: Install GitHub CLI Extensions"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
function section_brew
|
||||||
|
{
|
||||||
|
USAGE_PREFIX="-> $SCRIPT brew"
|
||||||
|
|
||||||
|
if ! command -v brew &> /dev/null; then
|
||||||
|
echo "brew could not be found, please install it first"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
install)
|
||||||
|
brew bundle install --file="$BREWFILE"
|
||||||
|
echo "🎉 Done!"
|
||||||
|
;;
|
||||||
|
update)
|
||||||
|
brew update && brew outdated && brew upgrade && brew cleanup
|
||||||
|
echo "🎉 Done!"
|
||||||
|
;;
|
||||||
|
updatebundle)
|
||||||
|
# Updates .dotfiles/Brewfile with descriptions
|
||||||
|
brew bundle dump --force --file="$BREWFILE" --describe && echo "🎉 Done!"
|
||||||
|
;;
|
||||||
|
autoupdate)
|
||||||
|
brew autoupdate start 43200 --upgrade --cleanup --immediate
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "$USAGE_PREFIX [install | update | updatebundle]"
|
||||||
|
echo " * install: Installs items defined in Brewfile"
|
||||||
|
echo " * update: Updates and upgrades brew packages"
|
||||||
|
echo " * updatebundle: Updates Brewfile with descriptions"
|
||||||
|
echo " * autoupdate: Setups brew auto-update and runs it immediately"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
function section_dotfiles
|
||||||
|
{
|
||||||
|
USAGE_PREFIX="-> $SCRIPT dotfiles"
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
link)
|
||||||
|
rcup -B "$HOSTNAME" -v && echo "🎉 Done!"
|
||||||
|
;;
|
||||||
|
update)
|
||||||
|
# Updates .dotfiles/scripts/install.sh and formats it
|
||||||
|
rcup -B 0 -g \
|
||||||
|
| tee "$INSTALL_SCRIPT" 1> /dev/null \
|
||||||
|
&& shfmt -w -l "$INSTALL_SCRIPT" \
|
||||||
|
&& sed -i '' "s|$HOME|\$HOME|g" "$INSTALL_SCRIPT" \
|
||||||
|
&& echo "🎉 Done!"
|
||||||
|
;;
|
||||||
|
shfmt)
|
||||||
|
# Format shell scripts according to following rules.
|
||||||
|
shfmt \
|
||||||
|
--find \
|
||||||
|
--list \
|
||||||
|
--write \
|
||||||
|
--diff \
|
||||||
|
--simplify \
|
||||||
|
--language-dialect bash \
|
||||||
|
--indent 2 \
|
||||||
|
--binary-next-line \
|
||||||
|
--case-indent \
|
||||||
|
--space-redirects \
|
||||||
|
--func-next-line \
|
||||||
|
"$DOTFILES"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "$USAGE_PREFIX [link | update | shfmt]"
|
||||||
|
echo " * link: Use rcrc to update dotfile links"
|
||||||
|
echo " * update: Updates dotfile links, installs host specific overrides automatically"
|
||||||
|
echo " * shfmt: Run shfmt to all dotfiles"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
function usage
|
||||||
|
{
|
||||||
|
echo $"Usage: $SCRIPT [install | brew | dotfiles]"
|
||||||
|
echo $" All commands have their own subcommands."
|
||||||
|
echo ""
|
||||||
|
section_install
|
||||||
|
echo ""
|
||||||
|
section_brew
|
||||||
|
echo ""
|
||||||
|
section_dotfiles
|
||||||
|
}
|
||||||
|
|
||||||
|
# The main loop. first keyword after $0 triggers section, or help.
|
||||||
|
case "$1" in
|
||||||
|
install) section_install "$2" ;;
|
||||||
|
brew) section_brew "$2" ;;
|
||||||
|
dotfiles) section_dotfiles "$2" ;;
|
||||||
|
*) usage && exit 1 ;;
|
||||||
|
esac
|
||||||
@@ -1,104 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
#
|
|
||||||
# Dotfiles and install helper
|
|
||||||
# (c) Ismo Vuorinen <https://github.com/ivuorinen> 2022
|
|
||||||
# Licensed under MIT, see LICENSE
|
|
||||||
#
|
|
||||||
|
|
||||||
# Helper variables, override with ENVs like `VERBOSE=1 helpers.sh help`
|
|
||||||
: "${VERBOSE:=0}"
|
|
||||||
: "${DOTFILES:=$HOME/.dotfiles}"
|
|
||||||
: "${INSTALL_SCRIPT:=$DOTFILES/install.sh}"
|
|
||||||
: "${BREWFILE:=$DOTFILES/Brewfile}"
|
|
||||||
|
|
||||||
function usage() {
|
|
||||||
echo $"Usage: $0 [install | brew | dotfiles | other]"
|
|
||||||
echo $" All commands have their own subcommands."
|
|
||||||
echo $" When in doubt run the subcommand to show list."
|
|
||||||
}
|
|
||||||
|
|
||||||
function section_install() {
|
|
||||||
USAGE_PREFIX="Usage: $0 install"
|
|
||||||
|
|
||||||
case "$1" in
|
|
||||||
*)
|
|
||||||
echo "$USAGE_PREFIX [link | update]"
|
|
||||||
echo " * link: Use rcrc to update dotfile links"
|
|
||||||
echo " * update: Updates and upgrades brew packages"
|
|
||||||
echo " * updatebundle: Updates Brewfile with descriptions"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
function section_brew() {
|
|
||||||
USAGE_PREFIX="Usage: $0 brew"
|
|
||||||
|
|
||||||
if ! command -v brew &> /dev/null; then
|
|
||||||
echo "brew could not be found, please install it first"
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
case "$1" in
|
|
||||||
install)
|
|
||||||
brew bundle install --file="$BREWFILE"; echo "🎉 Done!"
|
|
||||||
;;
|
|
||||||
update)
|
|
||||||
brew update && brew upgrade; echo "🎉 Done!"
|
|
||||||
;;
|
|
||||||
updatebundle)
|
|
||||||
# Updates .dotfiles/Brewfile with descriptions
|
|
||||||
brew bundle dump --force --file="$BREWFILE" --describe
|
|
||||||
echo "🎉 Done!"
|
|
||||||
;;
|
|
||||||
autoupdate)
|
|
||||||
brew autoupdate start 43200 --upgrade --cleanup --immediate
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "$USAGE_PREFIX [install | update | updatebundle]"
|
|
||||||
echo " * install: Installs items defined in Brewfile"
|
|
||||||
echo " * update: Updates and upgrades brew packages"
|
|
||||||
echo " * updatebundle: Updates Brewfile with descriptions"
|
|
||||||
echo " * autoupdate: Setups brew auto-update and runs it immediately"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
function section_dotfiles() {
|
|
||||||
USAGE_PREFIX="Usage: $0 dotfiles"
|
|
||||||
|
|
||||||
case "$1" in
|
|
||||||
link)
|
|
||||||
rcup -B "$HOSTNAME" -v && echo "🎉 Done!"
|
|
||||||
;;
|
|
||||||
update)
|
|
||||||
# Updates .dotfiles/install.sh and formats it
|
|
||||||
rcup -B 0 -g | \
|
|
||||||
tee "$INSTALL_SCRIPT" 1> /dev/null && \
|
|
||||||
shfmt -w -l "$INSTALL_SCRIPT" && \
|
|
||||||
echo "🎉 Done!"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "$USAGE_PREFIX [link | update]"
|
|
||||||
echo " * link: Use rcrc to update dotfile links"
|
|
||||||
echo " * update: Updates dotfile links, installs host specific overrides automatically"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
function section_other() {
|
|
||||||
case "$1" in
|
|
||||||
*)
|
|
||||||
echo "section_other"
|
|
||||||
echo "$1"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
# The main loop. first keyword after $0 triggers section, or help.
|
|
||||||
case "$1" in
|
|
||||||
install) section_install "$2" ;;
|
|
||||||
brew) section_brew "$2" ;;
|
|
||||||
dotfiles) section_dotfiles "$2" ;;
|
|
||||||
other) section_other "$2" ;;
|
|
||||||
*) usage; exit 1 ;;
|
|
||||||
esac
|
|
||||||
43
local/bin/x-backup-mysql-with-prefix.sh
Executable file
43
local/bin/x-backup-mysql-with-prefix.sh
Executable file
@@ -0,0 +1,43 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# Backup local MySQL Database tables with certain prefix.
|
||||||
|
# Ismo Vuorinen <https://github.com/ivuorinen> 2018
|
||||||
|
#
|
||||||
|
|
||||||
|
SCRIPT=$(basename "$0")
|
||||||
|
PREFIX=$1
|
||||||
|
FILENAME=$2
|
||||||
|
DATABASE=$3
|
||||||
|
|
||||||
|
: "${VERBOSE:=0}"
|
||||||
|
: "${DEFAULT_DATABASE:="wordpress"}"
|
||||||
|
|
||||||
|
if [ -z "${PREFIX}" ]; then
|
||||||
|
echo "(!) TABLE_PREFIX (first argument) is missing"
|
||||||
|
echo "(>) Usage: $SCRIPT <TABLE_PREFIX> <FILENAME_PREFIX> [<DATABASE>]"
|
||||||
|
echo " * <TABLE_PREFIX> = database table prefix, e.g. 'wp_'"
|
||||||
|
echo " * <FILENAME_PREFIX> = FILENAME prefix, defaults to table prefix. Use something descriptive e.g. 'wordpress'"
|
||||||
|
echo " * <DATABASE> = [optional] Third argument DATABASE, defaults to '$DEFAULT_DATABASE'."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "${FILENAME}" ]; then
|
||||||
|
# echo "FILENAME (second argument) is missing, using PREFIX ($PREFIX)"
|
||||||
|
FILENAME=$PREFIX
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "${DATABASE}" ]; then
|
||||||
|
# echo "DATABASE (third argument) is missing, using default ($DEFAULT_DATABASE)"
|
||||||
|
DATABASE=$DEFAULT_DATABASE
|
||||||
|
fi
|
||||||
|
|
||||||
|
TIMESTAMP=$(date "+%Y%m%d_%H%M%S")
|
||||||
|
FILENAME_TIMESTAMP="${DATABASE}_${FILENAME}_${TIMESTAMP}.sql"
|
||||||
|
|
||||||
|
mysqldump \
|
||||||
|
${DATABASE} \
|
||||||
|
"$(
|
||||||
|
echo "show tables like '${PREFIX}%';" \
|
||||||
|
| mysql ${DATABASE} \
|
||||||
|
| sed '/Tables_in/d'
|
||||||
|
)" > "${FILENAME_TIMESTAMP}"
|
||||||
@@ -1,6 +1,16 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# Check git repo's files .gitattributes and are all of them mapped.
|
||||||
|
# Ismo Vuorinen <https://github.com/ivuorinen> 2022
|
||||||
|
#
|
||||||
|
|
||||||
|
if ! command -v git &> /dev/null; then
|
||||||
|
echo "git could not be found, please install it first"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
missing_attributes=$(git ls-files | git check-attr -a --stdin | grep "text: auto")
|
missing_attributes=$(git ls-files | git check-attr -a --stdin | grep "text: auto")
|
||||||
|
|
||||||
if [[ "$missing_attributes" ]]; then
|
if [[ "$missing_attributes" ]]; then
|
||||||
echo ".gitattributes rule missing for the following files:"
|
echo ".gitattributes rule missing for the following files:"
|
||||||
echo "$missing_attributes"
|
echo "$missing_attributes"
|
||||||
|
|||||||
@@ -6,15 +6,14 @@
|
|||||||
# Originally from: https://www.commandlinefu.com/commands/view/8951
|
# Originally from: https://www.commandlinefu.com/commands/view/8951
|
||||||
# Original author: https://www.commandlinefu.com/commands/by/wickedcpj
|
# Original author: https://www.commandlinefu.com/commands/by/wickedcpj
|
||||||
#
|
#
|
||||||
echo 'User: Command: Port:';
|
echo 'User: Command: Port:'
|
||||||
echo '=====================================================';
|
echo '====================================================='
|
||||||
|
|
||||||
lsof -i 4 -P -n +c 0 | \
|
lsof -i 4 -P -n +c 0 \
|
||||||
grep -i 'listen' | \
|
| grep -i 'listen' \
|
||||||
awk '{print $3, $1, $9}' | \
|
| awk '{print $3, $1, $9}' \
|
||||||
sed 's/ [a-z0-9\.\*]*:/ /' | \
|
| sed 's/ [a-z0-9\.\*]*:/ /' \
|
||||||
sort -k 3 -n | \
|
| sort -k 3 -n \
|
||||||
xargs printf '%-20s %-25s %-5s\n' | uniq
|
| xargs printf '%-20s %-25s %-5s\n' | uniq
|
||||||
|
|
||||||
echo "";
|
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
|||||||
52
local/bin/x-validate-sha256sum.sh
Normal file
52
local/bin/x-validate-sha256sum.sh
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
##
|
||||||
|
# This script contains helper for sha256 validating your downloads
|
||||||
|
#
|
||||||
|
# Source: https://gist.github.com/onnimonni/b49779ebc96216771a6be3de46449fa1
|
||||||
|
# Author: Onni Hakala
|
||||||
|
# License: MIT
|
||||||
|
#
|
||||||
|
# Updated by Ismo Vuorinen <https://github.com/ivuorinen> 2022
|
||||||
|
##
|
||||||
|
|
||||||
|
if ! command -v sha256 &> /dev/null; then
|
||||||
|
echo "git could not be found, please install it first"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Stop program and give error message
|
||||||
|
# $1 - error message (string)
|
||||||
|
function error
|
||||||
|
{
|
||||||
|
echo "(!) ERROR: $1"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# return sha256sum for file
|
||||||
|
# $1 - filename (string)
|
||||||
|
function get_sha256sum
|
||||||
|
{
|
||||||
|
sha256sum "$1" | head -c 64
|
||||||
|
}
|
||||||
|
|
||||||
|
# Good variable names pls
|
||||||
|
filename=$1
|
||||||
|
file_hash=$2
|
||||||
|
|
||||||
|
# Check input
|
||||||
|
if [ -z "$filename" ]; then
|
||||||
|
error "You need to provide filename in first parameter"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$file_hash" ]; then
|
||||||
|
error "You need to provide sha256sum in second parameter"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check if the file is valid
|
||||||
|
if [ ! -f "$filename" ]; then
|
||||||
|
error "File $filename doesn't exist"
|
||||||
|
elif [ "$(get_sha256sum "$filename")" = "$file_hash" ]; then
|
||||||
|
echo "(*) Success: $filename matches provided sha256sum"
|
||||||
|
else
|
||||||
|
error "$filename doesn't match provided sha256sum"
|
||||||
|
fi
|
||||||
@@ -1,29 +1,44 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Install GitHub CLI extensions
|
# Install GitHub CLI extensions
|
||||||
|
|
||||||
# GitHub CLI extension for reviewing Dependabot PRs.
|
if ! command -v gh &> /dev/null; then
|
||||||
gh extension install einride/gh-dependabot
|
echo "gh (GitHub Client) could not be found, please install it first"
|
||||||
# A GitHub CLI extension that provides summary pull request metrics.
|
exit 1
|
||||||
gh extension install hectcastro/gh-metrics
|
fi
|
||||||
# being an extension to view the overall health of an organization's use of actions
|
|
||||||
gh extension install rsese/gh-actions-status
|
extensions=(
|
||||||
# GitHub CLI extension for label management
|
# GitHub CLI extension for reviewing Dependabot PRs.
|
||||||
gh extension install heaths/gh-label
|
einride/gh-dependabot
|
||||||
# An opinionated GitHub Cli extension for creating
|
# A GitHub CLI extension that provides summary pull request metrics.
|
||||||
# changelogs that adhere to the keep a changelog specification.
|
hectcastro/gh-metrics
|
||||||
gh extension install chelnak/gh-changelog
|
# being an extension to view the overall health of an organization's use of actions
|
||||||
# Safely deletes local branches with no upstream and no un-pushed commits
|
rsese/gh-actions-status
|
||||||
gh extension install davidraviv/gh-clean-branches
|
# GitHub CLI extension for label management
|
||||||
# A beautiful CLI dashboard for GitHub 🚀
|
heaths/gh-label
|
||||||
gh extension install dlvhdr/gh-dash
|
# An opinionated GitHub Cli extension for creating
|
||||||
# A github-cli extension script to clone all repositories
|
# changelogs that adhere to the keep a changelog specification.
|
||||||
# in an organization, optionally filtering by topic.
|
chelnak/gh-changelog
|
||||||
gh extension install matt-bartel/gh-clone-org
|
# Safely deletes local branches with no upstream and no un-pushed commits
|
||||||
# GitHub CLI extension to generate montage from GitHub user avatars
|
davidraviv/gh-clean-branches
|
||||||
gh extension install andyfeller/gh-montage
|
# A beautiful CLI dashboard for GitHub 🚀
|
||||||
# Organisation specific extension for gh cli to retrieve different statistics
|
dlvhdr/gh-dash
|
||||||
gh extension install VildMedPap/gh-orgstats
|
# A github-cli extension script to clone all repositories
|
||||||
# GitHub CLI extension for generating a report on repository dependencies.
|
# in an organization, optionally filtering by topic.
|
||||||
gh extension install andyfeller/gh-dependency-report
|
matt-bartel/gh-clone-org
|
||||||
# gh cli extension to generate account/organization/enterprise reports
|
# GitHub CLI extension to generate montage from GitHub user avatars
|
||||||
gh extension install stoe/gh-report
|
andyfeller/gh-montage
|
||||||
|
# Organisation specific extension for gh cli to retrieve different statistics
|
||||||
|
VildMedPap/gh-orgstats
|
||||||
|
# GitHub CLI extension for generating a report on repository dependencies.
|
||||||
|
andyfeller/gh-dependency-report
|
||||||
|
# gh cli extension to generate account/organization/enterprise reports
|
||||||
|
stoe/gh-report
|
||||||
|
)
|
||||||
|
|
||||||
|
for ext in "${extensions[@]}"; do
|
||||||
|
# Skip comments
|
||||||
|
if [[ ${ext:0:1} == "#" ]]; then continue; fi
|
||||||
|
|
||||||
|
echo "-> Installing $ext"
|
||||||
|
gh extensions install "$ext"
|
||||||
|
done
|
||||||
|
|||||||
88
scripts/install.sh
Normal file
88
scripts/install.sh
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# Usage:
|
||||||
|
#
|
||||||
|
# sh install.sh
|
||||||
|
#
|
||||||
|
# Environment variables: VERBOSE, CP, LN, MKDIR, RM, DIRNAME.
|
||||||
|
#
|
||||||
|
# env VERBOSE=1 sh install.sh
|
||||||
|
#
|
||||||
|
# DO NOT EDIT THIS FILE
|
||||||
|
#
|
||||||
|
# This file is generated by rcm(7) as:
|
||||||
|
#
|
||||||
|
# rcup -B 0 -g
|
||||||
|
#
|
||||||
|
# To update it, re-run the above command.
|
||||||
|
#
|
||||||
|
: ${VERBOSE:=0}
|
||||||
|
: ${CP:=/bin/cp}
|
||||||
|
: ${LN:=/bin/ln}
|
||||||
|
: ${MKDIR:=/bin/mkdir}
|
||||||
|
: ${RM:=/bin/rm}
|
||||||
|
: ${DIRNAME:=/usr/bin/dirname}
|
||||||
|
verbose()
|
||||||
|
{
|
||||||
|
if [ "$VERBOSE" -gt 0 ]; then
|
||||||
|
echo "$@"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
handle_file_cp()
|
||||||
|
{
|
||||||
|
if [ -e "$2" ]; then
|
||||||
|
printf "%s " "overwrite $2? [yN]"
|
||||||
|
read overwrite
|
||||||
|
case "$overwrite" in
|
||||||
|
y)
|
||||||
|
$RM -rf "$2"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "skipping $2"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
verbose "'$1' -> '$2'"
|
||||||
|
$MKDIR -p "$($DIRNAME "$2")"
|
||||||
|
$CP -R "$1" "$2"
|
||||||
|
}
|
||||||
|
handle_file_ln()
|
||||||
|
{
|
||||||
|
if [ -e "$2" ]; then
|
||||||
|
printf "%s " "overwrite $2? [yN]"
|
||||||
|
read overwrite
|
||||||
|
case "$overwrite" in
|
||||||
|
y)
|
||||||
|
$RM -rf "$2"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "skipping $2"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
verbose "'$1' -> '$2'"
|
||||||
|
$MKDIR -p "$($DIRNAME "$2")"
|
||||||
|
$LN -sf "$1" "$2"
|
||||||
|
}
|
||||||
|
handle_file_ln "$HOME/.dotfiles/bash_profile" "$HOME/.bash_profile"
|
||||||
|
handle_file_ln "$HOME/.dotfiles/bashrc" "$HOME/.bashrc"
|
||||||
|
handle_file_ln "$HOME/.dotfiles/config/alias" "$HOME/.config/alias"
|
||||||
|
handle_file_ln "$HOME/.dotfiles/config/exports" "$HOME/.config/exports"
|
||||||
|
handle_file_ln "$HOME/.dotfiles/config/functions" "$HOME/.config/functions"
|
||||||
|
handle_file_ln "$HOME/.dotfiles/config/gh/config.yml" "$HOME/.config/gh/config.yml"
|
||||||
|
handle_file_ln "$HOME/.dotfiles/config/git/config" "$HOME/.config/git/config"
|
||||||
|
handle_file_ln "$HOME/.dotfiles/config/git/gitignore" "$HOME/.config/git/gitignore"
|
||||||
|
handle_file_ln "$HOME/.dotfiles/config/wtf/config.yml" "$HOME/.config/wtf/config.yml"
|
||||||
|
handle_file_ln "$HOME/.dotfiles/git_profiles" "$HOME/.git_profiles"
|
||||||
|
handle_file_ln "$HOME/.dotfiles/huskyrc" "$HOME/.huskyrc"
|
||||||
|
handle_file_ln "$HOME/.dotfiles/local/bin/antigen.zsh" "$HOME/.local/bin/antigen.zsh"
|
||||||
|
handle_file_ln "$HOME/.dotfiles/local/bin/dfm" "$HOME/.local/bin/dfm"
|
||||||
|
handle_file_ln "$HOME/.dotfiles/local/bin/x-check-git-attributes" "$HOME/.local/bin/x-check-git-attributes"
|
||||||
|
handle_file_ln "$HOME/.dotfiles/local/bin/x-open-ports" "$HOME/.local/bin/x-open-ports"
|
||||||
|
handle_file_ln "$HOME/.dotfiles/rcrc" "$HOME/.rcrc"
|
||||||
|
handle_file_ln "$HOME/.dotfiles/ssh/allowed_signers" "$HOME/.ssh/allowed_signers"
|
||||||
|
handle_file_ln "$HOME/.dotfiles/ssh/config" "$HOME/.ssh/config"
|
||||||
|
handle_file_ln "$HOME/.dotfiles/vuerc" "$HOME/.vuerc"
|
||||||
|
handle_file_ln "$HOME/.dotfiles/zshrc" "$HOME/.zshrc"
|
||||||
@@ -4,8 +4,13 @@ echo 'start osx/set-defaults.sh'
|
|||||||
# Ask for the administrator password upfront
|
# Ask for the administrator password upfront
|
||||||
sudo -v
|
sudo -v
|
||||||
|
|
||||||
# Keep-alive: update existing `sudo` time stamp until `.osx` has finished
|
# Keep-alive: update existing `sudo` time stamp
|
||||||
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
|
# until this script has finished
|
||||||
|
while true; do
|
||||||
|
sudo -n true
|
||||||
|
sleep 60
|
||||||
|
kill -0 "$$" || exit
|
||||||
|
done 2> /dev/null &
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# General UI/UX #
|
# General UI/UX #
|
||||||
@@ -17,8 +22,8 @@ sudo nvram SystemAudioVolume=" "
|
|||||||
# Menu bar: disable transparency
|
# Menu bar: disable transparency
|
||||||
#defaults write NSGlobalDomain AppleEnableMenuBarTransparency -bool false
|
#defaults write NSGlobalDomain AppleEnableMenuBarTransparency -bool false
|
||||||
|
|
||||||
# Set sidebar icon size to medium
|
# Set sidebar icon size to small
|
||||||
defaults write NSGlobalDomain NSTableViewDefaultSizeMode -int 2
|
defaults write NSGlobalDomain NSTableViewDefaultSizeMode -int 1
|
||||||
|
|
||||||
# Increase window resize speed for Cocoa applications
|
# Increase window resize speed for Cocoa applications
|
||||||
defaults write NSGlobalDomain NSWindowResizeTime -float 0.001
|
defaults write NSGlobalDomain NSWindowResizeTime -float 0.001
|
||||||
@@ -120,9 +125,9 @@ defaults write com.apple.screensaver askForPasswordDelay -int 0
|
|||||||
defaults write com.apple.finder NewWindowTarget -string "PfDe"
|
defaults write com.apple.finder NewWindowTarget -string "PfDe"
|
||||||
defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/Desktop/"
|
defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/Desktop/"
|
||||||
|
|
||||||
# Show icons for hard drives, servers, and removable media on the desktop
|
# Show icons for external hard drives, servers, and removable media on the desktop
|
||||||
defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true
|
defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true
|
||||||
defaults write com.apple.finder ShowHardDrivesOnDesktop -bool true
|
defaults write com.apple.finder ShowHardDrivesOnDesktop -bool false
|
||||||
defaults write com.apple.finder ShowMountedServersOnDesktop -bool true
|
defaults write com.apple.finder ShowMountedServersOnDesktop -bool true
|
||||||
defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool true
|
defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool true
|
||||||
|
|
||||||
@@ -151,7 +156,7 @@ defaults write com.apple.frameworks.diskimages skip-verify-remote -bool true
|
|||||||
|
|
||||||
# Use list view in all Finder windows by default
|
# Use list view in all Finder windows by default
|
||||||
# Four-letter codes for the other view modes: `icnv`, `clmv`, `Flwv`
|
# Four-letter codes for the other view modes: `icnv`, `clmv`, `Flwv`
|
||||||
defaults write com.apple.finder FXPreferredViewStyle -string "clmv"
|
defaults write com.apple.finder FXPreferredViewStyle -string "icnv"
|
||||||
|
|
||||||
# Disable the warning before emptying the Trash
|
# Disable the warning before emptying the Trash
|
||||||
defaults write com.apple.finder WarnOnEmptyTrash -bool false
|
defaults write com.apple.finder WarnOnEmptyTrash -bool false
|
||||||
@@ -177,7 +182,7 @@ defaults write com.apple.finder FXInfoPanesExpanded -dict \
|
|||||||
#defaults write com.apple.screencapture "location" -string "~/Documents/Screenshots"
|
#defaults write com.apple.screencapture "location" -string "~/Documents/Screenshots"
|
||||||
|
|
||||||
# Exclude date and time in screenshot filenames
|
# Exclude date and time in screenshot filenames
|
||||||
defaults write com.apple.screencapture "include-date" -bool false
|
defaults write com.apple.screencapture "include-date" -bool true
|
||||||
|
|
||||||
# Change the default screenshot file name
|
# Change the default screenshot file name
|
||||||
defaults write com.apple.screencapture "name" -string "screenshot"
|
defaults write com.apple.screencapture "name" -string "screenshot"
|
||||||
@@ -189,16 +194,16 @@ defaults write com.apple.screencapture "name" -string "screenshot"
|
|||||||
# Prevent applications from bouncing in Dock
|
# Prevent applications from bouncing in Dock
|
||||||
defaults write com.apple.dock no-bouncing -bool true
|
defaults write com.apple.dock no-bouncing -bool true
|
||||||
|
|
||||||
# Set the icon size of Dock items to 72 pixels
|
# Set the icon size of Dock items to 30 pixels
|
||||||
defaults write com.apple.dock tilesize -int 72
|
defaults write com.apple.dock tilesize -int 30
|
||||||
|
|
||||||
# Hide indicator lights for open applications in the Dock
|
# Hide indicator lights for open applications in the Dock
|
||||||
defaults write com.apple.dock show-process-indicators -bool false
|
defaults write com.apple.dock show-process-indicators -bool true
|
||||||
|
|
||||||
# Wipe all (default) app icons from the Dock
|
# Wipe all (default) app icons from the Dock
|
||||||
# This is only really useful when setting up a new Mac, or if you don’t use
|
# This is only really useful when setting up a new Mac, or if you don’t use
|
||||||
# the Dock to launch apps.
|
# the Dock to launch apps.
|
||||||
defaults write com.apple.dock persistent-apps -array ""
|
# defaults write com.apple.dock persistent-apps -array ""
|
||||||
|
|
||||||
# Disable Dashboard
|
# Disable Dashboard
|
||||||
defaults write com.apple.dashboard mcx-disabled -bool true
|
defaults write com.apple.dashboard mcx-disabled -bool true
|
||||||
|
|||||||
60
scripts/settler.sh
Executable file
60
scripts/settler.sh
Executable file
@@ -0,0 +1,60 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# Settler - my macOS setup automator
|
||||||
|
# Ismo Vuorinen <https://github.com/ivuorinen> 2018
|
||||||
|
|
||||||
|
# Ask for the administrator password upfront
|
||||||
|
sudo -v
|
||||||
|
|
||||||
|
# Keep-alive: update existing `sudo` time stamp until `settler` has finished
|
||||||
|
while true; do
|
||||||
|
sudo -n true
|
||||||
|
sleep 60
|
||||||
|
kill -0 "$$" || exit
|
||||||
|
done 2> /dev/null &
|
||||||
|
|
||||||
|
# https://unix.stackexchange.com/a/408305
|
||||||
|
# check if user has git installed and propose to install if not installed
|
||||||
|
if [ "$(which git)" ]; then
|
||||||
|
echo "You already have git. Continuing..."
|
||||||
|
else
|
||||||
|
XCODE_MESSAGE="$(
|
||||||
|
osascript -e \
|
||||||
|
'tell app "System Events" to display dialog "Please click install when Command Line Developer Tools appears"'
|
||||||
|
)"
|
||||||
|
|
||||||
|
if [ "$XCODE_MESSAGE" = "button returned:OK" ]; then
|
||||||
|
xcode-select --install
|
||||||
|
else
|
||||||
|
echo "You have cancelled the installation, please rerun the installer."
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
until [ "$(which git)" ]; do
|
||||||
|
echo -n "."
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
|
||||||
|
# Install brew
|
||||||
|
if [ "$(which brew)" ]; then
|
||||||
|
echo 'Brew already installed'
|
||||||
|
else
|
||||||
|
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
bash ../local/bin/dfm brew install && "Installed Brewfile contents"
|
||||||
|
bash ../local/bin/dfm dotfiles link && "Linked all dotfiles"
|
||||||
|
|
||||||
|
read -r -p "Do you want to set macOS defaults? (y/N) " yn
|
||||||
|
|
||||||
|
case $yn in
|
||||||
|
[yY])
|
||||||
|
bash "set-defaults.sh"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Skipping..."
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
echo "Done. Note that some of these changes require a logout/restart to take effect."
|
||||||
34
zshrc
34
zshrc
@@ -2,21 +2,12 @@
|
|||||||
[[ -f "$HOME/.fig/shell/zshrc.pre.zsh" ]] && builtin source "$HOME/.fig/shell/zshrc.pre.zsh"
|
[[ -f "$HOME/.fig/shell/zshrc.pre.zsh" ]] && builtin source "$HOME/.fig/shell/zshrc.pre.zsh"
|
||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
|
|
||||||
LOCAL_BIN="$HOME/.local/bin"
|
export PATH="/opt/homebrew/bin:/usr/local/sbin:$PATH"
|
||||||
|
|
||||||
PYTHON_38="$HOME/Library/Python/3.8/bin"
|
|
||||||
COMPOSER_DIR="$HOME/.composer/vendor/bin"
|
|
||||||
USR_SBIN=/usr/local/sbin
|
|
||||||
|
|
||||||
export PATH="/opt/homebrew/bin:$USR_SBIN:$PATH"
|
|
||||||
|
|
||||||
if [ command -v brew &> /dev/null ]; then
|
if [ command -v brew &> /dev/null ]; then
|
||||||
BREW_BIN=$(brew --prefix)/bin
|
BREW_BIN=$(brew --prefix)/bin
|
||||||
BREW_SBIN=$(brew --prefix)/sbin
|
BREW_SBIN=$(brew --prefix)/sbin
|
||||||
|
|
||||||
# PHP_74=$(brew --prefix php@7.4)/bin
|
|
||||||
# PHP_80=$(brew --prefix php@8.0)/bin
|
|
||||||
# PHP_CUR=$(brew --prefix php)/bin
|
|
||||||
BREW_PYTHON=$(brew --prefix python@3.8)/bin
|
BREW_PYTHON=$(brew --prefix python@3.8)/bin
|
||||||
GNUBIN_DIR=$(brew --prefix coreutils)/libexec/gnubin
|
GNUBIN_DIR=$(brew --prefix coreutils)/libexec/gnubin
|
||||||
BREW_RUBY=$(brew --prefix ruby)/bin
|
BREW_RUBY=$(brew --prefix ruby)/bin
|
||||||
@@ -25,8 +16,9 @@ if [ command -v brew &> /dev/null ]; then
|
|||||||
export PATH="$BREW_PYTHON:$GNUBIN_DIR:$BREW_GEMS:$BREW_RUBY:$BREW_BIN:$BREW_SBIN:$PATH"
|
export PATH="$BREW_PYTHON:$GNUBIN_DIR:$BREW_GEMS:$BREW_RUBY:$BREW_BIN:$BREW_SBIN:$PATH"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export PATH="$LOCAL_BIN:$PYTHON_38:$COMPOSER_DIR:$PATH"
|
LOCAL_BIN="$HOME/.local/bin"
|
||||||
export HIST_STAMPS="yyyy-mm-dd"
|
COMPOSER_DIR="$HOME/.composer/vendor/bin"
|
||||||
|
export PATH="$LOCAL_BIN:$COMPOSER_DIR:$PATH"
|
||||||
|
|
||||||
export NVM_DIR="$HOME/.nvm"
|
export NVM_DIR="$HOME/.nvm"
|
||||||
export NVM_LAZY_LOAD=true
|
export NVM_LAZY_LOAD=true
|
||||||
@@ -35,11 +27,22 @@ export NVM_AUTO_USE=true
|
|||||||
[ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && \. "/opt/homebrew/opt/nvm/nvm.sh"
|
[ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && \. "/opt/homebrew/opt/nvm/nvm.sh"
|
||||||
[ -s "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" ] && \. "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm"
|
[ -s "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" ] && \. "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm"
|
||||||
|
|
||||||
[[ -f "$HOME/.dotfiles/alias" ]] && source "$HOME/.dotfiles/alias"
|
# Run x-load-configs in your terminal to reload the files.
|
||||||
[[ -f "$HOME/.dotfiles/alias-$HOSTNAME" ]] && source "$HOME/.dotfiles/alias-$HOSTNAME"
|
function x-load-configs()
|
||||||
|
{
|
||||||
|
# Load the shell dotfiles, and then some:
|
||||||
|
for file in ~/.dotfiles/config/{exports,alias,functions}; do
|
||||||
|
[ -r "$file" ] && [ -f "$file" ] && source "$file"
|
||||||
|
[ -r "$file-$HOSTNAME" ] && [ -f "$file-$HOSTNAME" ] && source "$file-$HOSTNAME"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
x-load-configs
|
||||||
|
|
||||||
|
# Import ssh keys in keychain
|
||||||
|
ssh-add -A 2>/dev/null;
|
||||||
|
|
||||||
# Try to load antigen, if present
|
# Try to load antigen, if present
|
||||||
[[ -f "$HOME/.config/antigen.zsh" ]] && source "$HOME/.config/antigen.zsh"
|
[[ -f "$HOME/.local/bin/antigen.zsh" ]] && source "$HOME/.local/bin/antigen.zsh"
|
||||||
|
|
||||||
# antigen is present
|
# antigen is present
|
||||||
if command -v antigen &> /dev/null; then
|
if command -v antigen &> /dev/null; then
|
||||||
@@ -61,6 +64,7 @@ if command -v antigen &> /dev/null; then
|
|||||||
hash docker 2>/dev/null && antigen bundle docker
|
hash docker 2>/dev/null && antigen bundle docker
|
||||||
|
|
||||||
hash nvm 2>/dev/null && antigen bundle Sparragus/zsh-auto-nvm-use
|
hash nvm 2>/dev/null && antigen bundle Sparragus/zsh-auto-nvm-use
|
||||||
|
hash python 2>/dev/null && antigen bundle MichaelAquilina/zsh-autoswitch-virtualenv
|
||||||
hash jq 2>/dev/null && antigen bundle reegnz/jq-zsh-plugin
|
hash jq 2>/dev/null && antigen bundle reegnz/jq-zsh-plugin
|
||||||
hash docker-compose 2>/dev/null && antigen bundle sroze/docker-compose-zsh-plugin
|
hash docker-compose 2>/dev/null && antigen bundle sroze/docker-compose-zsh-plugin
|
||||||
# antigen bundle voronkovich/phpcs.plugin.zsh
|
# antigen bundle voronkovich/phpcs.plugin.zsh
|
||||||
|
|||||||
Reference in New Issue
Block a user