mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-02-01 23:47:41 +00:00
Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 745fc9b737 | |||
| dbe5ea3ce0 | |||
| 761671e7f7 | |||
| f4df8623b0 | |||
| 03aacb0639 | |||
| 04c85245cc | |||
| 2ccb74422c | |||
| 3c87ed4d2b | |||
| 4e4ff92ae5 | |||
| ef9bf3864b | |||
| cfb9aa696e | |||
| 1c75e7a53f |
@@ -8,8 +8,9 @@ indent_style = space
|
|||||||
insert_final_newline = true
|
insert_final_newline = true
|
||||||
trim_trailing_whitespace = true
|
trim_trailing_whitespace = true
|
||||||
|
|
||||||
[*.{yaml,yml}]
|
[*.yaml,*.yml]
|
||||||
indent_size = 2
|
indent_size = 2
|
||||||
|
insert_final_newline = true
|
||||||
|
|
||||||
[local/bin/antigen.zsh]
|
[local/bin/antigen.zsh]
|
||||||
ignore = true
|
ignore = true
|
||||||
|
|||||||
22
.gitmodules
vendored
22
.gitmodules
vendored
@@ -3,23 +3,28 @@
|
|||||||
url = https://github.com/anishathalye/dotbot.git
|
url = https://github.com/anishathalye/dotbot.git
|
||||||
ignore = dirty
|
ignore = dirty
|
||||||
|
|
||||||
[submodule "dotbot-plugins/dotbot-brew"]
|
[submodule "dotbot-brew"]
|
||||||
path = dotbot-plugins/dotbot-brew
|
path = dotbot-brew
|
||||||
url = https://github.com/wren/dotbot-brew.git
|
url = https://github.com/wren/dotbot-brew.git
|
||||||
ignore = dirty
|
ignore = dirty
|
||||||
|
|
||||||
[submodule "dotbot-plugins/dotbot-if"]
|
[submodule "dotbot-if"]
|
||||||
path = dotbot-plugins/dotbot-if
|
path = dotbot-if
|
||||||
url = https://github.com/wonderbeyond/dotbot-if.git
|
url = https://github.com/wonderbeyond/dotbot-if.git
|
||||||
ignore = dirty
|
ignore = dirty
|
||||||
|
|
||||||
[submodule "dotbot-plugins/dotbot-gh-extension"]
|
[submodule "dotbot-ifplatform"]
|
||||||
path = dotbot-plugins/dotbot-gh-extension
|
path = dotbot-ifplatform
|
||||||
|
url = https://github.com/ssbanerje/dotbot-ifplatform.git
|
||||||
|
ignore = dirty
|
||||||
|
|
||||||
|
[submodule "dotbot-gh-extension"]
|
||||||
|
path = dotbot-gh-extension
|
||||||
url = https://github.com/fundor333/dotbot-gh-extension.git
|
url = https://github.com/fundor333/dotbot-gh-extension.git
|
||||||
ignore = dirty
|
ignore = dirty
|
||||||
|
|
||||||
[submodule "dotbot-plugins/dotbot-golang"]
|
[submodule "dotbot-golang"]
|
||||||
path = dotbot-plugins/dotbot-golang
|
path = dotbot-golang
|
||||||
url = https://github.com/delicb/dotbot-golang.git
|
url = https://github.com/delicb/dotbot-golang.git
|
||||||
ignore = dirty
|
ignore = dirty
|
||||||
|
|
||||||
@@ -35,3 +40,4 @@
|
|||||||
url = https://github.com/ivuorinen/astronvim_config.git
|
url = https://github.com/ivuorinen/astronvim_config.git
|
||||||
update = rebase
|
update = rebase
|
||||||
branch = main
|
branch = main
|
||||||
|
ignore = dirty
|
||||||
|
|||||||
7
add-submodules.sh
Normal file
7
add-submodules.sh
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
git submodule add --name dotbot-brew -f https://github.com/wren/dotbot-brew.git dotbot-brew
|
||||||
|
git submodule add --name dotbot-gh-extension -f https://github.com/fundor333/dotbot-gh-extension.git dotbot-gh-extension
|
||||||
|
git submodule add --name dotbot-golang -f https://github.com/delicb/dotbot-golang.git dotbot-golang
|
||||||
|
git submodule add --name dotbot-if -f https://github.com/wonderbeyond/dotbot-if.git dotbot-if
|
||||||
|
git submodule add --name dotbot-ifplatform -f https://github.com/ssbanerje/dotbot-ifplatform.git dotbot-ifplatform
|
||||||
@@ -41,6 +41,7 @@ export NVM_COMPLETION=true
|
|||||||
export NVM_AUTO_USE=true
|
export NVM_AUTO_USE=true
|
||||||
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
|
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
|
||||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
|
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
|
||||||
|
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
|
||||||
|
|
||||||
# If we have go packages, include them to the PATH
|
# If we have go packages, include them to the PATH
|
||||||
if command -v go &> /dev/null; then
|
if command -v go &> /dev/null; then
|
||||||
|
|||||||
Submodule config/astronvim/lua/user updated: df9530784f...6409f428be
@@ -1 +1 @@
|
|||||||
git_protocol: ssh
|
git_protocol: https
|
||||||
|
|||||||
@@ -52,10 +52,4 @@
|
|||||||
branch = yellow black bold ul
|
branch = yellow black bold ul
|
||||||
|
|
||||||
[submodule]
|
[submodule]
|
||||||
recurse = true
|
recurse = true
|
||||||
[credential "https://github.com"]
|
|
||||||
helper =
|
|
||||||
helper = !/opt/homebrew/bin/gh auth git-credential
|
|
||||||
[credential "https://gist.github.com"]
|
|
||||||
helper =
|
|
||||||
helper = !/opt/homebrew/bin/gh auth git-credential
|
|
||||||
|
|||||||
Submodule config/nvim updated: e283d6749f...ca088647e2
1
dotbot-ifplatform
Submodule
1
dotbot-ifplatform
Submodule
Submodule dotbot-ifplatform added at e35b5c0d71
10
install
10
install
@@ -14,10 +14,10 @@ git submodule update --init --recursive
|
|||||||
|
|
||||||
"${BASEDIR}/${DOTBOT_DIR}/${DOTBOT_BIN}" \
|
"${BASEDIR}/${DOTBOT_DIR}/${DOTBOT_BIN}" \
|
||||||
-d "${BASEDIR}" \
|
-d "${BASEDIR}" \
|
||||||
--plugin-dir=dotbot-plugins/dotbot-brew \
|
--plugin-dir=dotbot-brew \
|
||||||
--plugin-dir=dotbot-plugins/dotbot-gh-extension \
|
--plugin-dir=dotbot-gh-extension \
|
||||||
--plugin-dir=dotbot-plugins/dotbot-golang \
|
--plugin-dir=dotbot-golang \
|
||||||
--plugin-dir=dotbot-plugins/dotbot-if \
|
--plugin-dir=dotbot-if \
|
||||||
-p dotbot-plugins/dotbot-if/if.py \
|
--plugin-dir=dotbot-ifplatform \
|
||||||
-c "${CONFIG}" \
|
-c "${CONFIG}" \
|
||||||
"${@}"
|
"${@}"
|
||||||
|
|||||||
26
install-without-plugins
Executable file
26
install-without-plugins
Executable file
@@ -0,0 +1,26 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
CONFIG="install.conf.yaml"
|
||||||
|
DOTBOT_DIR="dotbot"
|
||||||
|
|
||||||
|
DOTBOT_BIN="bin/dotbot"
|
||||||
|
BASEDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
|
||||||
|
cd "$BASEDIR"
|
||||||
|
git submodule sync --quiet --recursive
|
||||||
|
git submodule update --init --recursive
|
||||||
|
|
||||||
|
"${BASEDIR}/${DOTBOT_DIR}/${DOTBOT_BIN}" \
|
||||||
|
-d "${BASEDIR}" \
|
||||||
|
-c "${CONFIG}" \
|
||||||
|
"${@}"
|
||||||
|
|
||||||
|
# --plugin-dir=dotbot-plugins/dotbot-brew \
|
||||||
|
# --plugin-dir=dotbot-plugins/dotbot-gh-extension \
|
||||||
|
# --plugin-dir=dotbot-plugins/dotbot-golang \
|
||||||
|
# --plugin-dir=dotbot-plugins/dotbot-if \
|
||||||
|
# --plugin-dir=dotbot-plugins/dotbot-ifplatform \
|
||||||
|
# -p dotbot-plugins/dotbot-if/if.py \
|
||||||
|
|
||||||
@@ -1,11 +1,10 @@
|
|||||||
---
|
---
|
||||||
- defaults:
|
- defaults:
|
||||||
brew:
|
|
||||||
stderr: true
|
|
||||||
stdout: true
|
|
||||||
brewfile:
|
brewfile:
|
||||||
stderr: true
|
stderr: true
|
||||||
stdout: true
|
stdout: true
|
||||||
|
create:
|
||||||
|
mode: 755
|
||||||
link:
|
link:
|
||||||
create: true
|
create: true
|
||||||
relink: true
|
relink: true
|
||||||
@@ -29,90 +28,92 @@
|
|||||||
- link:
|
- link:
|
||||||
~/.config/:
|
~/.config/:
|
||||||
glob: true
|
glob: true
|
||||||
path: config/**
|
path: config/*
|
||||||
~/.local/bin/:
|
~/.local/bin/:
|
||||||
glob: true
|
glob: true
|
||||||
path: local/bin/**
|
path: local/bin/*
|
||||||
~/.ssh/:
|
~/.ssh/:
|
||||||
force: true
|
force: true
|
||||||
glob: true
|
glob: true
|
||||||
mode: 600
|
mode: 600
|
||||||
path: ssh/**
|
path: ssh/*
|
||||||
~/:
|
~/:
|
||||||
force: true
|
force: true
|
||||||
glob: true
|
glob: true
|
||||||
path: base/**
|
path: base/*
|
||||||
prefix: '.'
|
prefix: "."
|
||||||
|
|
||||||
- shell:
|
- shell:
|
||||||
- [git submodule update --init --recursive --force]
|
- [git submodule update --init --recursive --force]
|
||||||
- [bash scripts/set-macos-defaults.sh]
|
- [bash scripts/install-npm-packages.sh]
|
||||||
- [bash scripts/install-npm-packages.sh]
|
|
||||||
|
|
||||||
- brewfile:
|
- ifmacos:
|
||||||
- Brewfile
|
- shell:
|
||||||
|
- [bash scripts/set-macos-defaults.sh]
|
||||||
- go:
|
- brewfile:
|
||||||
- github.com/skx/sysbox@latest
|
- Brewfile
|
||||||
|
|
||||||
# hosts: air
|
# hosts: air
|
||||||
- if:
|
- if:
|
||||||
- cond: '[[ $(hostname) = air ]]'
|
- cond: "[[ $(hostname) = air ]]"
|
||||||
met:
|
met:
|
||||||
- go:
|
- go:
|
||||||
- github.com/skx/sysbox@latest
|
- github.com/skx/sysbox@latest
|
||||||
|
|
||||||
# hosts: v
|
# hosts: v
|
||||||
- if:
|
- if:
|
||||||
- cond: '[[ $(hostname) = v ]]'
|
- cond: "[[ $(hostname) = v ]]"
|
||||||
met:
|
met:
|
||||||
- link:
|
- link:
|
||||||
~/.config/:
|
~/.config/:
|
||||||
glob: true
|
glob: true
|
||||||
force: true
|
force: true
|
||||||
path: hosts/v/config/**
|
path: hosts/v/config/**
|
||||||
- go:
|
- go:
|
||||||
- github.com/skx/sysbox@latest
|
- github.com/skx/sysbox@latest
|
||||||
|
|
||||||
# hosts: lakka
|
# hosts: lakka
|
||||||
- if:
|
- if:
|
||||||
- cond: '[[ $(hostname) = lakka ]]'
|
- cond: "[[ $(hostname) = lakka ]]"
|
||||||
met:
|
met:
|
||||||
- link:
|
- link:
|
||||||
~/.irssi/*:
|
~/.irssi/*:
|
||||||
force: true
|
force: true
|
||||||
glob: true
|
glob: true
|
||||||
path: hosts/lakka/irssi/**
|
path: hosts/lakka/irssi/**
|
||||||
~/.zshrc*:
|
~/.zshrc:
|
||||||
force: true
|
force: true
|
||||||
path: hosts/lakka/zshrc
|
path: hosts/lakka/zshrc
|
||||||
|
|
||||||
# GitHub CLI Extensions
|
# GitHub CLI Extensions
|
||||||
- ghe:
|
- ghe:
|
||||||
# GitHub CLI extension for generating a report on repository dependencies.
|
# GitHub CLI extension for generating a report on repository dependencies.
|
||||||
- andyfeller/gh-dependency-report
|
- andyfeller/gh-dependency-report
|
||||||
# GitHub CLI extension to generate montage from GitHub user avatars
|
# GitHub CLI extension to generate montage from GitHub user avatars
|
||||||
- andyfeller/gh-montage
|
- andyfeller/gh-montage
|
||||||
# An opinionated GitHub Cli extension for creating
|
# An opinionated GitHub Cli extension for creating
|
||||||
# changelogs that adhere to the keep a changelog specification.
|
# changelogs that adhere to the keep a changelog specification.
|
||||||
- chelnak/gh-changelog
|
- chelnak/gh-changelog
|
||||||
# Safely deletes local branches with no upstream and no un-pushed commits
|
# Safely deletes local branches with no upstream and no un-pushed commits
|
||||||
- davidraviv/gh-clean-branches
|
- davidraviv/gh-clean-branches
|
||||||
# A beautiful CLI dashboard for GitHub 🚀
|
# A beautiful CLI dashboard for GitHub 🚀
|
||||||
- dlvhdr/gh-dash
|
- dlvhdr/gh-dash
|
||||||
# GitHub CLI extension for reviewing Dependabot PRs.
|
# GitHub CLI extension for reviewing Dependabot PRs.
|
||||||
- einride/gh-dependabot
|
- einride/gh-dependabot
|
||||||
# A GitHub CLI extension that provides summary pull request metrics.
|
# A GitHub CLI extension that provides summary pull request metrics.
|
||||||
- hectcastro/gh-metrics
|
- hectcastro/gh-metrics
|
||||||
# A github-cli extension script to clone all repositories
|
# A github-cli extension script to clone all repositories
|
||||||
# in an organization, optionally filtering by topic.
|
# in an organization, optionally filtering by topic.
|
||||||
- matt-bartel/gh-clone-org
|
- matt-bartel/gh-clone-org
|
||||||
# being an extension to view the overall health of an organization's use of actions
|
# being an extension to view the overall health of
|
||||||
- rsese/gh-actions-status
|
# an organization's use of actions
|
||||||
- samcoe/gh-triage
|
- rsese/gh-actions-status
|
||||||
# Generate account/organization/enterprise reports
|
- samcoe/gh-triage
|
||||||
- stoe/gh-report
|
# Generate account/organization/enterprise reports
|
||||||
# Organisation specific extension for gh cli to retrieve different statistics
|
- stoe/gh-report
|
||||||
- VildMedPap/gh-orgstats
|
# Organisation specific extension for gh cli
|
||||||
- vilmibm/gh-screensaver
|
# to retrieve different statistics
|
||||||
- vilmibm/gh-user-status
|
- VildMedPap/gh-orgstats
|
||||||
|
- vilmibm/gh-screensaver
|
||||||
|
- vilmibm/gh-user-status
|
||||||
|
#
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ if [[ $ANTIGEN_CACHE != false ]]; then
|
|||||||
for config in $ANTIGEN_CHECK_FILES; do
|
for config in $ANTIGEN_CHECK_FILES; do
|
||||||
if [[ "$config" -nt "$config.zwc" ]]; then
|
if [[ "$config" -nt "$config.zwc" ]]; then
|
||||||
# Flag configuration file as newer
|
# Flag configuration file as newer
|
||||||
{ zcompile "$config"; } &!
|
{ zcompile "$config" } &!
|
||||||
# Kill cache file in order to force full loading (see a few lines below)
|
# Kill cache file in order to force full loading (see a few lines below)
|
||||||
[[ -f "$ANTIGEN_CACHE" ]] && rm -f "$ANTIGEN_CACHE"
|
[[ -f "$ANTIGEN_CACHE" ]] && rm -f "$ANTIGEN_CACHE"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ function section_install
|
|||||||
all)
|
all)
|
||||||
$0 install antigen
|
$0 install antigen
|
||||||
$0 install starship
|
$0 install starship
|
||||||
|
$0 install nvm
|
||||||
$0 install macos
|
$0 install macos
|
||||||
$0 install npm
|
$0 install npm
|
||||||
;;
|
;;
|
||||||
@@ -33,7 +34,10 @@ function section_install
|
|||||||
curl -L git.io/antigen > "$DOTFILES/local/bin/antigen.zsh" && msg_done "🎉 New antigen installed!"
|
curl -L git.io/antigen > "$DOTFILES/local/bin/antigen.zsh" && msg_done "🎉 New antigen installed!"
|
||||||
;;
|
;;
|
||||||
starship)
|
starship)
|
||||||
curl -sS https://starship.rs/install.sh | sh && msg_done "🎉 starship installed!"
|
curl -sS https://starship.rs/install.sh | sh -s -- --bin-dir ~/.local/bin && msg_done "🎉 starship installed!"
|
||||||
|
;;
|
||||||
|
nvm)
|
||||||
|
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash && msg_done " ^=^n^i nvm installed!"
|
||||||
;;
|
;;
|
||||||
macos)
|
macos)
|
||||||
bash "$DOTFILES/scripts/set-macos-defaults.sh" && msg_done "🎉 Brewfile defined apps has been installed!"
|
bash "$DOTFILES/scripts/set-macos-defaults.sh" && msg_done "🎉 Brewfile defined apps has been installed!"
|
||||||
|
|||||||
25
local/bin/x-backup-folder.sh
Executable file
25
local/bin/x-backup-folder.sh
Executable file
@@ -0,0 +1,25 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
DIRECTORY=$1
|
||||||
|
FILENAME=$2
|
||||||
|
|
||||||
|
if [ -z "${DIRECTORY}" ]; then
|
||||||
|
echo "DIRECTORY (first argument) is missing"
|
||||||
|
echo "Usage: $0 folder_to_backup"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "${FILENAME}" ]; then
|
||||||
|
FILENAME=$DIRECTORY
|
||||||
|
fi
|
||||||
|
|
||||||
|
FILENAME=${FILENAME} | \
|
||||||
|
tr '/' _ | \
|
||||||
|
iconv -t ascii//TRANSLIT | \
|
||||||
|
sed -r s/[^a-zA-Z0-9]+/_/g | \
|
||||||
|
sed -r s/^_+\|-+$//g
|
||||||
|
|
||||||
|
TIMESTAMP=$(date "+%Y%m%d_%H%M%S")
|
||||||
|
FILENAME_TIMESTAMP="${FILENAME}_${TIMESTAMP}"
|
||||||
|
|
||||||
|
tar cvzf "${FILENAME_TIMESTAMP}.tar.gz" "${DIRECTORY}/"
|
||||||
166
local/bin/x-git-largest-files.py
Executable file
166
local/bin/x-git-largest-files.py
Executable file
@@ -0,0 +1,166 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Python script to find the largest files in a git repository.
|
||||||
|
# The general method is based on the script in this blog post:
|
||||||
|
# http://stubbisms.wordpress.com/2009/07/10/git-script-to-show-largest-pack-objects-and-trim-your-waist-line/
|
||||||
|
#
|
||||||
|
# The above script worked for me, but was very slow on my 11GB repository. This version has a bunch
|
||||||
|
# of changes to speed things up to a more reasonable time. It takes less than a minute on repos with 250K objects.
|
||||||
|
#
|
||||||
|
# The MIT License (MIT)
|
||||||
|
# Copyright (c) 2015 Nick Kocharhook
|
||||||
|
#
|
||||||
|
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
||||||
|
# associated documentation files (the "Software"), to deal in the Software without restriction,
|
||||||
|
# including without limitation the rights to use, copy, modify, merge, publish, distribute,
|
||||||
|
# sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
|
||||||
|
# furnished to do so, subject to the following conditions:
|
||||||
|
#
|
||||||
|
# The above copyright notice and this permission notice shall be included in all copies or
|
||||||
|
# substantial portions of the Software.
|
||||||
|
#
|
||||||
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
|
||||||
|
# NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||||
|
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
|
||||||
|
# OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
|
||||||
|
from subprocess import check_output, CalledProcessError, Popen, PIPE
|
||||||
|
import argparse
|
||||||
|
import signal
|
||||||
|
import sys
|
||||||
|
|
||||||
|
sortByOnDiskSize = False
|
||||||
|
|
||||||
|
def main():
|
||||||
|
global sortByOnDiskSize
|
||||||
|
|
||||||
|
signal.signal(signal.SIGINT, signal_handler)
|
||||||
|
|
||||||
|
args = parseArguments()
|
||||||
|
sortByOnDiskSize = args.sortByOnDiskSize
|
||||||
|
sizeLimit = 1024*args.filesExceeding
|
||||||
|
|
||||||
|
if args.filesExceeding > 0:
|
||||||
|
print "Finding objects larger than {}kB…".format(args.filesExceeding)
|
||||||
|
else:
|
||||||
|
print "Finding the {} largest objects…".format(args.matchCount)
|
||||||
|
|
||||||
|
blobs = getTopBlobs(args.matchCount, sizeLimit)
|
||||||
|
|
||||||
|
populateBlobPaths(blobs)
|
||||||
|
printOutBlobs(blobs)
|
||||||
|
|
||||||
|
def getTopBlobs(count, sizeLimit):
|
||||||
|
sortColumn = 4
|
||||||
|
|
||||||
|
if sortByOnDiskSize:
|
||||||
|
sortColumn = 3
|
||||||
|
|
||||||
|
verifyPack = "git verify-pack -v `git rev-parse --git-dir`/objects/pack/pack-*.idx | grep blob | sort -k{}nr".format(sortColumn)
|
||||||
|
output = check_output(verifyPack, shell=True).split("\n")[:-1]
|
||||||
|
|
||||||
|
blobs = dict()
|
||||||
|
compareBlob = Blob("a b {} {} c".format(sizeLimit, sizeLimit)) # use __lt__ to do the appropriate comparison
|
||||||
|
|
||||||
|
for objLine in output:
|
||||||
|
blob = Blob(objLine)
|
||||||
|
|
||||||
|
if sizeLimit > 0:
|
||||||
|
if compareBlob < blob:
|
||||||
|
blobs[blob.sha1] = blob
|
||||||
|
else:
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
blobs[blob.sha1] = blob
|
||||||
|
|
||||||
|
if len(blobs) == count:
|
||||||
|
break
|
||||||
|
|
||||||
|
return blobs
|
||||||
|
|
||||||
|
|
||||||
|
def populateBlobPaths(blobs):
|
||||||
|
if len(blobs):
|
||||||
|
print "Finding object paths…"
|
||||||
|
|
||||||
|
# Only include revs which have a path. Other revs aren't blobs.
|
||||||
|
revList = "git rev-list --all --objects | awk '$2 {print}'"
|
||||||
|
allObjectLines = check_output(revList, shell=True).split("\n")[:-1]
|
||||||
|
|
||||||
|
outstandingKeys = blobs.keys()
|
||||||
|
|
||||||
|
for line in allObjectLines:
|
||||||
|
cols = line.split()
|
||||||
|
sha1, path = cols[0], " ".join(cols[1:])
|
||||||
|
|
||||||
|
if (sha1 in outstandingKeys):
|
||||||
|
outstandingKeys.remove(sha1)
|
||||||
|
blobs[sha1].path = path
|
||||||
|
|
||||||
|
# short-circuit the search if we're done
|
||||||
|
if not len(outstandingKeys):
|
||||||
|
break
|
||||||
|
|
||||||
|
|
||||||
|
def printOutBlobs(blobs):
|
||||||
|
if len(blobs):
|
||||||
|
csvLines = ["size,pack,hash,path"]
|
||||||
|
|
||||||
|
for blob in sorted(blobs.values(), reverse=True):
|
||||||
|
csvLines.append(blob.csvLine())
|
||||||
|
|
||||||
|
p = Popen(["column", "-t", "-s", "','"], stdin=PIPE, stdout=PIPE, stderr=PIPE)
|
||||||
|
stdout, stderr = p.communicate("\n".join(csvLines)+"\n")
|
||||||
|
|
||||||
|
print "\nAll sizes in kB. The pack column is the compressed size of the object inside the pack file.\n"
|
||||||
|
print stdout.rstrip('\n')
|
||||||
|
else:
|
||||||
|
print "No files found which match those criteria."
|
||||||
|
|
||||||
|
|
||||||
|
def parseArguments():
|
||||||
|
parser = argparse.ArgumentParser(description='List the largest files in a git repository')
|
||||||
|
parser.add_argument('-c', '--match-count', dest='matchCount', type=int, default=10,
|
||||||
|
help='The number of files to return. Default is 10. Ignored if --files-exceeding is used.')
|
||||||
|
parser.add_argument('--files-exceeding', dest='filesExceeding', type=int, default=0,
|
||||||
|
help='The cutoff amount, in KB. Files with a pack size (or pyhsical size, with -p) larger than this will be printed.')
|
||||||
|
parser.add_argument('-p', '--physical-sort', dest='sortByOnDiskSize', action='store_true', default=False,
|
||||||
|
help='Sort by the on-disk size of the files. Default is to sort by the pack size.')
|
||||||
|
|
||||||
|
return parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
|
def signal_handler(signal, frame):
|
||||||
|
print('Caught Ctrl-C. Exiting.')
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
|
|
||||||
|
class Blob(object):
|
||||||
|
sha1 = ''
|
||||||
|
size = 0
|
||||||
|
packedSize = 0
|
||||||
|
path = ''
|
||||||
|
|
||||||
|
def __init__(self, line):
|
||||||
|
cols = line.split()
|
||||||
|
self.sha1, self.size, self.packedSize = cols[0], int(cols[2]), int(cols[3])
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return '{} - {} - {} - {}'.format(self.sha1, self.size, self.packedSize, self.path)
|
||||||
|
|
||||||
|
def __lt__(self, other):
|
||||||
|
if (sortByOnDiskSize):
|
||||||
|
return self.size < other.size
|
||||||
|
else:
|
||||||
|
return self.packedSize < other.packedSize
|
||||||
|
|
||||||
|
def csvLine(self):
|
||||||
|
return "{},{},{},{}".format(self.size/1024, self.packedSize/1024, self.sha1, self.path)
|
||||||
|
|
||||||
|
|
||||||
|
# Default function is main()
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
85
local/bin/x-quota-usage.php
Executable file
85
local/bin/x-quota-usage.php
Executable file
@@ -0,0 +1,85 @@
|
|||||||
|
#!/usr/bin/env php
|
||||||
|
<?php
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
|
||||||
|
$debug = false;
|
||||||
|
|
||||||
|
$quota = '';
|
||||||
|
$output = [];
|
||||||
|
$fsCharLenght = 0;
|
||||||
|
|
||||||
|
if ($debug) {
|
||||||
|
$quota = "Disk quotas for user viir (uid 2913):
|
||||||
|
Filesystem blocks quota limit grace files quota limit grace
|
||||||
|
10.0.0.89:/www/webroots/2 8277615 52428800 52428800 0 0 0
|
||||||
|
10.0.0.179:/users1/users/2 1999431 52428800 52428800 0 0 0
|
||||||
|
10.0.0.90:/siilo/2 24835106 524288000 524288000 0 0 0";
|
||||||
|
} else {
|
||||||
|
// $quota = system("quota -w");
|
||||||
|
$quota = shell_exec("quota -w");
|
||||||
|
}
|
||||||
|
|
||||||
|
function pad($i, $n = 3, $p = ' ') {
|
||||||
|
return str_pad($i, $n, $p, STR_PAD_LEFT);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($quota)) {
|
||||||
|
var_dump($quota);
|
||||||
|
die("quota was empty\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
$quota = explode("\n", $quota);
|
||||||
|
$quota = array_map('trim', $quota);
|
||||||
|
|
||||||
|
foreach ($quota as $lineNum => $line) {
|
||||||
|
if ($lineNum < 2) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$values = array_filter(explode(" ", $line));
|
||||||
|
|
||||||
|
if (count($values) != 4) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = array_combine(['fs', 'used', 'quota', 'limit'], $values);
|
||||||
|
|
||||||
|
$result['used_percentage'] = round($result['used'] / $result['quota'] * 100, 3);
|
||||||
|
$result['used_gb'] = round($result['used'] / 1024 / 1024, 2);
|
||||||
|
$result['quota_gb'] = round($result['quota'] / 1024 / 1024, 2);
|
||||||
|
|
||||||
|
$char = strlen($result['fs']);
|
||||||
|
if ($char > $fsCharLenght) {
|
||||||
|
$fsCharLenght = $char;
|
||||||
|
}
|
||||||
|
|
||||||
|
$output[] = $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($output)) {
|
||||||
|
|
||||||
|
$header = sprintf("%s | %s | %s | %s",
|
||||||
|
str_pad("Mount", $fsCharLenght),
|
||||||
|
'Usage%',
|
||||||
|
'Used/Total',
|
||||||
|
'Bar'
|
||||||
|
);
|
||||||
|
$headerWidth = strlen($header);
|
||||||
|
|
||||||
|
echo "\n" . $header . "\n";
|
||||||
|
echo str_repeat('-', $headerWidth + 24) . "\n";
|
||||||
|
|
||||||
|
foreach ($output as $i) {
|
||||||
|
$barUsed = round($i['used_percentage']) / 4;
|
||||||
|
echo sprintf(
|
||||||
|
"%s | %s | %s | [%s]",
|
||||||
|
str_pad($i['fs'], $fsCharLenght),
|
||||||
|
str_pad(round($i['used_percentage'], 1) . '%', 6, ' ', STR_PAD_LEFT),
|
||||||
|
str_pad($i['used_gb'] . '/' . $i['quota_gb'], 10, ' ', STR_PAD_LEFT),
|
||||||
|
str_pad(str_repeat('#', $barUsed), 25, '_')
|
||||||
|
) . "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "\n\n";
|
||||||
|
}
|
||||||
|
|
||||||
@@ -1,7 +1,11 @@
|
|||||||
Host github.com
|
Host github.com
|
||||||
User git
|
User git
|
||||||
|
|
||||||
Host *
|
Host lakka
|
||||||
# IdentityAgent "~/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock"
|
User viir
|
||||||
|
HostName lakka.kapsi.fi
|
||||||
IdentityFile ~/.ssh/id_rsa
|
IdentityFile ~/.ssh/id_rsa
|
||||||
|
|
||||||
|
Host *
|
||||||
|
# IdentityAgent "~/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user