Compare commits

...

18 Commits

Author SHA1 Message Date
745fc9b737 Moved dotbot plugins to root 2023-03-19 03:32:03 +02:00
dbe5ea3ce0 tweaks, antigen.zsh server version 2023-03-19 02:59:04 +02:00
761671e7f7 dfm: install nvm 2023-03-19 02:57:52 +02:00
f4df8623b0 bin: old scripts 2023-03-19 02:56:54 +02:00
03aacb0639 dotbot: fix glob error in python < v3.5 2023-03-19 02:10:04 +02:00
04c85245cc dfm: starship install dir fix 2023-03-19 01:37:17 +02:00
2ccb74422c configuration fixes 2023-03-19 01:28:28 +02:00
3c87ed4d2b dotbot: config, ifplatform, formatting 2023-03-19 01:14:14 +02:00
4e4ff92ae5 dotbot: config, ifplatform, formatting 2023-03-19 00:52:43 +02:00
ef9bf3864b meta: add dotbot-ifplatform, update astronvim cfg 2023-03-19 00:46:49 +02:00
cfb9aa696e gh: switched gh from ssh to https 2023-03-18 01:51:20 +02:00
1c75e7a53f nvim: updates 2023-03-18 01:10:36 +02:00
6e8875e734 git: brew path to gh 2023-03-17 19:51:09 +02:00
70a9237166 Switched git submodules to https 2023-03-17 19:43:32 +02:00
59b08f8d1f README fixes and ssh/config cleanup 2023-03-17 14:08:59 +02:00
c9bc6e597a host-* to hosts/*, dfm rework, renaming and stuff 2023-03-17 13:37:58 +02:00
5cd720cc4d Moved $HOME root dotfiles to base folder 2023-03-17 10:54:58 +02:00
e618f64cf5 Tweak configurations 2023-03-17 10:34:31 +02:00
43 changed files with 640 additions and 250 deletions

View File

@@ -8,8 +8,9 @@ indent_style = space
insert_final_newline = true insert_final_newline = true
trim_trailing_whitespace = true trim_trailing_whitespace = true
[*.{yaml,yml}] [*.yaml,*.yml]
indent_size = 2 indent_size = 2
insert_final_newline = true
[local/bin/antigen.zsh] [local/bin/antigen.zsh]
ignore = true ignore = true

38
.gitmodules vendored
View File

@@ -1,37 +1,43 @@
[submodule "dotbot"] [submodule "dotbot"]
path = dotbot path = dotbot
url = git@github.com:anishathalye/dotbot.git url = https://github.com/anishathalye/dotbot.git
ignore = dirty ignore = dirty
[submodule "dotbot-plugins/dotbot-brew"] [submodule "dotbot-brew"]
path = dotbot-plugins/dotbot-brew path = dotbot-brew
url = git@github.com:wren/dotbot-brew.git url = https://github.com/wren/dotbot-brew.git
ignore = dirty ignore = dirty
[submodule "dotbot-plugins/dotbot-if"] [submodule "dotbot-if"]
path = dotbot-plugins/dotbot-if path = dotbot-if
url = git@github.com:wonderbeyond/dotbot-if.git url = https://github.com/wonderbeyond/dotbot-if.git
ignore = dirty ignore = dirty
[submodule "dotbot-plugins/dotbot-gh-extension"] [submodule "dotbot-ifplatform"]
path = dotbot-plugins/dotbot-gh-extension path = dotbot-ifplatform
url = git@github.com:fundor333/dotbot-gh-extension.git url = https://github.com/ssbanerje/dotbot-ifplatform.git
ignore = dirty ignore = dirty
[submodule "dotbot-plugins/dotbot-golang"] [submodule "dotbot-gh-extension"]
path = dotbot-plugins/dotbot-golang path = dotbot-gh-extension
url = git@github.com:delicb/dotbot-golang.git url = https://github.com/fundor333/dotbot-gh-extension.git
ignore = dirty
[submodule "dotbot-golang"]
path = dotbot-golang
url = https://github.com/delicb/dotbot-golang.git
ignore = dirty ignore = dirty
[submodule "config/nvim"] [submodule "config/nvim"]
path = config/nvim path = config/nvim
url = git@github.com:AstroNvim/AstroNvim.git url = https://github.com/AstroNvim/AstroNvim.git
ignore = dirty ignore = dirty
branch = nightly branch = main
update = checkout update = checkout
[submodule "config/astronvim/lua/user"] [submodule "config/astronvim/lua/user"]
path = config/astronvim/lua/user path = config/astronvim/lua/user
url = git@github.com:ivuorinen/astronvim_config.git url = https://github.com/ivuorinen/astronvim_config.git
update = rebase update = rebase
branch = main branch = main
ignore = dirty

View File

@@ -13,29 +13,26 @@ fork or download the repo as a zip and go from there with your own configs.
### First time setup ### First time setup
1. Clone this repository to `$HOME/.dotfiles` 1. Clone this repository to `$HOME/.dotfiles`
2. `bash $HOME/.dotfiles/scripts/settler.sh` 2. `./install`
3. ??? 3. ???
4. Profit 4. Profit
Note: there's a bit chicken/egg situation,
because settler assumes you don't have git,
and you need git to clone the repo. This will change soon&trade;.
## Interesting files and locations ## Interesting files and locations
### Interesting folders ### Interesting folders
| Path | Description | | Path | Description |
| ------------------ | --------------------------------------------------- | | ------------------- | -------------------------------------------- |
| `.github` | GitHub Repository configuration files. | | `.github` | GitHub Repository configuration files. |
| `host-{hostname}/` | Configurations that should apply to that host only. | | `hosts/{hostname}/` | Configs that should apply to that host only. |
| `local/bin` | Helper scripts that I've collected or wrote. | | `local/bin` | Helper scripts that I've collected or wrote. |
| `scripts` | Setup scripts. | | `scripts` | Setup scripts. |
### dotfile folders ### dotfile folders
| Repo | Destination | Description | | Repo | Destination | Description |
| --------- | ----------- | ------------------------------------------- | | --------- | ----------- | ------------------------------------------- |
| `base/` | `.*` | `$HOME` level files. |
| `config/` | `.config/` | Configurations for applications. | | `config/` | `.config/` | Configurations for applications. |
| `local/` | `.local/` | XDG Base folder: `bin`, `share` and `state` | | `local/` | `.local/` | XDG Base folder: `bin`, `share` and `state` |
| `ssh/` | `.ssh/` | SSH Configurations. | | `ssh/` | `.ssh/` | SSH Configurations. |
@@ -44,13 +41,6 @@ and you need git to clone the repo. This will change soon&trade;.
`.local/bin/dfm` is a shell script that has some tools that help with dotfiles management. `.local/bin/dfm` is a shell script that has some tools that help with dotfiles management.
### `scripts/install-dotfiles.sh` - dotfiles linker
The `scripts/install-dotfiles.sh` is a `rcm` generated shell script
that does all the necessary linking.
To refresh the file, you can run `dfm dotfiles update`
## Configuration ## Configuration
The folder structure follows [XDG Base Directory Specification][xdg] where possible. The folder structure follows [XDG Base Directory Specification][xdg] where possible.
@@ -59,11 +49,12 @@ The folder structure follows [XDG Base Directory Specification][xdg] where possi
| Var | Default | | Var | Default |
| ------------------ | -------------------- | | ------------------ | -------------------- |
| Executables | `$HOME/.local/bin` |
| `$XDG_DATA_HOME` | `$HOME/.local/share` | | `$XDG_DATA_HOME` | `$HOME/.local/share` |
| `$XDG_STATE_HOME` | `$HOME/.local/state` | | `$XDG_STATE_HOME` | `$HOME/.local/state` |
| `$XDG_CONFIG_HOME` | `$HOME/.config` | | `$XDG_CONFIG_HOME` | `$HOME/.config` |
| `$XDG_BIN_HOME` | `$HOME/.local/bin` |
- `$XDG_BIN_HOME` is a custom `env` for `.local/bin` folder.
- `$XDG_DATA_HOME` defines the base directory relative to which user-specific data - `$XDG_DATA_HOME` defines the base directory relative to which user-specific data
files should be stored. If `$XDG_DATA_HOME` is either not set or empty, files should be stored. If `$XDG_DATA_HOME` is either not set or empty,
a default equal to `$HOME/.local/share` should be used. a default equal to `$HOME/.local/share` should be used.
@@ -95,9 +86,9 @@ The folder structure follows [XDG Base Directory Specification][xdg] where possi
### Interesting dotfiles repos ### Interesting dotfiles repos
- [https://dotfiles.github.io/inspiration/](dotfiles.github.io/inspiration) - [dotfiles.github.io/inspiration/](https://dotfiles.github.io/inspiration)
- [https://github.com/frdmn/dotfiles](github.com/frdmn/dotfiles) - Ansible-based - [frdmn/dotfiles](https://github.com/github.com/frdmn/dotfiles) - Ansible-based
dotfile setup for macOS dotfile setup for macOS
- [https://github.com/mvdan/dotfiles](mvdan/dotfiles) - Here be dragons - [mvdan/dotfiles](https://github.com/mvdan/dotfiles) - Here be dragons
- [https://github.com/vsouza/dotfiles](vsouza/dotfiles) - 🏡 My dotfiles - [vsouza/dotfiles](https://github.com/vsouza/dotfiles) - 🏡 My dotfiles
- [https://github.com/freekmurze/dotfiles](freekmurze/dotfiles) - My personal dotfiles - [freekmurze/dotfiles](https://github.com/freekmurze/dotfiles) - My personal dotfiles

7
add-submodules.sh Normal file
View File

@@ -0,0 +1,7 @@
#!/usr/bin/env bash
git submodule add --name dotbot-brew -f https://github.com/wren/dotbot-brew.git dotbot-brew
git submodule add --name dotbot-gh-extension -f https://github.com/fundor333/dotbot-gh-extension.git dotbot-gh-extension
git submodule add --name dotbot-golang -f https://github.com/delicb/dotbot-golang.git dotbot-golang
git submodule add --name dotbot-if -f https://github.com/wonderbeyond/dotbot-if.git dotbot-if
git submodule add --name dotbot-ifplatform -f https://github.com/ssbanerje/dotbot-ifplatform.git dotbot-ifplatform

113
base/bashrc Normal file
View File

@@ -0,0 +1,113 @@
# shellcheck shell=bash
# Defaults
export DOTFILES="$HOME/.dotfiles"
# Explicitly set XDG folders
# https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
export XDG_DATA_HOME="$HOME/.local/share"
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_STATE_HOME="$HOME/.local/state"
export XDG_BIN_HOME="$HOME/.local/bin" # this one is custom
# Homebrew configuration
export HOMEBREW="/opt/homebrew"
export HOMEBREW_BIN="$HOMEBREW/bin"
export HOMEBREW_SBIN="$HOMEBREW/sbin"
export HOMEBREW_PKG="$HOMEBREW/opt"
export HOMEBREW_NO_ENV_HINTS=1
export PATH="$XDG_BIN_HOME:$HOMEBREW_BIN:$HOMEBREW_SBIN:/usr/local/sbin:$PATH"
# brew, https://brew.sh
if command -v brew &> /dev/null; then
BREW_BIN=$(brew --prefix)/bin
BREW_SBIN=$(brew --prefix)/sbin
BREW_PYTHON=$(brew --prefix python@3.8)/bin
GNUBIN_DIR=$(brew --prefix coreutils)/libexec/gnubin
BREW_RUBY=$(brew --prefix ruby)/bin
BREW_GEMS=$(gem environment gemdir)/bin
export PATH="$BREW_PYTHON:$GNUBIN_DIR:$BREW_GEMS:$BREW_RUBY:$BREW_BIN:$BREW_SBIN:$PATH"
fi
# nvm, the node version manager
export NVM_LAZY_LOAD=true
export NVM_COMPLETION=true
export NVM_AUTO_USE=true
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
# If we have go packages, include them to the PATH
if command -v go &> /dev/null; then
export GOPATH=$(go env GOPATH);
if [ -d "$GOPATH/bin" ]; then
export PATH="$GOPATH/bin:$PATH"
fi
fi
if command -v nvim &> /dev/null; then
export EDITOR="nvim"
fi
# z, https://github.com/rupa/z
export _Z_DATA="$XDG_STATE_HOME/z"
# composer, https://getcomposer.org/
if command -v composer &> /dev/null; then
export COMPOSER_HOME="$XDG_STATE_HOME/composer"
export COMPOSER_BIN="$COMPOSER_HOME/vendor/bin"
export PATH="$COMPOSER_BIN:$PATH"
fi
# gem, rubygems
if command -v gem &>/dev/null; then
export GEM_HOME="$XDG_STATE_HOME/gem"
export GEM_PATH="$XDG_STATE_HOME/gem"
fi
# wakatime, https://github.com/wakatime/wakatime-cli
export WAKATIME_HOME="$XDG_STATE_HOME/wakatime"
# Run x-load-configs in your terminal to reload the files.
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-secret" ] && [ -f "$file-secret" ] && source "$file-secret"
[ -r "$file-$HOSTNAME" ] && [ -f "$file-$HOSTNAME" ] && source "$file-$HOSTNAME"
[ -r "$file-$HOSTNAME-secret" ] && [ -f "$file-$HOSTNAME-secret" ] && source "$file-$HOSTNAME-secret"
done
}
x-load-configs
# Import ssh keys in keychain
ssh-add -A 2>/dev/null;
# op (1Password cli) is present
if hash op 2>/dev/null; then
export OP_CACHE="$XDG_STATE_HOME/1password"
mkdir -p "$OP_CACHE";
eval "$(op completion zsh)"; compdef _op op
fi
# Ansible configuration
# https://docs.ansible.com/ansible/latest/reference_appendices/config.html
if hash ansible 2>/dev/null; then
export ANSIBLE_HOME="$XDG_STATE_HOME/ansible"
mkdir -p "$ANSIBLE_HOME"
fi
# gcloud is present
#if hash gcloud 2>/dev/null; then
# GCLOUD_LOC=$(gcloud info --format="value(installation.sdk_root)" --quiet)
# [[ -f "$GCLOUD_LOC/path.zsh.inc" ]] && builtin source "$GCLOUD_LOC/path.zsh.inc"
# [[ -f "$GCLOUD_LOC/completion.zsh.inc" ]] && builtin source "$GCLOUD_LOC/completion.zsh.inc"
#fi
# Load iterm2 shell integration
# https://iterm2.com/documentation-shell-integration.html
[[ -f "$XDG_BIN_HOME/iterm2_shell_integration.zsh" ]] && source "$XDG_BIN_HOME/iterm2_shell_integration.zsh"

View File

View File

View File

View File

@@ -41,6 +41,7 @@ export NVM_COMPLETION=true
export NVM_AUTO_USE=true export NVM_AUTO_USE=true
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
# If we have go packages, include them to the PATH # If we have go packages, include them to the PATH
if command -v go &> /dev/null; then if command -v go &> /dev/null; then

21
bashrc
View File

@@ -1,21 +0,0 @@
# shellcheck shell=bash
# Fig pre block. Keep at the top of this file.
[[ -f "$HOME/.fig/shell/bashrc.pre.bash" ]] && builtin source "$HOME/.fig/shell/bashrc.pre.bash"
if command -v brew &> /dev/null; then
PHP_PATH=$(brew --prefix php)/bin
export PATH="$PHP_PATH:$HOME/.composer/vendor/bin/:/usr/local/sbin:$PATH"
fi
if command -v nvm &> /dev/null; then
export NVM_DIR="$HOME/.nvm"
[ -s "/usr/local/opt/nvm/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh" # This loads nvm
[ -s "/usr/local/opt/nvm/etc/bash_completion.d/nvm" ] && . "/usr/local/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion
fi
# Fig post block. Keep at the bottom of this file.
[[ -f "$HOME/.fig/shell/bashrc.post.bash" ]] && builtin source "$HOME/.fig/shell/bashrc.post.bash"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion

View File

@@ -1 +1 @@
git_protocol: ssh git_protocol: https

View File

@@ -52,10 +52,4 @@
branch = yellow black bold ul branch = yellow black bold ul
[submodule] [submodule]
recurse = true recurse = true
[credential "https://github.com"]
helper =
helper = !/usr/bin/gh auth git-credential
[credential "https://gist.github.com"]
helper =
helper = !/usr/bin/gh auth git-credential

1
dotbot-ifplatform Submodule

Submodule dotbot-ifplatform added at e35b5c0d71

View File

@@ -1,3 +1,3 @@
# .dotfiles/host-air # .dotfiles/hosts/air
This is my home computer. This is my home computer.

View File

@@ -1,3 +1,3 @@
# .dotfiles/host-v # .dotfiles/hosts/v
This is my work computer. This is my work computer.

View File

@@ -14,9 +14,10 @@ git submodule update --init --recursive
"${BASEDIR}/${DOTBOT_DIR}/${DOTBOT_BIN}" \ "${BASEDIR}/${DOTBOT_DIR}/${DOTBOT_BIN}" \
-d "${BASEDIR}" \ -d "${BASEDIR}" \
--plugin-dir=dotbot-plugins/dotbot-brew \ --plugin-dir=dotbot-brew \
--plugin-dir=dotbot-plugins/dotbot-gh-extension \ --plugin-dir=dotbot-gh-extension \
--plugin-dir=dotbot-plugins/dotbot-golang \ --plugin-dir=dotbot-golang \
--plugin-dir=dotbot-plugins/dotbot-if \ --plugin-dir=dotbot-if \
--plugin-dir=dotbot-ifplatform \
-c "${CONFIG}" \ -c "${CONFIG}" \
"${@}" "${@}"

26
install-without-plugins Executable file
View File

@@ -0,0 +1,26 @@
#!/usr/bin/env bash
set -e
CONFIG="install.conf.yaml"
DOTBOT_DIR="dotbot"
DOTBOT_BIN="bin/dotbot"
BASEDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$BASEDIR"
git submodule sync --quiet --recursive
git submodule update --init --recursive
"${BASEDIR}/${DOTBOT_DIR}/${DOTBOT_BIN}" \
-d "${BASEDIR}" \
-c "${CONFIG}" \
"${@}"
# --plugin-dir=dotbot-plugins/dotbot-brew \
# --plugin-dir=dotbot-plugins/dotbot-gh-extension \
# --plugin-dir=dotbot-plugins/dotbot-golang \
# --plugin-dir=dotbot-plugins/dotbot-if \
# --plugin-dir=dotbot-plugins/dotbot-ifplatform \
# -p dotbot-plugins/dotbot-if/if.py \

View File

@@ -1,13 +1,12 @@
--- ---
- defaults: - defaults:
brew:
stderr: false
stdout: true
brewfile: brewfile:
stderr: true
stdout: true stdout: true
create:
mode: 755
link: link:
create: true create: true
relative: true
relink: true relink: true
- clean: - clean:
@@ -27,72 +26,94 @@
~/Code: ~/Code:
- link: - link:
~/.bashrc:
~/.ecrc:
~/.git_profiles:
~/.huskyrc:
~/.plan:
~/.shellcheckrc:
~/.vuerc:
~/.config/: ~/.config/:
path: config/ glob: true
path: config/*
~/.local/bin/: ~/.local/bin/:
path: local/bin/ glob: true
path: local/bin/*
~/.ssh/: ~/.ssh/:
force: true force: true
glob: true glob: true
mode: 600 mode: 600
path: ssh/** path: ssh/*
~/.zshrc: ~/:
force: true force: true
path: zshrc glob: true
path: base/*
prefix: "."
- if: - shell:
- cond: "[ $(uname) = Darwin ]" - [git submodule update --init --recursive --force]
met: - [bash scripts/install-npm-packages.sh]
- brewfile:
- ifmacos:
- shell:
- [bash scripts/set-macos-defaults.sh]
- brewfile:
- Brewfile - Brewfile
- cond: "[[ $(hostname) = v ]]"
met: # hosts: air
- link: - if:
~/.config/*: - cond: "[[ $(hostname) = air ]]"
force: true met:
glob: true - go:
path: host-v/config/** - github.com/skx/sysbox@latest
- go:
- github.com/delicb/cliware # hosts: v
- github.com/skx/sysbox@latest - if:
- cond: "[[ $(hostname) = lakka ]]" - cond: "[[ $(hostname) = v ]]"
met: met:
- link: - link:
~/.irssi/*: ~/.config/:
force: true glob: true
glob: true force: true
path: host-lakka/irssi/** path: hosts/v/config/**
~/.zshrc*: - go:
force: true - github.com/skx/sysbox@latest
path: host-lakka/zshrc
- cond: "command -v npm" # hosts: lakka
met: - if:
- shell: - cond: "[[ $(hostname) = lakka ]]"
- bash "$HOME/.dotfiles/scripts/install-npm-packages.sh" met:
- link:
~/.irssi/*:
force: true
glob: true
path: hosts/lakka/irssi/**
~/.zshrc:
force: true
path: hosts/lakka/zshrc
# GitHub CLI Extensions # GitHub CLI Extensions
- ghe: - ghe:
- andyfeller/gh-dependency-report # GitHub CLI extension for generating a report on repository dependencies.
- andyfeller/gh-montage - andyfeller/gh-dependency-report
- chelnak/gh-changelog # GitHub CLI extension to generate montage from GitHub user avatars
- davidraviv/gh-clean-branches - andyfeller/gh-montage
- dlvhdr/gh-dash # An opinionated GitHub Cli extension for creating
- einride/gh-dependabot # changelogs that adhere to the keep a changelog specification.
- heaths/gh-label - chelnak/gh-changelog
- hectcastro/gh-metrics # Safely deletes local branches with no upstream and no un-pushed commits
- matt-bartel/gh-clone-org - davidraviv/gh-clean-branches
- rsese/gh-actions-status # A beautiful CLI dashboard for GitHub 🚀
- samcoe/gh-triage - dlvhdr/gh-dash
- stoe/gh-report # GitHub CLI extension for reviewing Dependabot PRs.
- VildMedPap/gh-orgstats - einride/gh-dependabot
- vilmibm/gh-screensaver # A GitHub CLI extension that provides summary pull request metrics.
- vilmibm/gh-user-status - hectcastro/gh-metrics
# A github-cli extension script to clone all repositories
- shell: [git submodule update --init --recursive] # in an organization, optionally filtering by topic.
- matt-bartel/gh-clone-org
# being an extension to view the overall health of
# an organization's use of actions
- rsese/gh-actions-status
- samcoe/gh-triage
# Generate account/organization/enterprise reports
- stoe/gh-report
# Organisation specific extension for gh cli
# to retrieve different statistics
- VildMedPap/gh-orgstats
- vilmibm/gh-screensaver
- vilmibm/gh-user-status
#

View File

@@ -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

View File

@@ -11,6 +11,7 @@
: "${DOTFILES:=$HOME/.dotfiles}" : "${DOTFILES:=$HOME/.dotfiles}"
: "${INSTALL_SCRIPT:=$DOTFILES/scripts/install-dotfiles.sh}" : "${INSTALL_SCRIPT:=$DOTFILES/scripts/install-dotfiles.sh}"
: "${BREWFILE:=$DOTFILES/Brewfile}" : "${BREWFILE:=$DOTFILES/Brewfile}"
: "${HOSTFILES:=$DOTFILES/hosts}"
SCRIPT=$(basename "$0") SCRIPT=$(basename "$0")
@@ -25,30 +26,34 @@ function section_install
all) all)
$0 install antigen $0 install antigen
$0 install starship $0 install starship
$0 install nvm
$0 install macos $0 install macos
$0 install ext_npm $0 install npm
;; ;;
antigen) antigen)
curl -L git.io/antigen > "$DOTFILES/local/bin/antigen.zsh" && msg_done "🎉 New antigen installed!" curl -L git.io/antigen > "$DOTFILES/local/bin/antigen.zsh" && msg_done "🎉 New antigen installed!"
;; ;;
starship) starship)
curl -sS https://starship.rs/install.sh | sh && msg_done "🎉 starship installed!" curl -sS https://starship.rs/install.sh | sh -s -- --bin-dir ~/.local/bin && msg_done "🎉 starship installed!"
;;
nvm)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash && msg_done " ^=^n^i nvm installed!"
;; ;;
macos) macos)
bash "$DOTFILES/scripts/set-macos-defaults.sh" && msg_done "🎉 Brewfile defined apps has been installed!" bash "$DOTFILES/scripts/set-macos-defaults.sh" && msg_done "🎉 Brewfile defined apps has been installed!"
;; ;;
ext_npm) npm)
bash "$DOTFILES/scripts/install-npm-packages.sh" && msg_done "NPM Packages have been installed!" bash "$DOTFILES/scripts/install-npm-packages.sh" && msg_done "NPM Packages have been installed!"
;; ;;
settler) settler)
bash "$DOTFILES/scripts/settler.sh" && msg_done "🎉 Settler has been run!" bash "$DOTFILES/scripts/settler.sh" && msg_done "🎉 Settler has been run!"
;; ;;
*) *)
menu_section "$USAGE_PREFIX" "all | antigen | starship | ext_npm | macos | settler" menu_section "$USAGE_PREFIX" "all | antigen | starship | npm | macos | settler"
menu_item "all" "Installs antigen, macos, brew and ext_gh" menu_item "all" "Installs antigen, macos, brew and ext_gh"
menu_item "antigen" "Updates the antigen.zsh file" menu_item "antigen" "Updates the antigen.zsh file"
menu_item "starship" "Install starship.rs" menu_item "starship" "Install starship.rs"
menu_item "ext_npm" "Install NPM Packages" menu_item "npm" "Install NPM Packages"
menu_item "macos" "Setup nice macOS defaults" menu_item "macos" "Setup nice macOS defaults"
menu_item "settler" "Runs the WIP settler.sh" menu_item "settler" "Runs the WIP settler.sh"
;; ;;
@@ -112,7 +117,7 @@ function section_dotfiles
ln -s ~/.dotfiles/config/astronvim ~/.config/astronvim ln -s ~/.dotfiles/config/astronvim ~/.config/astronvim
ln -s ~/.dotfiles/config/nvim ~/.config/nvim ln -s ~/.dotfiles/config/nvim ~/.config/nvim
msg_ok "Linked nvim and astronvim" msg_ok "Linked nvim and astronvim"
hash npm 2>/dev/null && $0 install ext_npm hash npm 2>/dev/null && $0 install npm
msg_ok "Installed packages" msg_ok "Installed packages"
msg_done "...and we are done!" msg_done "...and we are done!"
;; ;;
@@ -132,6 +137,29 @@ function section_dotfiles
esac esac
} }
function section_check
{
USAGE_PREFIX="$SCRIPT check"
X_HOSTNAME=$(hostname)
X_ARCH=$(uname)
case "$1" in
a|arch)
[[ "$2" = "" ]] && echo "$X_ARCH" && exit 0
[[ $X_ARCH = "$2" ]] && exit 0 || exit 1
;;
h|host|hostname)
[[ "$2" = "" ]] && echo "$X_HOSTNAME" && exit 0
[[ $X_HOSTNAME = "$2" ]] && exit 0 || exit 1
;;
*)
menu_section "$USAGE_PREFIX" "arch | host"
menu_item "arch <arch>" "Empty returns current. Exit code 0 when match, 1 when not."
menu_item "host <host>" "Empty returns current. Exit code 0 when match, 1 when not."
;;
esac
}
# Secret menu for visual tests # Secret menu for visual tests
function section_tests function section_tests
{ {
@@ -160,13 +188,15 @@ function section_tests
function usage function usage
{ {
echo "" echo ""
menu_section "Usage: $SCRIPT" "install | reset | brew | dotfiles" menu_section "Usage: $SCRIPT" "install | reset | brew | check | dotfiles"
echo $" All commands have their own subcommands." echo $" All commands have their own subcommands."
echo "" echo ""
section_install section_install
echo "" echo ""
section_brew section_brew
echo "" echo ""
section_check
echo ""
section_dotfiles section_dotfiles
} }
@@ -174,6 +204,7 @@ function usage
case "$1" in case "$1" in
install) section_install "$2" ;; install) section_install "$2" ;;
brew) section_brew "$2" ;; brew) section_brew "$2" ;;
check) section_check "$2" ;;
dotfiles) section_dotfiles "$2" ;; dotfiles) section_dotfiles "$2" ;;
tests) section_tests "$2" ;; tests) section_tests "$2" ;;
*) usage && exit 0 ;; *) usage && exit 0 ;;

25
local/bin/x-backup-folder.sh Executable file
View File

@@ -0,0 +1,25 @@
#!/usr/bin/env bash
DIRECTORY=$1
FILENAME=$2
if [ -z "${DIRECTORY}" ]; then
echo "DIRECTORY (first argument) is missing"
echo "Usage: $0 folder_to_backup"
exit
fi
if [ -z "${FILENAME}" ]; then
FILENAME=$DIRECTORY
fi
FILENAME=${FILENAME} | \
tr '/' _ | \
iconv -t ascii//TRANSLIT | \
sed -r s/[^a-zA-Z0-9]+/_/g | \
sed -r s/^_+\|-+$//g
TIMESTAMP=$(date "+%Y%m%d_%H%M%S")
FILENAME_TIMESTAMP="${FILENAME}_${TIMESTAMP}"
tar cvzf "${FILENAME_TIMESTAMP}.tar.gz" "${DIRECTORY}/"

166
local/bin/x-git-largest-files.py Executable file
View File

@@ -0,0 +1,166 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Python script to find the largest files in a git repository.
# The general method is based on the script in this blog post:
# http://stubbisms.wordpress.com/2009/07/10/git-script-to-show-largest-pack-objects-and-trim-your-waist-line/
#
# The above script worked for me, but was very slow on my 11GB repository. This version has a bunch
# of changes to speed things up to a more reasonable time. It takes less than a minute on repos with 250K objects.
#
# The MIT License (MIT)
# Copyright (c) 2015 Nick Kocharhook
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
# associated documentation files (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, merge, publish, distribute,
# sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all copies or
# substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
# NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
# OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
from subprocess import check_output, CalledProcessError, Popen, PIPE
import argparse
import signal
import sys
sortByOnDiskSize = False
def main():
global sortByOnDiskSize
signal.signal(signal.SIGINT, signal_handler)
args = parseArguments()
sortByOnDiskSize = args.sortByOnDiskSize
sizeLimit = 1024*args.filesExceeding
if args.filesExceeding > 0:
print "Finding objects larger than {}kB…".format(args.filesExceeding)
else:
print "Finding the {} largest objects…".format(args.matchCount)
blobs = getTopBlobs(args.matchCount, sizeLimit)
populateBlobPaths(blobs)
printOutBlobs(blobs)
def getTopBlobs(count, sizeLimit):
sortColumn = 4
if sortByOnDiskSize:
sortColumn = 3
verifyPack = "git verify-pack -v `git rev-parse --git-dir`/objects/pack/pack-*.idx | grep blob | sort -k{}nr".format(sortColumn)
output = check_output(verifyPack, shell=True).split("\n")[:-1]
blobs = dict()
compareBlob = Blob("a b {} {} c".format(sizeLimit, sizeLimit)) # use __lt__ to do the appropriate comparison
for objLine in output:
blob = Blob(objLine)
if sizeLimit > 0:
if compareBlob < blob:
blobs[blob.sha1] = blob
else:
break
else:
blobs[blob.sha1] = blob
if len(blobs) == count:
break
return blobs
def populateBlobPaths(blobs):
if len(blobs):
print "Finding object paths…"
# Only include revs which have a path. Other revs aren't blobs.
revList = "git rev-list --all --objects | awk '$2 {print}'"
allObjectLines = check_output(revList, shell=True).split("\n")[:-1]
outstandingKeys = blobs.keys()
for line in allObjectLines:
cols = line.split()
sha1, path = cols[0], " ".join(cols[1:])
if (sha1 in outstandingKeys):
outstandingKeys.remove(sha1)
blobs[sha1].path = path
# short-circuit the search if we're done
if not len(outstandingKeys):
break
def printOutBlobs(blobs):
if len(blobs):
csvLines = ["size,pack,hash,path"]
for blob in sorted(blobs.values(), reverse=True):
csvLines.append(blob.csvLine())
p = Popen(["column", "-t", "-s", "','"], stdin=PIPE, stdout=PIPE, stderr=PIPE)
stdout, stderr = p.communicate("\n".join(csvLines)+"\n")
print "\nAll sizes in kB. The pack column is the compressed size of the object inside the pack file.\n"
print stdout.rstrip('\n')
else:
print "No files found which match those criteria."
def parseArguments():
parser = argparse.ArgumentParser(description='List the largest files in a git repository')
parser.add_argument('-c', '--match-count', dest='matchCount', type=int, default=10,
help='The number of files to return. Default is 10. Ignored if --files-exceeding is used.')
parser.add_argument('--files-exceeding', dest='filesExceeding', type=int, default=0,
help='The cutoff amount, in KB. Files with a pack size (or pyhsical size, with -p) larger than this will be printed.')
parser.add_argument('-p', '--physical-sort', dest='sortByOnDiskSize', action='store_true', default=False,
help='Sort by the on-disk size of the files. Default is to sort by the pack size.')
return parser.parse_args()
def signal_handler(signal, frame):
print('Caught Ctrl-C. Exiting.')
sys.exit(0)
class Blob(object):
sha1 = ''
size = 0
packedSize = 0
path = ''
def __init__(self, line):
cols = line.split()
self.sha1, self.size, self.packedSize = cols[0], int(cols[2]), int(cols[3])
def __repr__(self):
return '{} - {} - {} - {}'.format(self.sha1, self.size, self.packedSize, self.path)
def __lt__(self, other):
if (sortByOnDiskSize):
return self.size < other.size
else:
return self.packedSize < other.packedSize
def csvLine(self):
return "{},{},{},{}".format(self.size/1024, self.packedSize/1024, self.sha1, self.path)
# Default function is main()
if __name__ == '__main__':
main()

85
local/bin/x-quota-usage.php Executable file
View File

@@ -0,0 +1,85 @@
#!/usr/bin/env php
<?php
error_reporting(E_ALL);
$debug = false;
$quota = '';
$output = [];
$fsCharLenght = 0;
if ($debug) {
$quota = "Disk quotas for user viir (uid 2913):
Filesystem blocks quota limit grace files quota limit grace
10.0.0.89:/www/webroots/2 8277615 52428800 52428800 0 0 0
10.0.0.179:/users1/users/2 1999431 52428800 52428800 0 0 0
10.0.0.90:/siilo/2 24835106 524288000 524288000 0 0 0";
} else {
// $quota = system("quota -w");
$quota = shell_exec("quota -w");
}
function pad($i, $n = 3, $p = ' ') {
return str_pad($i, $n, $p, STR_PAD_LEFT);
}
if (empty($quota)) {
var_dump($quota);
die("quota was empty\n");
}
$quota = explode("\n", $quota);
$quota = array_map('trim', $quota);
foreach ($quota as $lineNum => $line) {
if ($lineNum < 2) {
continue;
}
$values = array_filter(explode(" ", $line));
if (count($values) != 4) {
continue;
}
$result = array_combine(['fs', 'used', 'quota', 'limit'], $values);
$result['used_percentage'] = round($result['used'] / $result['quota'] * 100, 3);
$result['used_gb'] = round($result['used'] / 1024 / 1024, 2);
$result['quota_gb'] = round($result['quota'] / 1024 / 1024, 2);
$char = strlen($result['fs']);
if ($char > $fsCharLenght) {
$fsCharLenght = $char;
}
$output[] = $result;
}
if (!empty($output)) {
$header = sprintf("%s | %s | %s | %s",
str_pad("Mount", $fsCharLenght),
'Usage%',
'Used/Total',
'Bar'
);
$headerWidth = strlen($header);
echo "\n" . $header . "\n";
echo str_repeat('-', $headerWidth + 24) . "\n";
foreach ($output as $i) {
$barUsed = round($i['used_percentage']) / 4;
echo sprintf(
"%s | %s | %s | [%s]",
str_pad($i['fs'], $fsCharLenght),
str_pad(round($i['used_percentage'], 1) . '%', 6, ' ', STR_PAD_LEFT),
str_pad($i['used_gb'] . '/' . $i['quota_gb'], 10, ' ', STR_PAD_LEFT),
str_pad(str_repeat('#', $barUsed), 25, '_')
) . "\n";
}
echo "\n\n";
}

View File

@@ -1,53 +0,0 @@
#!/usr/bin/env bash
# Install GitHub CLI extensions
#
# shellcheck source="shared.sh"
source "$HOME/.dotfiles/scripts/shared.sh"
if ! command -v gh &> /dev/null; then
msg_run "gh (GitHub Client) could not be found, please install it first"
else
extensions=(
# GitHub CLI extension for reviewing Dependabot PRs.
einride/gh-dependabot
# A GitHub CLI extension that provides summary pull request metrics.
hectcastro/gh-metrics
# being an extension to view the overall health of an organization's use of actions
rsese/gh-actions-status
# GitHub CLI extension for label management
heaths/gh-label
# An opinionated GitHub Cli extension for creating
# changelogs that adhere to the keep a changelog specification.
chelnak/gh-changelog
# Safely deletes local branches with no upstream and no un-pushed commits
davidraviv/gh-clean-branches
# A beautiful CLI dashboard for GitHub 🚀
dlvhdr/gh-dash
# A github-cli extension script to clone all repositories
# in an organization, optionally filtering by topic.
matt-bartel/gh-clone-org
# GitHub CLI extension to generate montage from GitHub user avatars
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
)
msg "Starting to install GitHub CLI extensions..."
for ext in "${extensions[@]}"; do
# Trim spaces
ext=${ext// /}
# Skip comments
if [[ ${ext:0:1} == "#" ]]; then continue; fi
msg_run "Installing $ext"
gh extensions install "$ext"
echo ""
done
msg_ok "Done"
fi

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# #
# Settler - my macOS setup automator # Install XCode CLI Tools with osascript magic.
# Ismo Vuorinen <https://github.com/ivuorinen> 2018 # Ismo Vuorinen <https://github.com/ivuorinen> 2018
# #

View File

@@ -1,16 +1,11 @@
Host github.com Host github.com
User git User git
HostName github.com
IdentityFile ~/.ssh/id_rsa
Host bitbucket.com Host lakka
Hostname bitbucket.com User viir
IdentityFile ~/.ssh/id_rsa HostName lakka.kapsi.fi
IdentityFile ~/.ssh/id_rsa
Host gitlab.com
Hostname gitlab.com
IdentityFile ~/.ssh/id_rsa
Host * Host *
IdentityAgent "~/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock" # IdentityAgent "~/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock"