Compare commits

...

11 Commits

32 changed files with 433 additions and 196 deletions

1
.gitignore vendored
View File

@@ -13,4 +13,5 @@ ssh/local.d/*
!ssh/local.d/.gitkeep
!.gitkeep
.env
local/share/fonts/NerdFonts

9
.gitmodules vendored
View File

@@ -47,3 +47,12 @@
[submodule "tmux/tmux-window-name"]
path = config/tmux/plugins/tmux-window-name
url = https://github.com/ofirgall/tmux-window-name.git
[submodule "dotbot-crontab"]
path = tools/dotbot-crontab
url = https://github.com/codekansas/dotbot-crontab.git
[submodule "dotbot-snap"]
path = tools/dotbot-snap
url = https://github.com/DrDynamic/dotbot-snap.git
[submodule "dotbot-pip"]
path = tools/dotbot-pip
url = https://github.com/sobolevn/dotbot-pip.git

View File

@@ -19,4 +19,3 @@ include:
exclude:
- ./tools/**
- ./config/nvim/**

View File

@@ -1,9 +1,22 @@
#!/usr/bin/env bash
git submodule add --name dotbot -f https://github.com/anishathalye/dotbot.git tools/dotbot
git submodule add --name dotbot-brew -f https://github.com/wren/dotbot-brew.git tools/dotbot-brew
git submodule add --name dotbot-include -f https://gitlab.com/gnfzdz/dotbot-include.git tools/dotbot-include
git submodule add --name cheat-community -f https://github.com/cheat/cheatsheets.git config/cheat/cheatsheets/community
# dotbot and plugins
git submodule add --name dotbot \
-f https://github.com/anishathalye/dotbot.git tools/dotbot
git submodule add --name dotbot-brew \
-f https://github.com/wren/dotbot-brew.git tools/dotbot-brew
git submodule add --name dotbot-include \
-f https://gitlab.com/gnfzdz/dotbot-include.git tools/dotbot-include
git submodule add --name dotbot-crontab \
-f https://github.com/codekansas/dotbot-crontab.git tools/dotbot-crontab
git submodule add --name dotbot-snap \
-f https://github.com/DrDynamic/dotbot-snap.git tools/dotbot-snap
git submodule add --name dotbot-pip \
-f https://github.com/sobolevn/dotbot-pip.git tools/dotbot-pip
# other repos
git submodule add --name cheat-community \
-f https://github.com/cheat/cheatsheets.git config/cheat/cheatsheets/community
# tmux plugin manager and plugins
git submodule add --name tmux/tpm \

24
base/bashrc Normal file → Executable file
View File

@@ -7,19 +7,27 @@ export DOTFILES="$HOME/.dotfiles"
# 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
HOST="$(hostname -s)"
# Load the shell dotfiles, and then some:
for file in $DOTFILES/config/{exports,alias,functions}; do
[ -r "$file" ] && source "$file"
[ -r "$file-secret" ] && source "$file-secret"
[ -r "$file-$HOST" ] && source "$file-$HOST"
[ -r "$file-$HOST-secret" ] && source "$file-$HOST-secret"
done
# global (exports|alias|functions) file for all hosts
# shellcheck source=../config/exports
[ -r "$file" ] && source "$file"
# global secret file, git ignored
# shellcheck source=../config/exports-secret
[ -r "$file-secret" ] && source "$file-secret"
# host specific (exports|alias|functions) file
# shellcheck source=../config/exports
[ -r "$file-$HOST" ] && source "$file-$HOST"
# host specific (exports|alias|functions) file, git ignored
# shellcheck source=../config/exports
[ -r "$file-$HOST-secret" ] && source "$file-$HOST-secret"
done
}
x-load-configs
# Import ssh keys in keychain
ssh-add -A 2>/dev/null;
ssh-add -A 2> /dev/null
# shellcheck source=../config/fzf/fzf.bash
[ -f "${DOTFILES}/config/fzf/fzf.bash" ] \

4
base/zshrc Normal file → Executable file
View File

@@ -42,8 +42,7 @@ x-dc "$ZSH_CUSTOM_COMPLETION_PATH"
FPATH="$ZSH_CUSTOM_COMPLETION_PATH:$FPATH"
autoload -Uz compinit
if type brew &>/dev/null
then
if type brew &> /dev/null; then
FPATH="$(brew --prefix)/share/zsh/site-functions:${FPATH}"
fi
@@ -70,4 +69,3 @@ have antigen && {
# Start starship
eval "$(starship init zsh)"

View File

@@ -1,3 +1,4 @@
---
# Configuration for Alacritty, the GPU enhanced terminal emulator
# Any items in the `env` entry below will be added as
@@ -40,7 +41,7 @@ font:
normal:
family: JetBrainsMono Nerd Font
# Style can be specified to pick a specific face.
# style: Regular
style: ExtraLight
# The bold font face
bold:
@@ -298,7 +299,6 @@ mouse:
selection:
semantic_escape_chars: ',│`|:"'' ()[]{}<>'
# Shell
#
# You can set shell.program to the path of your favorite shell, e.g. /bin/fish.

View File

@@ -119,6 +119,7 @@ have gem && path_append "$(gem environment gemdir)/bin"
have rbenv && eval "$(rbenv init - zsh)"
# Rust / cargo
export RUSTUP_HOME="$XDG_DATA_HOME/rustup"
export CARGO_HOME="$XDG_DATA_HOME/cargo"
path_append "$CARGO_HOME/bin"

View File

@@ -0,0 +1,19 @@
check_for_updates: true
excluded_labels:
- maintenance
- dependencies
file_name: CHANGELOG.md
logger: spinner
no_color: false
sections:
added:
- feature
- enhancement
changed:
- backwards-incompatible
fixed:
- bug
- bugfix
- documentation
show_unreleased: true
skip_entries_without_label: false

54
config/gh-dash/config.yml Normal file
View File

@@ -0,0 +1,54 @@
prSections:
- title: My Pull Requests
filters: is:open author:@me
- title: Needs My Review
filters: is:open review-requested:@me
- title: Involved
filters: is:open involves:@me -author:@me
issuesSections:
- title: My Issues
filters: is:open author:@me
- title: Assigned
filters: is:open assignee:@me
- title: Involved
filters: is:open involves:@me -author:@me
defaults:
preview:
open: true
width: 50
prsLimit: 20
issuesLimit: 20
view: prs
layout:
prs:
updatedAt:
width: 7
repo:
width: 15
author:
width: 15
assignees:
width: 20
hidden: true
base:
width: 15
hidden: true
lines:
width: 16
issues:
updatedAt:
width: 7
repo:
width: 15
creator:
width: 10
assignees:
width: 20
hidden: true
refetchIntervalMinutes: 30
keybindings:
issues: []
prs: []
repoPaths: {}
pager:
diff: ""

3
config/gh/hosts.yml Normal file
View File

@@ -0,0 +1,3 @@
github.com:
user: ivuorinen
git_protocol: https

View File

@@ -5,3 +5,6 @@
name = Ismo Vuorinen
email = ismo@ivuorinen.net
[include]
path = ~/.config/git/overrides/config

2
config/git/overrides/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
!.gitkeep
config

View File

@@ -18,8 +18,6 @@ tap "xwmx/taps"
brew "act"
# Mozilla CA certificate store
brew "ca-certificates"
# Cryptography and SSL/TLS Toolkit
brew "openssl@3"
# Interpreted, interactive, object-oriented programming language
brew "python@3.11"
# YAML Parser
@@ -104,12 +102,20 @@ brew "dnsmasq"
brew "dog"
# Lightning-fast linter for .env files written in Rust
brew "dotenv-linter"
# Tool to verify that your files are in harmony with your .editorconfig
brew "editorconfig-checker"
# Useful examples at the command-line
brew "eg-examples"
# OpenType text shaping engine
brew "harfbuzz"
# Development kit for the Java programming language
brew "openjdk"
# Run arbitrary commands when files change
brew "entr"
# Perl lib for reading and writing EXIF metadata
brew "exiftool"
# Simple, fast and user-friendly alternative to find
brew "fd"
# Banner-like program prints strings as ASCII art
brew "figlet"
# Libraries to talk to Microsoft SQL Server and Sybase databases
@@ -152,8 +158,6 @@ brew "gpgme"
brew "gpg-tui"
# Image manipulation
brew "netpbm"
# OpenType text shaping engine
brew "harfbuzz"
# Framework for layout and rendering of i18n text
brew "pango"
# Library to render SVG files using Cairo
@@ -208,8 +212,6 @@ brew "nvm"
brew "openjdk@11"
# Generate clients, server & docs from an OpenAPI spec (v2, v3)
brew "openapi-generator"
# Development kit for the Java programming language
brew "openjdk"
# Swiss-army knife of markup format conversion
brew "pandoc"
# Highly capable, feature-rich programming language
@@ -416,6 +418,7 @@ mas "Keynote", id: 409183694
mas "LastPass", id: 926036361
mas "Numbers", id: 409203825
mas "Pages", id: 409201541
mas "Pixelmator Pro", id: 1289583905
mas "Tailscale", id: 1475387142
mas "Xcode", id: 497799835
vscode "akamud.vscode-theme-onelight"
@@ -485,6 +488,7 @@ vscode "Vue.volar"
vscode "Vue.vscode-typescript-vue-plugin"
vscode "WakaTime.vscode-wakatime"
vscode "wix.vscode-import-cost"
vscode "XadillaX.viml"
vscode "xdebug.php-debug"
vscode "xdebug.php-pack"
vscode "yinfei.luahelper"

View File

@@ -1,12 +1,12 @@
{
"LazyVim": { "branch": "main", "commit": "a72a84972d85e5bbc6b9d60a0983b37efef21b8a" },
"LuaSnip": { "branch": "master", "commit": "8efa4e402a24df6a4713a2ec653147c49e8f73de" },
"LuaSnip": { "branch": "master", "commit": "1fd22fa96c11573248f9fdd09f25e724c7bb3dd4" },
"SchemaStore.nvim": { "branch": "main", "commit": "d2a3d1da007549c921f7b0e22521d1c20d09c8a7" },
"alpha-nvim": { "branch": "main", "commit": "234822140b265ec4ba3203e3e0be0e0bb826dff5" },
"animation.nvim": { "branch": "main", "commit": "fb77091ab72ec9971aee0562e7081182527aaa6a" },
"bufdelete.nvim": { "branch": "master", "commit": "07d1f8ba79dec59d42b975a4df1c732b2e4e37b4" },
"bufferline.nvim": { "branch": "main", "commit": "6ecd37e0fa8b156099daedd2191130e083fb1490" },
"catppuccin": { "branch": "main", "commit": "85e93601e0f0b48aa2c6bbfae4d0e9d7a1898280" },
"catppuccin": { "branch": "main", "commit": "3d9a5ed556e289bce6c1fb0af89ec838360641b2" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
@@ -16,7 +16,7 @@
"edgy.nvim": { "branch": "main", "commit": "4ccc1c67ae2b1a0c55f18c83d03b714e2bb1bae4" },
"flash.nvim": { "branch": "main", "commit": "cc8c7e03987134997d74ee87e55a5717279f2d05" },
"friendly-snippets": { "branch": "main", "commit": "ebf6d6e83494cdd88a54a429340256f4dbb6a052" },
"gitsigns.nvim": { "branch": "main", "commit": "bce4576a9047085a528c479a7fe1e2f6b787b6c1" },
"gitsigns.nvim": { "branch": "main", "commit": "bdeba1cec3faddd89146690c10b9a87949c0ee66" },
"harpoon": { "branch": "master", "commit": "21f4c47c6803d64ddb934a5b314dcb1b8e7365dc" },
"indent-blankline.nvim": { "branch": "master", "commit": "9637670896b68805430e2f72cf5d16be5b97a22a" },
"lazy.nvim": { "branch": "main", "commit": "3ad55ae678876516156cca2f361c51f7952a924b" },
@@ -25,36 +25,36 @@
"mason.nvim": { "branch": "main", "commit": "d66c60e17dd6fd8165194b1d14d21f7eb2c1697a" },
"middleclass": { "branch": "master", "commit": "9fab4d5bca67262614960960ca35c4740eb2be2c" },
"mini.ai": { "branch": "main", "commit": "7ae226f331885e6f30e9a8229e113debc59308ae" },
"mini.animate": { "branch": "main", "commit": "230140aa0b06af87c9d345573aab1aaf50d8b539" },
"mini.animate": { "branch": "main", "commit": "989ac014933ab5cd14ab83f2fce4b9a08ca6d81e" },
"mini.bufremove": { "branch": "main", "commit": "7821606e35c1ac931b56d8e3155f45ffe76ee7e5" },
"mini.comment": { "branch": "main", "commit": "877acea5b2a32ff55f808fc0ebe9aa898648318c" },
"mini.indentscope": { "branch": "main", "commit": "f60e9b51a6214c73a170ffc5445ce91560981031" },
"mini.pairs": { "branch": "main", "commit": "dfa9f6e2576bb8853be277d96b735af59d9be7c2" },
"mini.surround": { "branch": "main", "commit": "9d1956b576d7051da3a483b251dfc778121c60db" },
"neo-tree.nvim": { "branch": "v3.x", "commit": "2d89ca96e08eb6e9c8e50e1bb4738bc5125c9f12" },
"neoconf.nvim": { "branch": "main", "commit": "b7cde4ba41eabf9bec9464c990bcf84a0fef4526" },
"neodev.nvim": { "branch": "main", "commit": "e9dd1535759794635a951644c183beb327879407" },
"neo-tree.nvim": { "branch": "v3.x", "commit": "71f1841ba6c652908678cece623f52c1fea8a6cd" },
"neoconf.nvim": { "branch": "main", "commit": "360805250fe45391d30b96b6640d03e2c35597ee" },
"neodev.nvim": { "branch": "main", "commit": "ddf29935af5a510307850919d6772ea6a4e2c008" },
"neogen": { "branch": "main", "commit": "cb1f384df804c1bf729332c4f728253fe17962d4" },
"noice.nvim": { "branch": "main", "commit": "74c2902146b080035beb19944baf6f014a954720" },
"nui.nvim": { "branch": "main", "commit": "c8de23342caf8d50b15d6b28368d36a56a69d76f" },
"null-ls.nvim": { "branch": "main", "commit": "0010ea927ab7c09ef0ce9bf28c2b573fc302f5a7" },
"nvim-cmp": { "branch": "main", "commit": "5dce1b778b85c717f6614e3f4da45e9f19f54435" },
"nvim-lspconfig": { "branch": "master", "commit": "4266f9bb36b4fb09edd19b67d95043cf7ff88ddf" },
"nvim-lspconfig": { "branch": "master", "commit": "ede4114e1fd41acb121c70a27e1b026ac68c42d6" },
"nvim-navic": { "branch": "master", "commit": "0ffa7ffe6588f3417e680439872f5049e38a24db" },
"nvim-notify": { "branch": "master", "commit": "94859430020f5cf32a1b97ddd9e596fed9db7981" },
"nvim-regexplainer": { "branch": "main", "commit": "4250c8f3c1307876384e70eeedde5149249e154f" },
"nvim-spectre": { "branch": "master", "commit": "97cfd1b0f5a6ab35979ce1bee6c17f54745fd1e5" },
"nvim-treesitter": { "branch": "master", "commit": "b7f2dd5dfbd24a1239844e15637b637b990df164" },
"nvim-treesitter": { "branch": "master", "commit": "0960322686bfa38afd4f1e0b9660473cf77e24b6" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "bd103502252027434ec42f628d2dbf54821d4ce6" },
"nvim-ts-context-commentstring": { "branch": "main", "commit": "95e9ba9de4289d221666b66fd930d157c7ca08c6" },
"nvim-ufo": { "branch": "main", "commit": "16c730dbb89befa437775f0c430a9ff62d67a0cd" },
"nvim-web-devicons": { "branch": "master", "commit": "973ab742f143a796a779af4d786ec409116a0d87" },
"nvim-ufo": { "branch": "main", "commit": "6f2ccdf2da390d62f8f9e15fc5ddbcbd312e1e66" },
"nvim-web-devicons": { "branch": "master", "commit": "480a756df82a0c231622c9bf2173bb6634713716" },
"persistence.nvim": { "branch": "main", "commit": "4b8051c01f696d8849a5cb8afa9767be8db16e40" },
"plenary.nvim": { "branch": "master", "commit": "9ce85b0f7dcfe5358c0be937ad23e456907d410b" },
"promise-async": { "branch": "main", "commit": "e94f35161b8c5d4a4ca3b6ff93dd073eb9214c0e" },
"stickybuf.nvim": { "branch": "master", "commit": "e3db41f2c1bb2df3ee6ff964ee74fe991f6f9566" },
"tailwindcss-colorizer-cmp.nvim": { "branch": "main", "commit": "bc25c56083939f274edcfe395c6ff7de23b67c50" },
"telescope.nvim": { "branch": "master", "commit": "40c8d2fc2b729dd442eda093cf8c9496d6e23732" },
"telescope.nvim": { "branch": "master", "commit": "ed9574dd6dde143d009b2528ea6d79bd34bbe6c8" },
"todo-comments.nvim": { "branch": "main", "commit": "3094ead8edfa9040de2421deddec55d3762f64d1" },
"tokyonight.nvim": { "branch": "main", "commit": "9a01eada39558dc3243278e6805d90e8dff45dc0" },
"transparent.nvim": { "branch": "main", "commit": "3af6232c8d39d51062702e875ff6407c1eeb0391" },

View File

@@ -148,3 +148,6 @@ version_format = '${major}.${minor}'
symbol = " "
format = "[$virtualenv]($style) "
[username]
format = "[$user]($style) "

View File

@@ -137,6 +137,7 @@ set -g @continuum-boot 'on'
## https://github.com/tmux-plugins/tmux-resurrect
set -g @resurrect-strategy-nvim 'session'
set -g @resurrect-dir '$HOME/.local/state/tmux/tmux-resurrect'
# Finally run the tmux plugin manager
run '~/.dotfiles/config/tmux/plugins/tpm/tpm'

View File

@@ -1,8 +1,6 @@
- include: "tools/dotbot-defaults.yaml"
- shell:
- echo "Configuring v"
- brewfile:
- Brewfile
- link:
~/:
force: true

View File

@@ -18,6 +18,9 @@ git submodule update --init --recursive "${DOTBOT_DIR}"
-d "${BASEDIR}" \
--plugin-dir=tools/dotbot-brew \
--plugin-dir=tools/dotbot-include \
--plugin-dir=tools/dotbot-crontab \
--plugin-dir=tools/dotbot-snap \
--plugin-dir=tools/dotbot-pip \
-c "${CONFIG}" \
"${@}"
@@ -30,6 +33,9 @@ if [ "${DOTBOT_HOST}" != "" ]; then
-d "$BASEDIR" \
--plugin-dir=tools/dotbot-brew \
--plugin-dir=tools/dotbot-include \
--plugin-dir=tools/dotbot-crontab \
--plugin-dir=tools/dotbot-snap \
--plugin-dir=tools/dotbot-pip \
-c "$DOTBOT_HOST_CONFIG" \
"${@}"
fi

View File

@@ -5,36 +5,66 @@
recursive: true
~/.local:
recursive: true
~/.ssh:
recursive: true
- create:
~/.cache:
~/.cache/git:
~/.config:
~/.config/cheat/cheatsheets/personal:
~/.config/cheat/cheatsheets/pure-bash-bible:
~/.config/cheat/cheatsheets/tldr:
~/.local:
~/.local/bin:
~/.local/run:
~/.local/share:
~/.local/state:
~/.ssh:
mode: 0700
~/.ssh/local.d:
mode: 0700
~/Code:
- link:
~/:
force: true
glob: true
path: base/**
path: base/*
prefix: "."
~/.config/:
glob: true
path: config/**
~/.local/:
relink: true
path: config/*
exclude: [config/nvm]
~/.config/nvm/default-packages:
create: true
relink: true
path: config/nvm/default-packages
~/.local/bin:
glob: true
path: local/**
path: local/bin/*
~/.local/man:
glob: true
path: local/man/**
~/.local/share:
glob: true
path: local/share/*
~/.ssh/:
glob: true
mode: 0600
path: ssh/**
path: ssh/*
- shell:
- git submodule update --init --recursive --force
- bash local/bin/dfm install all
- pipx:
file: tools/requirements-pipx.txt
stdout: false
stderr: true
- crontab:
- time: 0 5 * * *
command: brew update && brew upgrade
platform: darwin # Optional
- time: 0 5 * * *
command: apt update && apt upgrade
platform: linux # Optional
- time: 0 5 * * *
command: task sync
- snap:
- nvim:
classic: true

View File

@@ -32,6 +32,7 @@ function section_install
"cheat-databases:Install cheat external cheatsheet databases"
"composer:Install composer"
"dotenv:Install dotenv-linter"
"fonts:Install programming fonts"
"gh:Install GitHub CLI Extensions"
"go:Install Go Packages"
"imagick:Install ImageMagick CLI"
@@ -48,6 +49,7 @@ function section_install
case "$1" in
all)
$0 install macos
$0 install fonts
$0 install antigen
$0 brew install
$0 install pip
@@ -89,6 +91,10 @@ function section_install
| sh -s -- -b "$XDG_BIN_HOME" \
&& msg_yay "dotenv-linter installed!"
;;
fonts)
bash "$DOTFILES/scripts/install-fonts.sh" \
&& msg_yay "Installed fonts!"
;;
fzf)
bash "$DOTFILES/scripts/install-fzf.sh" \
&& msg_yay "fzf installed!"
@@ -244,10 +250,8 @@ function section_dotfiles
~/.local/share/nvim \
~/.local/state/nvim \
~/.cache/nvim \
~/.config/astronvim \
~/.config/nvim
msg_ok "Deleted old nvim files"
ln -s "$DOTFILES/config/astronvim" ~/.config/astronvim
msg_ok "Deleted old nvim files (share, state and cache + config)"
ln -s "$DOTFILES/config/nvim" ~/.config/nvim
msg_ok "Linked nvim and astronvim"
have npm && $0 install npm

View File

@@ -1,136 +1,195 @@
#!/usr/bin/python
#!/usr/bin/env 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 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
# Copyright (c) 2023 Ismo Vuorinen
#
# 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
# 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 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.
# 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.
# vim:tw=120:ts=4:ft=python:norl:
from subprocess import check_output, CalledProcessError, Popen, PIPE
from subprocess import check_output, Popen, PIPE
import argparse
import signal
import sys
sortByOnDiskSize = False
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 csv_line(self):
return "{},{},{},{}".format(
self.size/1024, self.packedSize/1024, self.sha1, self.path)
def main():
global sortByOnDiskSize
global sortByOnDiskSize
signal.signal(signal.SIGINT, signal_handler)
args = parseArguments()
sortByOnDiskSize = args.sortByOnDiskSize
sizeLimit = 1024*args.filesExceeding
signal.signal(signal.SIGINT, signal_handler)
if args.filesExceeding > 0:
print "Finding objects larger than {}kB…".format(args.filesExceeding)
else:
print "Finding the {} largest objects…".format(args.matchCount)
args = parse_arguments()
sortByOnDiskSize = args.sortByOnDiskSize
sizeLimit = 1024*args.filesExceeding
blobs = getTopBlobs(args.matchCount, sizeLimit)
if args.filesExceeding > 0:
print("Finding objects larger than {}kB…".format(args.filesExceeding))
else:
print("Finding the {} largest objects…".format(args.matchCount))
populateBlobPaths(blobs)
printOutBlobs(blobs)
blobs = get_top_blobs(args.matchCount, sizeLimit)
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
populate_blob_paths(blobs)
print_out_blobs(blobs)
def populateBlobPaths(blobs):
if len(blobs):
print "Finding object paths…"
def get_top_blobs(count, sizeLimit):
"""Get top blobs from git repository
# 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]
Args:
count (int): How many items to return
sizeLimit (int): What is the size limit
outstandingKeys = blobs.keys()
Returns:
dict: Dictionary of Blobs
"""
sortColumn = 4
for line in allObjectLines:
cols = line.split()
sha1, path = cols[0], " ".join(cols[1:])
if sortByOnDiskSize:
sortColumn = 3
if (sha1 in outstandingKeys):
outstandingKeys.remove(sha1)
blobs[sha1].path = path
verifyPack = "git verify-pack -v `git rev-parse --git-dir`/objects/pack/pack-*.idx | grep blob | sort -k{}nr".format(sortColumn) # noqa: E501
output = check_output(verifyPack, shell=True).decode('utf-8').strip().split("\n")[:-1] # noqa: E501
# short-circuit the search if we're done
if not len(outstandingKeys):
break
blobs = dict()
# use __lt__ to do the appropriate comparison
compareBlob = Blob("a b {} {} c".format(sizeLimit, sizeLimit))
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 printOutBlobs(blobs):
if len(blobs):
csvLines = ["size,pack,hash,path"]
def populate_blob_paths(blobs):
"""Populate blob paths that only have a path
for blob in sorted(blobs.values(), reverse=True):
csvLines.append(blob.csvLine())
Args:
blobs (Blob, dict): Dictionary of Blobs
"""
if len(blobs):
print("Finding object paths…")
p = Popen(["column", "-t", "-s", "','"], stdin=PIPE, stdout=PIPE, stderr=PIPE)
stdout, stderr = p.communicate("\n".join(csvLines)+"\n")
# Only include revs which have a path. Other revs aren't blobs.
revList = "git rev-list --all --objects | awk '$2 {print}'"
all_object_lines = check_output(revList, shell=True).decode('utf-8').strip().split("\n")[:-1] # noqa: E501
outstanding_keys = list(blobs.keys())
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."
for line in all_object_lines:
cols = line.split()
sha1, path = cols[0], " ".join(cols[1:])
if (sha1 in outstanding_keys):
outstanding_keys.remove(sha1)
blobs[sha1].path = path
# short-circuit the search if we're done
if not len(outstanding_keys):
break
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.')
def print_out_blobs(blobs):
if len(blobs):
csvLines = ["size,pack,hash,path"]
return parser.parse_args()
for blob in sorted(blobs.values(), reverse=True):
csvLines.append(blob.csv_line())
command = ["column", "-t", "-s", ","]
p = Popen(command, stdin=PIPE, stdout=PIPE, stderr=PIPE)
# Encode the input as bytes
input_data = ("\n".join(csvLines) + "\n").encode()
stdout, _ = p.communicate(input_data)
print("\nAll sizes in kB. The pack column is the compressed size of the object inside the pack file.\n") # noqa: E501
print(stdout.decode("utf-8").rstrip('\n'))
else:
print("No files found which match those criteria.")
def parse_arguments():
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='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 physical size, with -p) larger than this will be printed.' # noqa: E501
)
parser.add_argument(
'-p', '--physical-sort', dest='sortByOnDiskSize',
action='store_true', default=False,
help='Sort by the on-disk size. Default is to sort by the pack size.'
)
return parser.parse_args()
def signal_handler(signal, frame):
@@ -138,29 +197,6 @@ def signal_handler(signal, frame):
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()
main()

View File

@@ -16,21 +16,22 @@ COLOR_S='\033[0;36m'
RESET='\033[0m'
# Print time-based personalized message, using figlet & lolcat if availible
function welcome_greeting () {
function welcome_greeting()
{
h=$(date +%H)
if [ "$h" -lt 04 ] || [ "$h" -gt 22 ];
then greeting="Good Night"
elif [ "$h" -lt 12 ];
then greeting="Good morning"
elif [ "$h" -lt 18 ];
then greeting="Good afternoon"
elif [ "$h" -lt 22 ];
then greeting="Good evening"
if [ "$h" -lt 04 ] || [ "$h" -gt 22 ]; then
greeting="Good Night"
elif [ "$h" -lt 12 ]; then
greeting="Good morning"
elif [ "$h" -lt 18 ]; then
greeting="Good afternoon"
elif [ "$h" -lt 22 ]; then
greeting="Good evening"
else
greeting="Hello"
fi
WELCOME_MSG="$greeting $USER!"
if hash lolcat 2>/dev/null && hash figlet 2>/dev/null; then
if hash lolcat 2> /dev/null && hash figlet 2> /dev/null; then
echo "${WELCOME_MSG}" | figlet | lolcat
else
echo -e "$COLOR_P${WELCOME_MSG}${RESET}\n"
@@ -38,8 +39,9 @@ function welcome_greeting () {
}
# Print system information with neofetch, if it's installed
function welcome_sysinfo () {
if hash neofetch 2>/dev/null; then
function welcome_sysinfo()
{
if hash neofetch 2> /dev/null; then
neofetch --shell_version off \
--disable kernel distro shell resolution cpu gpu de wm wm_theme theme icons terminal \
--backend off \
@@ -50,7 +52,8 @@ function welcome_sysinfo () {
}
# Print todays info: Date, IP, weather, etc
function welcome_today () {
function welcome_today()
{
timeout=1
echo -e "\033[1;34mToday\n------"
@@ -62,7 +65,7 @@ function welcome_today () {
echo -e "${RESET}"
# Print IP address
if hash ip 2>/dev/null; then
if hash ip 2> /dev/null; then
ip_address=$(ip route get 8.8.8.8 | awk -F"src " 'NR==1{split($2,a," ");print a[1]}')
ip_interface=$(ip route get 8.8.8.8 | awk -F"dev " 'NR==1{split($2,a," ");print a[1]}')
echo -e "${COLOR_S}🌐 IP: $(curl -s -m $timeout 'https://ipinfo.io/ip') (${ip_address} on ${ip_interface})"
@@ -71,23 +74,11 @@ function welcome_today () {
}
# Putting it all together
function welcome() {
function welcome()
{
welcome_greeting
welcome_sysinfo
welcome_today
}
# Determine if file is being run directly or sourced
([[ -n $ZSH_EVAL_CONTEXT && $ZSH_EVAL_CONTEXT =~ :file$ ]] \
|| [[ -n $KSH_VERSION && $(cd "$(dirname -- "$0")" \
&& printf '%s' "${PWD%/}/")$(basename -- "$0") != "${.sh.file}" ]] \
|| [[ -n $BASH_VERSION ]] && (return 0 2>/dev/null)
) && sourced=1 || sourced=0
# If script being called directly run immediately
if [ "$sourced" -eq 0 ]; then
welcome "$@"
fi
# EOF
welcome "$@"

View File

@@ -6,7 +6,7 @@ source "$HOME/.dotfiles/scripts/shared.sh"
! have cargo && {
msg "cargo could not be found. installing cargo with rustup.rs"
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --no-modify-path
}
packages=(
@@ -18,6 +18,9 @@ packages=(
"eza"
# A simple, fast and user-friendly alternative to 'find'
"fd-find"
"cargo-update"
"pijul"
"ripgrep"
)
for pkg in "${packages[@]}"; do
@@ -26,7 +29,8 @@ for pkg in "${packages[@]}"; do
# Skip comments
if [[ ${pkg:0:1} == "#" ]]; then continue; fi
cargo install $pkg
msg_run "Installing cargo package $pkg"
cargo install "$pkg"
echo ""
done

44
scripts/install-fonts.sh Executable file
View File

@@ -0,0 +1,44 @@
#!/usr/bin/env bash
# Install NerdFonts
#
# shellcheck source="shared.sh"
source "$HOME/.dotfiles/scripts/shared.sh"
GIT_REPO="https://github.com/ryanoasis/nerd-fonts.git"
TMP_PATH="$XDG_CACHE_HOME/nerd-fonts"
msg "-- NerdFonts --"
fonts=(
Hack
IntelOneMono
JetBrainsMono
OpenDyslexic
SpaceMono
)
if [ ! -d "$TMP_PATH" ]; then
git clone --filter=blob:none --sparse "$GIT_REPO" "$TMP_PATH"
fi
cd "$TMP_PATH" || {
msg_err "No such folder $TMP_PATH"
exit 1
}
for ext in "${fonts[@]}"; do
# Trim spaces
ext=${ext// /}
# Skip comments
if [[ ${ext:0:1} == "#" ]]; then continue; fi
msg_run "Adding $ext to sparse-checkout"
git sparse-checkout add "patched-fonts/$ext"
echo ""
done
msg "Starting to install NerdFonts..."
./install.sh -s ${fonts[*]}
msg_ok "Done"

View File

@@ -9,6 +9,7 @@ source "$HOME/.dotfiles/scripts/shared.sh"
}
packages=(
"pipx"
"libtmux"
)
@@ -18,7 +19,7 @@ for pkg in "${packages[@]}"; do
# Skip comments
if [[ ${pkg:0:1} == "#" ]]; then continue; fi
python3 -m pip install --user $pkg
python3 -m pip install --user "$pkg"
echo ""
done

1
tools/dotbot-crontab Submodule

Submodule tools/dotbot-crontab added at ea900a7cf6

1
tools/dotbot-pip Submodule

Submodule tools/dotbot-pip added at 42e6a8f3be

1
tools/dotbot-snap Submodule

Submodule tools/dotbot-snap added at 5722c4e5af

View File

@@ -0,0 +1,2 @@
openapi-python-client
libtmux