chezmoi: move unrelated scripts out

This commit is contained in:
js0ny 2025-09-27 15:34:19 +01:00
parent 67a78879db
commit fff9275372
7 changed files with 1 additions and 1 deletions

View file

@ -15,4 +15,4 @@ end
-- require("dual-pane"):setup({ enabled = true })
require("starship"):setup()
require("yaziline"):setup()
-- require("yaziline"):setup()

View file

@ -1,9 +0,0 @@
$PSHistPath = (Get-PSReadlineOption).HistorySavePath
if (Test-Path $PSHistPath) {
$PSHist = Get-Content $PSHistPath
$PSHist | Group-Object | Sort-Object Count -Descending | Select-Object -First 10 Count, Name
}
else {
Write-Host "No history file found."
}

View file

@ -1,43 +0,0 @@
<#
.SYNOPSIS
Rename files with a specified extension in a folder, padding the numeric part with zeros.
.PARAMETER ext
The extension of the files to rename, without the dot. Default is "md".
.PARAMETER Numeral
If specified, the files will be renamed in the order of their numeric part.
.EXAMPLE
Rename-FilesWithZeroPadding.ps1 -ext "txt"
Renames all files with the extension "txt" in the current folder, padding the numeric part with zeros.
For example: '1.txt', '2.txt', ... '12.txt' -> '01.txt', '02.txt', ... '12.txt'.
.EXAMPLE
Rename-FilesWithZeroPadding.ps1 -Numeral # This set the Numeral switch to false
Renames all files with the default extension "md" in the current folder, in the order of their filenames.
For example: 'file1.md', 'file2.md', ... 'file12.md' -> '01.md', '02.md', ... '12.md'.
#>
param(
[string]$ext = "md",
[switch]$Numeral
)
if ($Numeral) {
$files = $files | Sort-Object { [int]($_.BaseName -replace '\D', '') }
}
else {
$files = Get-ChildItem -Filter "*.$ext" | Sort-Object Name
$fnamecnt = 1
}
$cnt = $files.Count
$paddingLength = $cnt.ToString().Length
foreach ($file in $files) {
if ($Numeral) {
$number = [int]($file.BaseName -replace '\D', '')
$newNumber = $number.ToString().PadLeft($paddingLength, '0')
$newName = "$newNumber.$ext"
}
else {
$newName = ($fnamecnt++).ToString().PadLeft($paddingLength, '0') + ".$ext"
}
Rename-Item -Path $file.FullName -NewName $newName
}

View file

@ -1,17 +0,0 @@
function CsvToMarkdown {
param( [string]$csv)
$counter = 0
$column = $csv.Split("`n")[0].Split(",").Length
$aHeader = " --- |"
$header = "|" + $aHeader * $column
$csv.replace(",", " | ").Split("`n") | ForEach-Object {
if ($counter -eq 0) {
Write-Output "| $_ |"
$counter++
Write-Output $header
}
else {
Write-Output "| $_ |"
}
}
}

View file

@ -1,3 +0,0 @@
yabai --start-service
skhd --start-service
brew services start sketchybar

View file

@ -1,3 +0,0 @@
yabai --stop-service
skhd --stop-service
brew services stop sketchybar

View file

@ -1,46 +0,0 @@
#!/bin/zsh
# $DOTFILES/scripts/update.zsh
# call by `update` alias defined in tools/zsh/alias.zsh
# 使用别名 `update` 引用,别名定义于 tools/zsh/alias.zsh
# Plugins #
# Auto `git pull` on $ZDOTDIR/plugins
for plugin in $ZDOTDIR/plugins/*; do
if [ -d "$plugin" ]; then
cd $plugin
git pull --quiet --no-edit
fi
done
# Update package managers #
# Homebrew, macOS
if command -v brew >/dev/null 2>&1; then
brew update
brew upgrade
fi
# Arch
if command -v pacman >/dev/null 2>&1; then
sudo pacman -Syu
fi
# Debian
if command -v apt >/dev/null 2>&1; then
sudo apt update
sudo apt upgrade
fi
# Fedora
if command -v dnf >/dev/null 2>&1; then
sudo dnf update
fi
# WSL
if command -v winget.exe >/dev/null 2>&1; then
winget.exe upgrade
fi
# macOS - Rime
if [ $(uname) = "Darwin" ]; then
bash ~/plum/rime-install
fi