Compare commits

...

9 Commits

30 changed files with 418 additions and 184 deletions

1
.gitignore vendored
View File

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

9
.gitmodules vendored
View File

@@ -47,3 +47,12 @@
[submodule "tmux/tmux-window-name"] [submodule "tmux/tmux-window-name"]
path = config/tmux/plugins/tmux-window-name path = config/tmux/plugins/tmux-window-name
url = https://github.com/ofirgall/tmux-window-name.git 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: exclude:
- ./tools/** - ./tools/**
- ./config/nvim/**

View File

@@ -1,9 +1,22 @@
#!/usr/bin/env bash #!/usr/bin/env bash
git submodule add --name dotbot -f https://github.com/anishathalye/dotbot.git tools/dotbot # dotbot and plugins
git submodule add --name dotbot-brew -f https://github.com/wren/dotbot-brew.git tools/dotbot-brew git submodule add --name dotbot \
git submodule add --name dotbot-include -f https://gitlab.com/gnfzdz/dotbot-include.git tools/dotbot-include -f https://github.com/anishathalye/dotbot.git tools/dotbot
git submodule add --name cheat-community -f https://github.com/cheat/cheatsheets.git config/cheat/cheatsheets/community 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 # tmux plugin manager and plugins
git submodule add --name tmux/tpm \ 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. # Run x-load-configs in your terminal to reload the files.
function x-load-configs() function x-load-configs()
{ {
# Load the shell dotfiles, and then some:
for file in $DOTFILES/config/{exports,alias,functions}; do
HOST="$(hostname -s)" HOST="$(hostname -s)"
# Load the shell dotfiles, and then some: # global (exports|alias|functions) file for all hosts
for file in $DOTFILES/config/{exports,alias,functions}; do # shellcheck source=../config/exports
[ -r "$file" ] && source "$file" [ -r "$file" ] && source "$file"
[ -r "$file-secret" ] && source "$file-secret" # global secret file, git ignored
[ -r "$file-$HOST" ] && source "$file-$HOST" # shellcheck source=../config/exports-secret
[ -r "$file-$HOST-secret" ] && source "$file-$HOST-secret" [ -r "$file-secret" ] && source "$file-secret"
done # 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 x-load-configs
# Import ssh keys in keychain # Import ssh keys in keychain
ssh-add -A 2>/dev/null; ssh-add -A 2> /dev/null
# shellcheck source=../config/fzf/fzf.bash # shellcheck source=../config/fzf/fzf.bash
[ -f "${DOTFILES}/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" FPATH="$ZSH_CUSTOM_COMPLETION_PATH:$FPATH"
autoload -Uz compinit autoload -Uz compinit
if type brew &>/dev/null if type brew &> /dev/null; then
then
FPATH="$(brew --prefix)/share/zsh/site-functions:${FPATH}" FPATH="$(brew --prefix)/share/zsh/site-functions:${FPATH}"
fi fi
@@ -70,4 +69,3 @@ have antigen && {
# Start starship # Start starship
eval "$(starship init zsh)" eval "$(starship init zsh)"

View File

@@ -1,3 +1,4 @@
---
# Configuration for Alacritty, the GPU enhanced terminal emulator # Configuration for Alacritty, the GPU enhanced terminal emulator
# Any items in the `env` entry below will be added as # Any items in the `env` entry below will be added as
@@ -40,7 +41,7 @@ font:
normal: normal:
family: JetBrainsMono Nerd Font family: JetBrainsMono Nerd Font
# Style can be specified to pick a specific face. # Style can be specified to pick a specific face.
# style: Regular style: ExtraLight
# The bold font face # The bold font face
bold: bold:
@@ -298,7 +299,6 @@ mouse:
selection: selection:
semantic_escape_chars: ',│`|:"'' ()[]{}<>' semantic_escape_chars: ',│`|:"'' ()[]{}<>'
# Shell # Shell
# #
# You can set shell.program to the path of your favorite shell, e.g. /bin/fish. # 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)" have rbenv && eval "$(rbenv init - zsh)"
# Rust / cargo # Rust / cargo
export RUSTUP_HOME="$XDG_DATA_HOME/rustup"
export CARGO_HOME="$XDG_DATA_HOME/cargo" export CARGO_HOME="$XDG_DATA_HOME/cargo"
path_append "$CARGO_HOME/bin" 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 name = Ismo Vuorinen
email = ismo@ivuorinen.net 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" brew "act"
# Mozilla CA certificate store # Mozilla CA certificate store
brew "ca-certificates" brew "ca-certificates"
# Cryptography and SSL/TLS Toolkit
brew "openssl@3"
# Interpreted, interactive, object-oriented programming language # Interpreted, interactive, object-oriented programming language
brew "python@3.11" brew "python@3.11"
# YAML Parser # YAML Parser
@@ -104,12 +102,20 @@ brew "dnsmasq"
brew "dog" brew "dog"
# Lightning-fast linter for .env files written in Rust # Lightning-fast linter for .env files written in Rust
brew "dotenv-linter" brew "dotenv-linter"
# Tool to verify that your files are in harmony with your .editorconfig
brew "editorconfig-checker"
# Useful examples at the command-line # Useful examples at the command-line
brew "eg-examples" brew "eg-examples"
# OpenType text shaping engine
brew "harfbuzz"
# Development kit for the Java programming language
brew "openjdk"
# Run arbitrary commands when files change # Run arbitrary commands when files change
brew "entr" brew "entr"
# Perl lib for reading and writing EXIF metadata # Perl lib for reading and writing EXIF metadata
brew "exiftool" brew "exiftool"
# Simple, fast and user-friendly alternative to find
brew "fd"
# Banner-like program prints strings as ASCII art # Banner-like program prints strings as ASCII art
brew "figlet" brew "figlet"
# Libraries to talk to Microsoft SQL Server and Sybase databases # Libraries to talk to Microsoft SQL Server and Sybase databases
@@ -152,8 +158,6 @@ brew "gpgme"
brew "gpg-tui" brew "gpg-tui"
# Image manipulation # Image manipulation
brew "netpbm" brew "netpbm"
# OpenType text shaping engine
brew "harfbuzz"
# Framework for layout and rendering of i18n text # Framework for layout and rendering of i18n text
brew "pango" brew "pango"
# Library to render SVG files using Cairo # Library to render SVG files using Cairo
@@ -208,8 +212,6 @@ brew "nvm"
brew "openjdk@11" brew "openjdk@11"
# Generate clients, server & docs from an OpenAPI spec (v2, v3) # Generate clients, server & docs from an OpenAPI spec (v2, v3)
brew "openapi-generator" brew "openapi-generator"
# Development kit for the Java programming language
brew "openjdk"
# Swiss-army knife of markup format conversion # Swiss-army knife of markup format conversion
brew "pandoc" brew "pandoc"
# Highly capable, feature-rich programming language # Highly capable, feature-rich programming language
@@ -416,6 +418,7 @@ mas "Keynote", id: 409183694
mas "LastPass", id: 926036361 mas "LastPass", id: 926036361
mas "Numbers", id: 409203825 mas "Numbers", id: 409203825
mas "Pages", id: 409201541 mas "Pages", id: 409201541
mas "Pixelmator Pro", id: 1289583905
mas "Tailscale", id: 1475387142 mas "Tailscale", id: 1475387142
mas "Xcode", id: 497799835 mas "Xcode", id: 497799835
vscode "akamud.vscode-theme-onelight" vscode "akamud.vscode-theme-onelight"
@@ -485,6 +488,7 @@ vscode "Vue.volar"
vscode "Vue.vscode-typescript-vue-plugin" vscode "Vue.vscode-typescript-vue-plugin"
vscode "WakaTime.vscode-wakatime" vscode "WakaTime.vscode-wakatime"
vscode "wix.vscode-import-cost" vscode "wix.vscode-import-cost"
vscode "XadillaX.viml"
vscode "xdebug.php-debug" vscode "xdebug.php-debug"
vscode "xdebug.php-pack" vscode "xdebug.php-pack"
vscode "yinfei.luahelper" vscode "yinfei.luahelper"

View File

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

View File

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

View File

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

View File

@@ -5,36 +5,66 @@
recursive: true recursive: true
~/.local: ~/.local:
recursive: true recursive: true
~/.ssh:
recursive: true
- create: - create:
~/.cache: ~/.cache:
~/.cache/git: ~/.cache/git:
~/.config: ~/.config:
~/.config/cheat/cheatsheets/personal:
~/.config/cheat/cheatsheets/pure-bash-bible:
~/.config/cheat/cheatsheets/tldr:
~/.local: ~/.local:
~/.local/bin:
~/.local/run: ~/.local/run:
~/.local/share: ~/.local/share:
~/.local/state: ~/.local/state:
~/.ssh: ~/.ssh:
mode: 0700 mode: 0700
~/.ssh/local.d:
mode: 0700
~/Code: ~/Code:
- link: - link:
~/: ~/:
force: true force: true
glob: true glob: true
path: base/** path: base/*
prefix: "." prefix: "."
~/.config/: ~/.config/:
glob: true glob: true
path: config/** relink: true
~/.local/: path: config/*
exclude: [config/nvm]
~/.config/nvm/default-packages:
create: true
relink: true
path: config/nvm/default-packages
~/.local/bin:
glob: true glob: true
path: local/** path: local/bin/*
~/.local/man:
glob: true
path: local/man/**
~/.local/share:
glob: true
path: local/share/*
~/.ssh/: ~/.ssh/:
glob: true glob: true
mode: 0600 mode: 0600
path: ssh/** path: ssh/*
- shell: - shell:
- git submodule update --init --recursive --force - git submodule update --init --recursive --force
- bash local/bin/dfm install all - 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" "cheat-databases:Install cheat external cheatsheet databases"
"composer:Install composer" "composer:Install composer"
"dotenv:Install dotenv-linter" "dotenv:Install dotenv-linter"
"fonts:Install programming fonts"
"gh:Install GitHub CLI Extensions" "gh:Install GitHub CLI Extensions"
"go:Install Go Packages" "go:Install Go Packages"
"imagick:Install ImageMagick CLI" "imagick:Install ImageMagick CLI"
@@ -48,6 +49,7 @@ function section_install
case "$1" in case "$1" in
all) all)
$0 install macos $0 install macos
$0 install fonts
$0 install antigen $0 install antigen
$0 brew install $0 brew install
$0 install pip $0 install pip
@@ -89,6 +91,10 @@ function section_install
| sh -s -- -b "$XDG_BIN_HOME" \ | sh -s -- -b "$XDG_BIN_HOME" \
&& msg_yay "dotenv-linter installed!" && msg_yay "dotenv-linter installed!"
;; ;;
fonts)
bash "$DOTFILES/scripts/install-fonts.sh" \
&& msg_yay "Installed fonts!"
;;
fzf) fzf)
bash "$DOTFILES/scripts/install-fzf.sh" \ bash "$DOTFILES/scripts/install-fzf.sh" \
&& msg_yay "fzf installed!" && msg_yay "fzf installed!"
@@ -244,10 +250,8 @@ function section_dotfiles
~/.local/share/nvim \ ~/.local/share/nvim \
~/.local/state/nvim \ ~/.local/state/nvim \
~/.cache/nvim \ ~/.cache/nvim \
~/.config/astronvim \
~/.config/nvim ~/.config/nvim
msg_ok "Deleted old nvim files" msg_ok "Deleted old nvim files (share, state and cache + config)"
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"
have npm && $0 install npm have npm && $0 install npm

View File

@@ -1,136 +1,195 @@
#!/usr/bin/python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Python script to find the largest files in a git repository. # Python script to find the largest files in a git repository.
# The general method is based on the script in this blog post: # 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/ # 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 # The above script worked for me, but was very slow on my 11GB repository.
# of changes to speed things up to a more reasonable time. It takes less than a minute on repos with 250K objects. # 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) # The MIT License (MIT)
# Copyright (c) 2015 Nick Kocharhook # 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 # Permission is hereby granted, free of charge, to any person obtaining a copy
# associated documentation files (the "Software"), to deal in the Software without restriction, # of this software and associated documentation files (the "Software"), to deal
# including without limitation the rights to use, copy, modify, merge, publish, distribute, # in the Software without restriction, including without limitation the rights
# sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is # 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: # furnished to do so, subject to the following conditions:
# #
# The above copyright notice and this permission notice shall be included in all copies or # The above copyright notice and this permission notice shall be included in all copies
# substantial portions of the Software. # or substantial portions of the Software.
# #
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
# NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, # PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT # HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
# OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # 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 argparse
import signal import signal
import sys import sys
sortByOnDiskSize = False 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(): def main():
global sortByOnDiskSize global sortByOnDiskSize
signal.signal(signal.SIGINT, signal_handler) signal.signal(signal.SIGINT, signal_handler)
args = parseArguments()
sortByOnDiskSize = args.sortByOnDiskSize
sizeLimit = 1024*args.filesExceeding
if args.filesExceeding > 0: args = parse_arguments()
print "Finding objects larger than {}kB…".format(args.filesExceeding) sortByOnDiskSize = args.sortByOnDiskSize
else: sizeLimit = 1024*args.filesExceeding
print "Finding the {} largest objects…".format(args.matchCount)
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) blobs = get_top_blobs(args.matchCount, sizeLimit)
printOutBlobs(blobs)
def getTopBlobs(count, sizeLimit): populate_blob_paths(blobs)
sortColumn = 4 print_out_blobs(blobs)
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): def get_top_blobs(count, sizeLimit):
if len(blobs): """Get top blobs from git repository
print "Finding object paths…"
# Only include revs which have a path. Other revs aren't blobs. Args:
revList = "git rev-list --all --objects | awk '$2 {print}'" count (int): How many items to return
allObjectLines = check_output(revList, shell=True).split("\n")[:-1] sizeLimit (int): What is the size limit
outstandingKeys = blobs.keys() Returns:
dict: Dictionary of Blobs
"""
sortColumn = 4
for line in allObjectLines: if sortByOnDiskSize:
cols = line.split() sortColumn = 3
sha1, path = cols[0], " ".join(cols[1:])
if (sha1 in outstandingKeys): verifyPack = "git verify-pack -v `git rev-parse --git-dir`/objects/pack/pack-*.idx | grep blob | sort -k{}nr".format(sortColumn) # noqa: E501
outstandingKeys.remove(sha1) output = check_output(verifyPack, shell=True).decode('utf-8').strip().split("\n")[:-1] # noqa: E501
blobs[sha1].path = path
# short-circuit the search if we're done blobs = dict()
if not len(outstandingKeys): # use __lt__ to do the appropriate comparison
break 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): def populate_blob_paths(blobs):
if len(blobs): """Populate blob paths that only have a path
csvLines = ["size,pack,hash,path"]
for blob in sorted(blobs.values(), reverse=True): Args:
csvLines.append(blob.csvLine()) blobs (Blob, dict): Dictionary of Blobs
"""
if len(blobs):
print("Finding object paths…")
p = Popen(["column", "-t", "-s", "','"], stdin=PIPE, stdout=PIPE, stderr=PIPE) # Only include revs which have a path. Other revs aren't blobs.
stdout, stderr = p.communicate("\n".join(csvLines)+"\n") 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" for line in all_object_lines:
print stdout.rstrip('\n') cols = line.split()
else: sha1, path = cols[0], " ".join(cols[1:])
print "No files found which match those criteria."
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(): def print_out_blobs(blobs):
parser = argparse.ArgumentParser(description='List the largest files in a git repository') if len(blobs):
parser.add_argument('-c', '--match-count', dest='matchCount', type=int, default=10, csvLines = ["size,pack,hash,path"]
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() 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): def signal_handler(signal, frame):
@@ -138,29 +197,6 @@ def signal_handler(signal, frame):
sys.exit(0) 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() # Default function is main()
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@@ -16,21 +16,22 @@ COLOR_S='\033[0;36m'
RESET='\033[0m' RESET='\033[0m'
# Print time-based personalized message, using figlet & lolcat if availible # Print time-based personalized message, using figlet & lolcat if availible
function welcome_greeting () { function welcome_greeting()
{
h=$(date +%H) h=$(date +%H)
if [ "$h" -lt 04 ] || [ "$h" -gt 22 ]; if [ "$h" -lt 04 ] || [ "$h" -gt 22 ]; then
then greeting="Good Night" greeting="Good Night"
elif [ "$h" -lt 12 ]; elif [ "$h" -lt 12 ]; then
then greeting="Good morning" greeting="Good morning"
elif [ "$h" -lt 18 ]; elif [ "$h" -lt 18 ]; then
then greeting="Good afternoon" greeting="Good afternoon"
elif [ "$h" -lt 22 ]; elif [ "$h" -lt 22 ]; then
then greeting="Good evening" greeting="Good evening"
else else
greeting="Hello" greeting="Hello"
fi fi
WELCOME_MSG="$greeting $USER!" 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 echo "${WELCOME_MSG}" | figlet | lolcat
else else
echo -e "$COLOR_P${WELCOME_MSG}${RESET}\n" echo -e "$COLOR_P${WELCOME_MSG}${RESET}\n"
@@ -38,8 +39,9 @@ function welcome_greeting () {
} }
# Print system information with neofetch, if it's installed # Print system information with neofetch, if it's installed
function welcome_sysinfo () { function welcome_sysinfo()
if hash neofetch 2>/dev/null; then {
if hash neofetch 2> /dev/null; then
neofetch --shell_version off \ neofetch --shell_version off \
--disable kernel distro shell resolution cpu gpu de wm wm_theme theme icons terminal \ --disable kernel distro shell resolution cpu gpu de wm wm_theme theme icons terminal \
--backend off \ --backend off \
@@ -50,7 +52,8 @@ function welcome_sysinfo () {
} }
# Print todays info: Date, IP, weather, etc # Print todays info: Date, IP, weather, etc
function welcome_today () { function welcome_today()
{
timeout=1 timeout=1
echo -e "\033[1;34mToday\n------" echo -e "\033[1;34mToday\n------"
@@ -62,7 +65,7 @@ function welcome_today () {
echo -e "${RESET}" echo -e "${RESET}"
# Print IP address # 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_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]}') 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})" 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 # Putting it all together
function welcome() { function welcome()
{
welcome_greeting welcome_greeting
welcome_sysinfo welcome_sysinfo
welcome_today welcome_today
} }
# Determine if file is being run directly or sourced welcome "$@"
([[ -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

View File

@@ -6,7 +6,7 @@ source "$HOME/.dotfiles/scripts/shared.sh"
! have cargo && { ! have cargo && {
msg "cargo could not be found. installing cargo with rustup.rs" 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=( packages=(
@@ -18,6 +18,9 @@ packages=(
"eza" "eza"
# A simple, fast and user-friendly alternative to 'find' # A simple, fast and user-friendly alternative to 'find'
"fd-find" "fd-find"
"cargo-update"
"pijul"
"ripgrep"
) )
for pkg in "${packages[@]}"; do for pkg in "${packages[@]}"; do
@@ -26,7 +29,8 @@ for pkg in "${packages[@]}"; do
# Skip comments # Skip comments
if [[ ${pkg:0:1} == "#" ]]; then continue; fi if [[ ${pkg:0:1} == "#" ]]; then continue; fi
cargo install $pkg msg_run "Installing cargo package $pkg"
cargo install "$pkg"
echo "" echo ""
done 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=( packages=(
"pipx"
"libtmux" "libtmux"
) )
@@ -18,7 +19,7 @@ for pkg in "${packages[@]}"; do
# Skip comments # Skip comments
if [[ ${pkg:0:1} == "#" ]]; then continue; fi if [[ ${pkg:0:1} == "#" ]]; then continue; fi
python3 -m pip install --user $pkg python3 -m pip install --user "$pkg"
echo "" echo ""
done 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