mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-01-27 22:45:27 +00:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5f5f79d270 | |||
| dcd042262f | |||
| 268fd35bdb | |||
| 38a6f6f8e4 | |||
| d504fc5f2b |
5
.gitmodules
vendored
5
.gitmodules
vendored
@@ -8,11 +8,6 @@
|
||||
url = https://github.com/wren/dotbot-brew.git
|
||||
ignore = dirty
|
||||
|
||||
[submodule "dotbot-gh-extension"]
|
||||
path = dotbot-gh-extension
|
||||
url = https://github.com/fundor333/dotbot-gh-extension.git
|
||||
ignore = dirty
|
||||
|
||||
[submodule "dotbot-include"]
|
||||
path = dotbot-include
|
||||
url = https://gitlab.com/gnfzdz/dotbot-include.git
|
||||
|
||||
1
.yamlfmt
1
.yamlfmt
@@ -22,4 +22,3 @@ exclude:
|
||||
- ./dotbot-*/**
|
||||
- ./config/astronvim/**
|
||||
- ./config/nvim/**
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#!/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-include -f https://gitlab.com/gnfzdz/dotbot-include.git dotbot-include
|
||||
|
||||
14
config/alias
14
config/alias
@@ -52,10 +52,18 @@ if [[ $(uname) == 'Darwin' ]]; then
|
||||
alias emptytrash="sudo rm -rfv /Volumes/*/.Trashes; sudo rm -rfv ~/.Trash; sudo rm -rfv /private/var/log/asl/*.asl"
|
||||
fi
|
||||
|
||||
alias watchx='watch -dpbc' # watch with: differences, precise, beep and color
|
||||
# watch with: differences, precise, beep and color
|
||||
alias watchx='watch -dpbc'
|
||||
# delete .DS_Store files
|
||||
alias zapds='find . -name ".DS_Store" -print -delete'
|
||||
alias t='tail -f' # tail with follow flag on
|
||||
alias dn='du -chd1' # directory usage, return only the total
|
||||
# tail with follow flag on
|
||||
alias t='tail -f'
|
||||
# directory usage, return only the total
|
||||
alias dn='du -chd1'
|
||||
# Mirror site with wget
|
||||
alias mirror_site='wget -m -k -K -E -e robots=off'
|
||||
# Mirror stdout to stderr, useful for seeing data going through a pipe
|
||||
alias peek='tee >(cat 1>&2)'
|
||||
|
||||
alias code_scanner='docker run
|
||||
--env SOURCE_CODE="$PWD"
|
||||
|
||||
@@ -41,4 +41,3 @@ source "$DOTFILES/config/exports-apps"
|
||||
if command -v nvim &> /dev/null; then
|
||||
export EDITOR="nvim"
|
||||
fi
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ if hash ffmpeg 2> /dev/null; then
|
||||
fi
|
||||
|
||||
# gcloud
|
||||
if hash gcloud 2>/dev/null; then
|
||||
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"
|
||||
@@ -103,3 +103,5 @@ export _Z_DATA="$XDG_STATE_HOME/z"
|
||||
# Misc
|
||||
export ANDROID_HOME="$XDG_DATA_HOME/android"
|
||||
export GNUPGHOME="$XDG_DATA_HOME/gnupg"
|
||||
export SCREENRC="$XDG_CONFIG_HOME/misc/screenrc"
|
||||
|
||||
|
||||
@@ -66,6 +66,29 @@ function silent
|
||||
"$@" >&/dev/null
|
||||
}
|
||||
|
||||
# Remove directory from the PATH variable
|
||||
# usage: path_remove ~/.local/bin
|
||||
function path_remove
|
||||
{
|
||||
PATH=$(echo -n "$PATH" | awk -v RS=: -v ORS=: "\$0 != \"$1\"" | sed 's/:$//')
|
||||
}
|
||||
|
||||
# Append directory to the PATH
|
||||
# usage: path_append ~/.local/bin
|
||||
function path_append
|
||||
{
|
||||
path_remove "$1"
|
||||
PATH="${PATH:+"$PATH:"}$1"
|
||||
}
|
||||
|
||||
# Prepend directory to the PATH
|
||||
# usage: path_prepend ~/.local/bin
|
||||
function path_prepend
|
||||
{
|
||||
path_remove "$1"
|
||||
PATH="$1${PATH:+":$PATH"}"
|
||||
}
|
||||
|
||||
# Defines default antigen bundles
|
||||
function x-default-antigen-bundles
|
||||
{
|
||||
@@ -91,4 +114,3 @@ function x-default-antigen-bundles
|
||||
hash python 2> /dev/null && antigen bundle MichaelAquilina/zsh-autoswitch-virtualenv
|
||||
hash rvm 2> /dev/null && antigen bundle unixorn/rvm-plugin
|
||||
}
|
||||
|
||||
|
||||
16
config/misc/screenrc
Normal file
16
config/misc/screenrc
Normal file
@@ -0,0 +1,16 @@
|
||||
# Disable the startup message
|
||||
startup_message off
|
||||
|
||||
# Set a large scrollback buffer
|
||||
defscrollback 32000
|
||||
|
||||
# Always start `screen` with UTF-8 enabled (`screen -U`)
|
||||
defutf8 on
|
||||
|
||||
# Scroll with mouse wheel (http://stackoverflow.com/a/1125947)
|
||||
termcapinfo xterm* ti@:te@
|
||||
|
||||
# Some settings for screen + vim
|
||||
term xterm-256color
|
||||
maptimeout 10
|
||||
|
||||
Submodule config/nvim updated: 291c43b0bd...8d142661f7
Submodule dotbot-gh-extension deleted from 037994ef28
@@ -36,24 +36,3 @@
|
||||
- shell:
|
||||
- git submodule update --init --recursive --force
|
||||
- bash local/bin/dfm install all
|
||||
# GitHub CLI Extensions
|
||||
- ghe:
|
||||
# GitHub CLI extension for generating a report on repository dependencies.
|
||||
- andyfeller/gh-dependency-report
|
||||
# GitHub CLI extension to generate montage from GitHub user avatars
|
||||
- andyfeller/gh-montage
|
||||
# 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
|
||||
# being an extension to view the overall health of
|
||||
# an organization's use of actions
|
||||
- rsese/gh-actions-status
|
||||
|
||||
#
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
|
||||
SCRIPT=$(basename "$0")
|
||||
|
||||
VERSION_NVM="v0.39.3"
|
||||
|
||||
# shellcheck source=./../../scripts/shared.sh
|
||||
source "$DOTFILES/scripts/shared.sh"
|
||||
|
||||
@@ -29,7 +31,10 @@ function section_install
|
||||
$0 install starship
|
||||
$0 brew install
|
||||
$0 install composer
|
||||
$0 install dotenv-linter
|
||||
$0 install dotenv
|
||||
$0 install gh
|
||||
$0 install go
|
||||
$0 install imagick
|
||||
$0 install nvm
|
||||
$0 install npm
|
||||
$0 install ntfy
|
||||
@@ -43,12 +48,24 @@ function section_install
|
||||
bash "$DOTFILES/scripts/install-composer.sh" \
|
||||
&& msg_done "🎉 composer installed!"
|
||||
;;
|
||||
dotenv-linter)
|
||||
dotenv)
|
||||
curl -sSfL \
|
||||
https://raw.githubusercontent.com/dotenv-linter/dotenv-linter/master/install.sh \
|
||||
| sh -s -- -b "$XDG_BIN_HOME" \
|
||||
&& msg_done "🎉 dotenv-linter installed!"
|
||||
;;
|
||||
gh)
|
||||
bash "$DOTFILES/scripts/install-gh-extensions.sh" \
|
||||
&& msg_done "🎉 github cli extensions installed!"
|
||||
;;
|
||||
go)
|
||||
bash "$DOTFILES/scripts/install-go-packages.sh" \
|
||||
&& msg_done "🎉 go packages installed!"
|
||||
;;
|
||||
imagick)
|
||||
wget https://imagemagick.org/archive/binaries/magick > "$XDG_BIN_HOME/magick" \
|
||||
&& msg_done "🎉 imagick installed!"
|
||||
;;
|
||||
starship)
|
||||
curl -sS https://starship.rs/install.sh | sh -s -- --bin-dir ~/.local/bin \
|
||||
&& msg_done "🎉 starship installed!"
|
||||
@@ -58,9 +75,9 @@ function section_install
|
||||
&& msg_done "🎉 Brewfile defined apps has been installed!"
|
||||
;;
|
||||
nvm)
|
||||
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash \
|
||||
&& git checkout "$HOME/.zshrc" \
|
||||
curl -o- "https://raw.githubusercontent.com/nvm-sh/nvm/$VERSION_NVM/install.sh" | bash \
|
||||
&& nvm install --lts --latest-npm --default \
|
||||
&& git checkout "$HOME/.zshrc" \
|
||||
&& msg_done "🎉 nvm installed!"
|
||||
;;
|
||||
npm)
|
||||
@@ -73,14 +90,17 @@ function section_install
|
||||
;;
|
||||
z)
|
||||
bash "$DOTFILES/scripts/install-z.sh" \
|
||||
&& msg_done "🎉 Z has been installed!"
|
||||
&& msg_done "🎉 z has been installed!"
|
||||
;;
|
||||
*)
|
||||
menu_section "$USAGE_PREFIX" "all | antigen | composer | dotenv-linter | starship | macos | nvm | npm"
|
||||
menu_section "$USAGE_PREFIX" "all | antigen | composer | dotenv | gh | go | imagick | starship | macos | nvm | npm"
|
||||
menu_item "all" "Installs macos defaults, antigen, starship, brew, nvm, npm packages and others"
|
||||
menu_item "antigen" "Updates the antigen.zsh file"
|
||||
menu_item "composer" "Install composer"
|
||||
menu_item "dotenv-linter" "Install dotenv-linter"
|
||||
menu_item "dotenv" "Install dotenv-linter"
|
||||
menu_item "gh" "Install GitHub CLI Extensions"
|
||||
menu_item "go" "Install Go Packages"
|
||||
menu_item "imagick" "Install ImageMagick CLI"
|
||||
menu_item "starship" "Install starship.rs"
|
||||
menu_item "macos" "Setup nice macOS defaults"
|
||||
menu_item "nvm" "Install Node Version Manager (nvm)"
|
||||
|
||||
57
local/bin/x-compare-versions.py
Executable file
57
local/bin/x-compare-versions.py
Executable file
@@ -0,0 +1,57 @@
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
Version Comparison tool for the CLI.
|
||||
|
||||
Adapted from script found in anishathalye's dotfiles.
|
||||
https://github.com/anishathalye/dotfiles/blob/master/bin/vercmp
|
||||
"""
|
||||
|
||||
import operator
|
||||
import sys
|
||||
|
||||
from packaging import version
|
||||
|
||||
str_to_operator = {
|
||||
"==": operator.eq,
|
||||
"!=": operator.ne,
|
||||
"<": operator.lt,
|
||||
"<=": operator.le,
|
||||
">": operator.gt,
|
||||
">=": operator.ge,
|
||||
}
|
||||
|
||||
|
||||
def vercmp(expr):
|
||||
"""Version Comparison function."""
|
||||
words = expr.split()
|
||||
comparisons = [words[i: i + 3] for i in range(0, len(words) - 2, 2)]
|
||||
for left, op_str, right in comparisons:
|
||||
compare_op = str_to_operator[op_str]
|
||||
if not compare_op(version.parse(left), version.parse(right)):
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def main():
|
||||
"""Triggers version comparison if line is provided."""
|
||||
for line in sys.stdin:
|
||||
if not vercmp(line):
|
||||
sys.exit(1)
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
def test():
|
||||
"""Basic functionality tests."""
|
||||
assert not vercmp("1.9 >= 2.4")
|
||||
assert vercmp("2.4 >= 2.4")
|
||||
assert vercmp("2.5 >= 2.4")
|
||||
assert vercmp("3 >= 2.999")
|
||||
assert vercmp("2.9 < 2.9a")
|
||||
assert vercmp("2.9a >= 2.8")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) == 2 and sys.argv[1] == "test":
|
||||
test()
|
||||
else:
|
||||
main()
|
||||
@@ -2,10 +2,13 @@
|
||||
# Verify folder exists, and if it does not, create it.
|
||||
|
||||
dir="$1"
|
||||
|
||||
[ $# -eq 0 ] && { echo "Usage: $0 full/path/to/dir/to/create"; exit 1; }
|
||||
|
||||
|
||||
[ $# -eq 0 ] && {
|
||||
echo "Usage: $0 full/path/to/dir/to/create"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [ ! -d "$dir" ]; then
|
||||
mkdir -p "$dir" && exit 0;
|
||||
mkdir -p "$dir" && exit 0
|
||||
fi
|
||||
|
||||
|
||||
5
local/bin/x-ip
Executable file
5
local/bin/x-ip
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# Source: https://github.com/thirtythreeforty/dotfiles/blob/master/bin/extip
|
||||
|
||||
curl icanhazip.com "${@}"
|
||||
|
||||
39
local/bin/x-thumbgen
Executable file
39
local/bin/x-thumbgen
Executable file
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env bash
|
||||
# Generate thumbnails using magick
|
||||
# https://imagemagick.org/script/download.php
|
||||
#
|
||||
# Defaults to current directory creating thumbs with 1000x1000
|
||||
# images with 200px white borders around the original image.
|
||||
#
|
||||
# Defaults can be overridden with ENV variables like this:
|
||||
# $ THMB_BACKGROUND=black x-thumbgen ~/images/
|
||||
#
|
||||
# Created by: Ismo Vuorinen <https://github.com/ivuorinen> 2015
|
||||
|
||||
: "${THMB_SOURCE:=$1}"
|
||||
: "${THMB_BACKGROUND:=white}"
|
||||
: "${THMB_RESIZE:=800x800}"
|
||||
: "${THMB_EXTENT:=1000x1000}"
|
||||
|
||||
[ $# -eq 0 ] && {
|
||||
echo "Usage: $0 /full/path/to/image/folder"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [ "$THMB_SOURCE" == "" ] || [ ! -d "$THMB_SOURCE" ]; then
|
||||
THMB_SOURCE=$(pwd)
|
||||
fi
|
||||
|
||||
if command -v magick &> /dev/null; then
|
||||
|
||||
magick \
|
||||
"$THMB_SOURCE/*" \
|
||||
-resize "$THMB_RESIZE" \
|
||||
-background "$THMB_BACKGROUND" \
|
||||
-gravity center \
|
||||
-extent "$THMB_EXTENT" \
|
||||
-set filename:fname '%t_thumb.%e' +adjoin '%[filename:fname]'
|
||||
|
||||
else
|
||||
echo "magick not found in PATH, https://imagemagick.org/script/download.php"
|
||||
fi
|
||||
44
scripts/install-gh-extensions.sh
Executable file
44
scripts/install-gh-extensions.sh
Executable file
@@ -0,0 +1,44 @@
|
||||
#!/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 generating a report on repository dependencies.
|
||||
andyfeller/gh-dependency-report
|
||||
# GitHub CLI extension to generate montage from GitHub user avatars
|
||||
andyfeller/gh-montage
|
||||
# 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
|
||||
# being an extension to view the overall health of
|
||||
# an organization's use of actions
|
||||
rsese/gh-actions-status
|
||||
)
|
||||
|
||||
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
|
||||
Reference in New Issue
Block a user