🐧🪟: Merge remote-tracking branch 'origin/master'

This commit is contained in:
js0ny 2024-08-12 16:37:47 +08:00
commit 87624e6573
5 changed files with 84 additions and 34 deletions

2
.npmrc
View file

@ -1,3 +1 @@
proxy=http://127.0.0.1:7890
https-proxy=http://127.0.0.1:7890
registry=https://registry.npmmirror.com

19
pathlib.json Normal file
View file

@ -0,0 +1,19 @@
{
".bashrc": "~/.bashrc",
".zshrc": "~/.zshrc",
"nvim/": "~/.config/nvim/",
".condarc": "~/.condarc",
".gitconfig": "~/.gitconfig",
".ideavimrc": "~/.ideavimrc",
"pip.conf": "~/.config/pip/pip.conf",
".npmrc": "~/.npmrc",
"Microsoft.PowerShell_profile.ps1": {
"Mac": "~/.config/powershell/Microsoft.PowerShell_profile.ps1",
"Windows": "~/Documents/PowerShell/Microsoft.PowerShell_profile.ps1"
},
".wslconfig": "~/.wslconfig",
"neovide.toml": {
"Mac": "~/.config/neovide/neovide.toml",
"Windows": "~/AppData/Local/neovide/neovide.toml"
}
}

33
powershell/bw.ps1 Normal file
View file

@ -0,0 +1,33 @@
function Get-Password {
param (
[Parameter(Mandatory = $true)]
[string]$Name,
[Boolean]$Hidden = $true
)
$result = (bw list items --search $Name | ConvertFrom-Json).login | Select-Object -Property username, password
if ($result.Length -eq 0) {
Write-Host -ForegroundColor Red "No password found"
return
}
elseif ($result.Length -gt 1) {
Write-Host -ForegroundColor Red "More than one password found, please specify"
$counter = 0
foreach ($username in $result.username) {
Write-Host "["$counter "]" $username
$counter++
}
$selector = Read-Host -MaskInput "Select the username"
if ($result[$selector] -eq "") {
Write-Host -ForegroundColor Red "Invalid selection"
return
}
$result = $result[$selector]
}
if ($Hidden) {
Write-Host -ForegroundColor Green "Password copied to clipboard"
Set-Clipboard -Value $result.password
} else {
Write-Host $result
}
return $result
}

View file

@ -48,7 +48,13 @@ ${function:doku} = { Set-Location -Path ~\MyDocuments && Get-ChildItem }
# Shell Equivalents #
Set-Alias "touch" "New-Item"
Set-Alias "open" "explorer.exe"
function open {
if ($args.Count -eq 0) {
explorer.exe .
} else {
explorer.exe $args[0]
}
}
# Shell Configurations #
@ -63,20 +69,20 @@ ${function:csi} = { dotnet script }
# C & C++ #
Set-Alias "cl" "clang"
Set-Alias "clpp" "clang++"
Set-Alias "clang" "clang -std=c99"
Set-Alias "clang++" "clang++ -std=c++2b"
# Set-Alias "cl" "clang"
# Set-Alias "clpp" "clang++"
# ${function:clang} = { clang -std=c99 $args[0] }
# ${function:clang++} = { clang -std=c++2b $args[0] }
# Python & Conda #
Set-Alias "python3" "python"
Set-Alias "pip3" "pip"
Set-Alias "py" "python"
Set-Alias "pyact" "conda activate"
Set-Alias "pylsenv" "conda env list"
Set-Alias "pydeact" "conda deactivate"
Set-Alias "pymkenv" "conda create --name"
${function:pyact} = { conda activate $args[0] }
${function:pylsenvs} = { conda env list }
${function:pydact} = { conda deactivate }
${function:pymkenv} = { conda create --name $args[0] }
# # Git #
@ -106,33 +112,23 @@ Set-Alias "gvi" "neovide"
# Miscs #
Set-Alias mcd CreateAndSet-Directory
### Functions ###
function tc { param ( [string] $filename)
New-Item $filename && code $filename
}
function tv { param ( [string] $filename)
New-Item $filename && nvim $filename
}
function cdls { param( [string] $dirname)
Set-Location $dirname && Get-ChildItem
}
function mkcd { param ( [string] $dirname) mkdir $dirname && Set-Location $dirname}
function tc { param ( [string] $filename) New-Item $filename && code $filename }
function tv { param ( [string] $filename) New-Item $filename && nvim $filename }
function cdls { param( [string] $dirname) Set-Location $dirname && Get-ChildItem }
### Modules ###
$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
if (Test-Path($ChocolateyProfile)) { Import-Module "$ChocolateyProfile" }
Import-Module -Name Microsoft.WinGet.CommandNotFound #f45873b3-b655-43a6-b217-97c00aa0db58
Import-Module CompletionPredictor
### Misc ###
## Conda ##
#region conda initialize
# !! Contents within this block are managed by 'conda init' !!
If (Test-Path "$HOME\miniconda3\Scripts\conda.exe") {
@ -140,19 +136,15 @@ If (Test-Path "$HOME\miniconda3\Scripts\conda.exe") {
}
#endregion
### Check Start Up ###
## Check Start Up ##
$SystemlogFilePath = "$env:USERPROFILE\.PowerShellStartup.log"
# 检查日志文件是否存在
if (-not (Test-Path $SystemlogFilePath)) {
New-Item -Path $SystemlogFilePath -ItemType File -Force | Out-Null
}
# 读取日志文件的最后一行(即上次启动日期)
$__lastStartup = Get-Content -Path $SystemlogFilePath -Tail 1 -ErrorAction SilentlyContinue
$_currentDate = (Get-Date).ToString("yyyy-MM-dd")
if (-not ($__lastStartup -eq $_currentDate)) {
Get-Date
Update-ForexData &
@ -160,3 +152,8 @@ if (-not ($__lastStartup -eq $_currentDate)) {
# 记录当前日期到日志文件
$_currentDate | Out-File -FilePath $SystemlogFilePath -Append
}
## Chocolatey ##
$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
if (Test-Path($ChocolateyProfile)) { Import-Module "$ChocolateyProfile" }

View file

@ -158,7 +158,9 @@
"font":
{
"face": "CaskaydiaCove Nerd Font"
}
},
"opacity": 100,
"useAcrylic": false
},
"list":
[
@ -171,7 +173,8 @@
"name": "PowerShell",
"opacity": 100,
"scrollbarState": "hidden",
"source": "Windows.Terminal.PowershellCore"
"source": "Windows.Terminal.PowershellCore",
"useAcrylic": true
},
{
"guid": "{3c5d580b-1c52-55ce-89c9-57119457e5a7}",