mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-01-27 20:45:31 +00:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6f854ddbfd | |||
| 748e5bb561 | |||
| 67867b57cd | |||
| 91734ffa15 | |||
| 5364bef678 | |||
| 50b4f5c60f | |||
| 7cd508a727 | |||
| bf2c665433 | |||
| f5b1bf0915 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -13,4 +13,5 @@ ssh/local.d/*
|
||||
!ssh/local.d/.gitkeep
|
||||
!.gitkeep
|
||||
.env
|
||||
local/share/fonts/NerdFonts
|
||||
|
||||
|
||||
9
.gitmodules
vendored
9
.gitmodules
vendored
@@ -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
|
||||
|
||||
@@ -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
24
base/bashrc
Normal file → Executable 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
4
base/zshrc
Normal file → Executable 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)"
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
19
config/gh-changelog/config.yaml
Normal file
19
config/gh-changelog/config.yaml
Normal 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
54
config/gh-dash/config.yml
Normal 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
3
config/gh/hosts.yml
Normal file
@@ -0,0 +1,3 @@
|
||||
github.com:
|
||||
user: ivuorinen
|
||||
git_protocol: https
|
||||
@@ -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
2
config/git/overrides/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
!.gitkeep
|
||||
config
|
||||
@@ -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"
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
- include: "tools/dotbot-defaults.yaml"
|
||||
- shell:
|
||||
- echo "Configuring v"
|
||||
- brewfile:
|
||||
- Brewfile
|
||||
- link:
|
||||
~/:
|
||||
force: true
|
||||
|
||||
6
install
6
install
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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 "$@"
|
||||
|
||||
@@ -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
44
scripts/install-fonts.sh
Executable 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"
|
||||
@@ -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
1
tools/dotbot-crontab
Submodule
Submodule tools/dotbot-crontab added at ea900a7cf6
1
tools/dotbot-pip
Submodule
1
tools/dotbot-pip
Submodule
Submodule tools/dotbot-pip added at 42e6a8f3be
1
tools/dotbot-snap
Submodule
1
tools/dotbot-snap
Submodule
Submodule tools/dotbot-snap added at 5722c4e5af
2
tools/requirements-pipx.txt
Normal file
2
tools/requirements-pipx.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
openapi-python-client
|
||||
libtmux
|
||||
Reference in New Issue
Block a user