initial commit

This commit is contained in:
unknown 2024-05-05 05:16:33 -07:00
commit 2f8e159892
8 changed files with 836 additions and 0 deletions

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
*.zip
*.ttf
oldprofile.ps1

28
README.md Normal file
View File

@ -0,0 +1,28 @@
# Rezz Dotfiles
# 🎨 Rezz ZSH Profile
```
coming soon...
```
# 🎨 Rezz PowerShell Profile
Based off of https://github.com/ChrisTitusTech/powershell-profile with some minor changes.
Execute the following command in an elevated PowerShell window to install the PowerShell profile:
```
irm "https://raw.githubusercontent.com/rezzect/rezz-dotfiles/master/pwsh/setup.ps1" | iex
```
# ⌨️ Rezz SSH Authorized Keys
🐧Linux
```
coming soon...
```
🪟Windows
```
coming soon...
```

View File

@ -0,0 +1,418 @@
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"version": 2,
"final_space": true,
"console_title_template": "{{.UserName}}@{{.HostName}}:{{.PWD}}",
"blocks": [
{
"type": "prompt",
"alignment": "left",
"segments": [
{
"type": "os",
"style": "diamond",
"foreground": "#011627",
"background": "#21c7a8",
"leading_diamond": "\u256d\u2500\ue0b6",
"trailing_diamond": "\ue0b0",
"template": " {{ if .WSL }}WSL at {{ end }}{{.Icon}} ",
"properties": {
"windows": "\ue62a"
}
},
{
"type": "root",
"style": "powerline",
"powerline_symbol": "\ue0b0",
"foreground": "#ffeb95",
"background": "#ef5350",
"template": " \uf292 "
},
{
"type": "path",
"style": "powerline",
"powerline_symbol": "\ue0b0",
"foreground": "#011627",
"background": "#82AAFF",
"template": "{{ path .Path .Location }}",
"properties": {
"folder_icon": "\uf07c ",
"folder_separator_icon": "<#011627>\ue0b1</> ",
"home_icon": " \ueb06 ",
"style": "agnoster"
}
},
{
"type": "git",
"style": "powerline",
"powerline_symbol": "\ue0b0",
"foreground": "#011627",
"background": "#addb67",
"background_templates": [
"{{ if or (.Working.Changed) (.Staging.Changed) }}#e4cf6a{{ end }}",
"{{ if and (gt .Ahead 0) (gt .Behind 0) }}#f78c6c{{ end }}",
"{{ if gt .Ahead 0 }}#C792EA{{ end }}",
"{{ if gt .Behind 0 }}#c792ea{{ end }}"
],
"template": " {{ url .UpstreamIcon .UpstreamURL }}{{ .HEAD }}{{if .BranchStatus }} {{ .BranchStatus }}{{ end }}{{ if .Working.Changed }} \uf044 {{ .Working.String }}{{ end }}{{ if and (.Working.Changed) (.Staging.Changed) }} |{{ end }}{{ if .Staging.Changed }} \uf046 {{ .Staging.String }}{{ end }}{{ if gt .StashCount 0 }} \ueb4b {{ .StashCount }}{{ end }} ",
"properties": {
"branch_icon": "\ue725 ",
"fetch_stash_count": true,
"fetch_status": true,
"fetch_upstream_icon": true,
"fetch_worktree_count": true
}
},
{
"type": "executiontime",
"style": "diamond",
"foreground": "#d6deeb",
"background": "#575656",
"leading_diamond": "<transparent,#575656>\ue0b0</>",
"trailing_diamond": "\ue0b4",
"template": " {{ .FormattedMs }}",
"properties": {
"style": "roundrock",
"threshold": 0
}
}
]
},
{
"type": "prompt",
"alignment": "right",
"segments": [
{
"type": "shell",
"style": "diamond",
"foreground": "#011627",
"background": "#d6deeb",
"leading_diamond": "\ue0b6",
"trailing_diamond": "<transparent,#d6deeb>\ue0b2</>",
"template": "\uf489 {{ .Name }} "
},
{
"type": "sysinfo",
"style": "diamond",
"foreground": "#ffffff",
"background": "#8f43f3",
"leading_diamond": "\ue0b2",
"trailing_diamond": "<transparent,#8f43f3>\ue0b2</>",
"template": "\ue266 {{ round .PhysicalPercentUsed .Precision }}% "
},
{
"type": "angular",
"style": "diamond",
"foreground": "#ce092f",
"background": "#ffffff",
"leading_diamond": "\ue0b2",
"trailing_diamond": "<transparent,#ffffff>\ue0b2</>",
"template": "\ue753 {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} "
},
{
"type": "aws",
"style": "diamond",
"foreground": "#faa029",
"background": "#565656",
"leading_diamond": "\ue0b2",
"trailing_diamond": "<transparent,#565656>\ue0b2</>",
"template": "\ue7ad {{ .Profile }}{{ if .Region }}@{{ .Region }}{{ end }} "
},
{
"type": "az",
"style": "diamond",
"foreground": "#337bb6",
"background": "#ffffff",
"leading_diamond": "\ue0b2",
"trailing_diamond": "<transparent,#ffffff>\ue0b2</>",
"template": "\uebd8 {{ .EnvironmentName }} "
},
{
"type": "azfunc",
"style": "diamond",
"foreground": "#5398c2",
"background": "#ffffff",
"leading_diamond": "\ue0b2",
"trailing_diamond": "<transparent,#ffffff>\ue0b2</>",
"template": "\uf104<#f5bf45>\uf0e7</>\uf105 {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} "
},
{
"type": "cds",
"style": "diamond",
"foreground": "#100e23",
"background": "#5a7a94",
"leading_diamond": "\ue0b2",
"trailing_diamond": "<transparent,#5a7a94>\ue0b2</>",
"template": "\ue311 cds {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} "
},
{
"type": "crystal",
"style": "diamond",
"foreground": "#000000",
"background": "#ffffff",
"leading_diamond": "\ue0b2",
"trailing_diamond": "<transparent,#000000>\ue0b2</>",
"template": "\ue370 {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} "
},
{
"type": "cf",
"style": "diamond",
"foreground": "#1d5185",
"background": "#ffffff",
"leading_diamond": "\ue0b2",
"trailing_diamond": "<transparent,#ffffff>\ue0b2</>",
"template": "\uf40a cf {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} "
},
{
"type": "cftarget",
"style": "diamond",
"foreground": "#1d5185",
"background": "#ffffff",
"leading_diamond": "\ue0b2",
"trailing_diamond": "<transparent,#ffffff>\ue0b2</>",
"template": "\uf40a {{if .Org }}{{ .Org }}{{ end }}{{ if .Space }}/{{ .Space }}{{ end }} "
},
{
"type": "cmake",
"style": "diamond",
"foreground": "#01a300",
"background": "#d2d2d2",
"leading_diamond": "\ue0b2",
"trailing_diamond": "<transparent,#d2d2d2>\ue0b2</>",
"template": "<#2829b2>\ue61e</> <#be1818>\ue61d</> cmake {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} "
},
{
"type": "dart",
"style": "diamond",
"foreground": "#055b9c",
"background": "#e1e8e9",
"leading_diamond": "\ue0b2",
"trailing_diamond": "<transparent,#e1e8e9>\ue0b2</>",
"template": "\ue798 {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} "
},
{
"type": "dotnet",
"style": "diamond",
"foreground": "#0d6da8",
"background": "#0e0e0e",
"leading_diamond": "\ue0b2",
"trailing_diamond": "<transparent,#0e0e0e>\ue0b2</>",
"template": "\ue77f {{ if .Unsupported }}\uf071{{ else }}{{ .Full }}{{ end }} "
},
{
"type": "flutter",
"style": "diamond",
"foreground": "#ffffff",
"background": "#06A4CE",
"leading_diamond": "\ue0b2",
"trailing_diamond": "<transparent,#06A4CE>\ue0b2</>",
"template": "\ue28e {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} "
},
{
"type": "go",
"style": "diamond",
"foreground": "#06aad5",
"background": "#ffffff",
"leading_diamond": "\ue0b2",
"trailing_diamond": "<transparent,#ffffff>\ue0b2</>",
"template": "\ue626 {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} "
},
{
"type": "haskell",
"style": "diamond",
"foreground": "#906cff",
"background": "#100e23",
"leading_diamond": "\ue0b2",
"trailing_diamond": "<transparent,#100e23>\ue0b2</>",
"template": "\ue61f {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} "
},
{
"type": "java",
"style": "diamond",
"foreground": "#ec2729",
"background": "#ffffff",
"leading_diamond": "\ue0b2",
"trailing_diamond": "<transparent,#ffffff>\ue0b2</>",
"template": "\ue738 {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} "
},
{
"type": "julia",
"style": "diamond",
"foreground": "#ffffff",
"background": "#945bb3",
"leading_diamond": "\ue0b2",
"trailing_diamond": "<transparent,#945bb3>\ue0b2</>",
"template": "<#ca3c34>\ue624</> {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} "
},
{
"type": "kotlin",
"style": "diamond",
"foreground": "#ffffff",
"background": "#906cff",
"leading_diamond": "\ue0b2",
"trailing_diamond": "<transparent,#906cff>\ue0b2</>",
"template": "K {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} "
},
{
"type": "kubectl",
"style": "diamond",
"foreground": "#ffffff",
"background": "#316ce4",
"leading_diamond": "\ue0b2",
"trailing_diamond": "<transparent,#316ce4>\ue0b2</>",
"template": "\uf308 {{.Context}} :: {{if .Namespace}}{{.Namespace}}{{else}}default{{end}} "
},
{
"type": "lua",
"style": "diamond",
"foreground": "#000081",
"background": "#ffffff",
"leading_diamond": "\ue0b2",
"trailing_diamond": "<transparent,#ffffff>\ue0b2</>",
"template": "\ue620 {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} "
},
{
"type": "node",
"style": "diamond",
"foreground": "#3C873A",
"background": "#303030",
"leading_diamond": "\ue0b2",
"trailing_diamond": "<transparent,#303030>\ue0b2</>",
"template": "\ue718 {{ if .PackageManagerIcon }}{{ .PackageManagerIcon }} {{ end }}{{ .Full }} ",
"properties": {
"fetch_package_manager": true,
"npm_icon": "<#cc3a3a>\ue71e</> ",
"yarn_icon": "<#348cba>\ue6a7</> "
}
},
{
"type": "nx",
"style": "diamond",
"foreground": "#1e293b",
"background": "#6488c0",
"leading_diamond": "\ue0b2",
"trailing_diamond": "<transparent,#6488c0>\ue0b2</>",
"template": "Nx {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} "
},
{
"type": "perl",
"style": "diamond",
"foreground": "#ffffff",
"background": "#41436d",
"leading_diamond": "\ue0b2",
"trailing_diamond": "<transparent,#41436d>\ue0b2</>",
"template": "\ue769 {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} "
},
{
"type": "php",
"style": "diamond",
"foreground": "#000000",
"background": "#787CB5",
"leading_diamond": "\ue0b2",
"trailing_diamond": "<transparent,#787CB5>\ue0b2</>",
"template": "\ue73d {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} "
},
{
"type": "python",
"style": "diamond",
"foreground": "#FFE873",
"background": "#306998",
"leading_diamond": "\ue0b2",
"trailing_diamond": "<transparent,#306998>\ue0b2</>",
"template": "\ue235 {{ if .Error }}{{ .Error }}{{ else }}{{ if .Venv }}{{ .Venv }} {{ end }}{{ .Full }}{{ end }}"
},
{
"type": "r",
"style": "diamond",
"foreground": "#1c68bd",
"background": "#b9bbbf",
"leading_diamond": "\ue0b2",
"trailing_diamond": "<transparent,#b9bbbf>\ue0b2</>",
"template": "R {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} "
},
{
"type": "ruby",
"style": "diamond",
"foreground": "#9c1006",
"background": "#ffffff",
"leading_diamond": "\ue0b2",
"trailing_diamond": "<transparent,#ffffff>\ue0b2</>",
"template": "\ue791 {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} "
},
{
"type": "rust",
"style": "diamond",
"foreground": "#000000",
"background": "#ffffff",
"leading_diamond": "\ue0b2",
"trailing_diamond": "<transparent,#ffffff>\ue0b2</>",
"template": "\ue7a8 {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} "
},
{
"type": "swift",
"style": "diamond",
"foreground": "#ffffff",
"background": "#fe562e",
"leading_diamond": "\ue0b2",
"trailing_diamond": "<transparent,#fe562e>\ue0b2</>",
"template": "\ue755 {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} "
},
{
"type": "time",
"style": "diamond",
"foreground": "#d6deeb",
"background": "#234d70",
"leading_diamond": "\ue0b2",
"trailing_diamond": "\ue0b4",
"template": "\ue641 {{ .CurrentDate | date .Format }}",
"properties": {
"time_format": "3:04PM"
}
}
],
"overflow": "break"
},
{
"type": "prompt",
"alignment": "left",
"segments": [
{
"type": "text",
"style": "plain",
"foreground": "#21c7a8",
"template": "\u2570\u2500"
},
{
"type": "spotify",
"style": "diamond",
"foreground": "#011627",
"background": "#1DB954",
"leading_diamond": "\ue0b6",
"trailing_diamond": "\ue0c6 ",
"template": " {{ .Icon }}{{ if ne .Status \"stopped\" }}{{ .Artist }} ~ {{ .Track }}{{ end }} ",
"properties": {
"playing_icon": "\uf1bc "
}
},
{
"type": "status",
"style": "plain",
"foreground": "#22da6e",
"foreground_templates": [
"{{ if gt .Code 0 }}#ef5350{{ end }}"
],
"template": "\ue285\ue285",
"properties": {
"always_enabled": true
}
}
],
"newline": true
}
],
"transient_prompt": {
"foreground": "#d6deeb",
"background": "transparent",
"template": "\ue285 "
}
}

4
pwsh/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
*.zip
*.ttf
oldprofile.ps1

View File

@ -0,0 +1,246 @@
### PowerShell Profile Refactor
### Version 1.03 - Refactored
# Initial GitHub.com connectivity check with 1 second timeout
$canConnectToGitHub = Test-Connection github.com -Count 1 -Quiet -TimeoutSeconds 1
# Import Modules and External Profiles
# Ensure Terminal-Icons module is installed before importing
if (-not (Get-Module -ListAvailable -Name Terminal-Icons)) {
Install-Module -Name Terminal-Icons -Scope CurrentUser -Force -SkipPublisherCheck
}
Import-Module -Name Terminal-Icons
$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
if (Test-Path($ChocolateyProfile)) {
Import-Module "$ChocolateyProfile"
}
# Check for Profile Updates
function Update-Profile {
if (-not $global:canConnectToGitHub) {
Write-Host "Skipping profile update check due to GitHub.com not responding within 1 second." -ForegroundColor Yellow
return
}
try {
$url = "https://raw.githubusercontent.com/rezzect/rezz-dotfiles/master/pwsh/Microsoft.PowerShell_profile.ps1"
$oldhash = Get-FileHash $PROFILE
Invoke-RestMethod $url -OutFile "$env:temp/Microsoft.PowerShell_profile.ps1"
$newhash = Get-FileHash "$env:temp/Microsoft.PowerShell_profile.ps1"
if ($newhash.Hash -ne $oldhash.Hash) {
Copy-Item -Path "$env:temp/Microsoft.PowerShell_profile.ps1" -Destination $PROFILE -Force
Write-Host "Profile has been updated. Please restart your shell to reflect changes" -ForegroundColor Magenta
}
} catch {
Write-Error "Unable to check for `$profile updates"
} finally {
Remove-Item "$env:temp/Microsoft.PowerShell_profile.ps1" -ErrorAction SilentlyContinue
}
}
Update-Profile
function Update-PowerShell {
if (-not $global:canConnectToGitHub) {
Write-Host "Skipping PowerShell update check due to GitHub.com not responding within 1 second." -ForegroundColor Yellow
return
}
try {
Write-Host "Checking for PowerShell updates..." -ForegroundColor Cyan
$updateNeeded = $false
$currentVersion = $PSVersionTable.PSVersion.ToString()
$gitHubApiUrl = "https://api.github.com/repos/PowerShell/PowerShell/releases/latest"
$latestReleaseInfo = Invoke-RestMethod -Uri $gitHubApiUrl
$latestVersion = $latestReleaseInfo.tag_name.Trim('v')
if ($currentVersion -lt $latestVersion) {
$updateNeeded = $true
}
if ($updateNeeded) {
Write-Host "Updating PowerShell..." -ForegroundColor Yellow
winget upgrade "Microsoft.PowerShell" --accept-source-agreements --accept-package-agreements
Write-Host "PowerShell has been updated. Please restart your shell to reflect changes" -ForegroundColor Magenta
} else {
Write-Host "Your PowerShell is up to date." -ForegroundColor Green
}
} catch {
Write-Error "Failed to update PowerShell. Error: $_"
}
}
Update-PowerShell
# Admin Check and Prompt Customization
$isAdmin = ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
function prompt {
if ($isAdmin) { "[" + (Get-Location) + "] # " } else { "[" + (Get-Location) + "] $ " }
}
$adminSuffix = if ($isAdmin) { " [ADMIN]" } else { "" }
$Host.UI.RawUI.WindowTitle = "PowerShell {0}$adminSuffix" -f $PSVersionTable.PSVersion.ToString()
# Utility Functions
function Test-CommandExists {
param($command)
$exists = $null -ne (Get-Command $command -ErrorAction SilentlyContinue)
return $exists
}
# Editor Configuration
$EDITOR = if (Test-CommandExists nano) { 'nano' }
elseif (Test-CommandExists notepad++) { 'notepad++' }
else { 'notepad' }
Set-Alias -Name nano -Value $EDITOR
function Edit-Profile {
nano $PROFILE.CurrentUserAllHosts
}
function touch($file) { "" | Out-File $file -Encoding ASCII }
function ff($name) {
Get-ChildItem -recurse -filter "*${name}*" -ErrorAction SilentlyContinue | ForEach-Object {
Write-Output "$($_.directory)\$($_)"
}
}
# Network Utilities
function Get-PubIP { (Invoke-WebRequest http://ifconfig.me/ip).Content }
# System Utilities
function uptime {
if ($PSVersionTable.PSVersion.Major -eq 5) {
Get-WmiObject win32_operatingsystem | Select-Object @{Name='LastBootUpTime'; Expression={$_.ConverttoDateTime($_.lastbootuptime)}} | Format-Table -HideTableHeaders
} else {
net statistics workstation | Select-String "since" | ForEach-Object { $_.ToString().Replace('Statistics since ', '') }
}
}
function reload-profile {
& $profile
}
function unzip ($file) {
Write-Output("Extracting", $file, "to", $pwd)
$fullFile = Get-ChildItem -Path $pwd -Filter $file | ForEach-Object { $_.FullName }
Expand-Archive -Path $fullFile -DestinationPath $pwd
}
function grep($regex, $dir) {
if ( $dir ) {
Get-ChildItem $dir | select-string $regex
return
}
$input | select-string $regex
}
function df {
get-volume
}
function sed($file, $find, $replace) {
(Get-Content $file).replace("$find", $replace) | Set-Content $file
}
function which($name) {
Get-Command $name | Select-Object -ExpandProperty Definition
}
function export($name, $value) {
set-item -force -path "env:$name" -value $value;
}
function pkill($name) {
Get-Process $name -ErrorAction SilentlyContinue | Stop-Process
}
function pgrep($name) {
Get-Process $name
}
function head {
param($Path, $n = 10)
Get-Content $Path -Head $n
}
function tail {
param($Path, $n = 10)
Get-Content $Path -Tail $n
}
# Quick File Creation
function nf { param($name) New-Item -ItemType "file" -Path . -Name $name }
# Directory Management
function mkcd { param($dir) mkdir $dir -Force; Set-Location $dir }
### Quality of Life Aliases
# Navigation Shortcuts
function docs { Set-Location -Path $HOME\Documents }
function dtop { Set-Location -Path $HOME\Desktop }
# Quick Access to Editing the Profile
function ep { nano $PROFILE }
# Simplified Process Management
function k9 { Stop-Process -Name $args[0] }
# Enhanced Listing
function la { Get-ChildItem -Path . -Force | Format-Table -AutoSize }
function ll { Get-ChildItem -Path . -Force -Hidden | Format-Table -AutoSize }
# Git Shortcuts
function gs { git status }
function ga { git add . }
function gc { param($m) git commit -m "$m" }
function gp { git push }
function g { z Github }
function gcom {
git add .
git commit -m "$args"
}
function lazyg {
git add .
git commit -m "$args"
git push
}
# Quick Access to System Information
function sysinfo { Get-ComputerInfo }
# Networking Utilities
function flushdns { Clear-DnsClientCache }
# Clipboard Utilities
function cpy { Set-Clipboard $args[0] }
function pst { Get-Clipboard }
# Alias
Set-Alias -Name btop4win -Value btop
# Enhanced PowerShell Experience
Set-PSReadLineOption -Colors @{
Command = 'Yellow'
Parameter = 'Green'
String = 'DarkCyan'
}
## Final Line to set prompt
oh-my-posh init pwsh --config https://raw.githubusercontent.com/rezzect/rezz-dotfiles/master/omp-themes/rezztheme-edit.omp.json | Invoke-Expression
if (Get-Command zoxide -ErrorAction SilentlyContinue) {
Invoke-Expression (& { (zoxide init powershell | Out-String) })
} else {
Write-Host "zoxide command not found. Attempting to install via winget..."
try {
winget install -e --id ajeetdsouza.zoxide
Write-Host "zoxide installed successfully. Initializing..."
Invoke-Expression (& { (zoxide init powershell | Out-String) })
} catch {
Write-Error "Failed to install zoxide. Error: $_"
}
}

134
pwsh/setup.ps1 Normal file
View File

@ -0,0 +1,134 @@
# Ensure the script can run with elevated privileges
if (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
Write-Warning "Please run this script as an Administrator!"
break
}
# Function to test internet connectivity
function Test-InternetConnection {
try {
$testConnection = Test-Connection -ComputerName www.google.com -Count 1 -ErrorAction Stop
return $true
}
catch {
Write-Warning "Internet connection is required but not available. Please check your connection."
return $false
}
}
# Check for internet connectivity before proceeding
if (-not (Test-InternetConnection)) {
break
}
# Profile creation or update
if (!(Test-Path -Path $PROFILE -PathType Leaf)) {
try {
# Detect Version of PowerShell & Create Profile directories if they do not exist.
$profilePath = ""
if ($PSVersionTable.PSEdition -eq "Core") {
$profilePath = "$env:userprofile\Documents\Powershell"
}
elseif ($PSVersionTable.PSEdition -eq "Desktop") {
$profilePath = "$env:userprofile\Documents\WindowsPowerShell"
}
if (!(Test-Path -Path $profilePath)) {
New-Item -Path $profilePath -ItemType "directory"
}
Invoke-RestMethod https://github.com/rezzect/rezz-dotfiles/raw/master/pwsh/Microsoft.PowerShell_profile.ps1 -OutFile $PROFILE
Write-Host "The profile @ [$PROFILE] has been created."
Write-Host "If you want to add any persistent components, please do so at [$profilePath\Profile.ps1] as there is an updater in the installed profile which uses the hash to update the profile and will lead to loss of changes"
}
catch {
Write-Error "Failed to create or update the profile. Error: $_"
}
}
else {
try {
Get-Item -Path $PROFILE | Move-Item -Destination "oldprofile.ps1" -Force
Invoke-RestMethod https://github.com/rezzect/rezz-dotfiles/raw/master/pwsh/Microsoft.PowerShell_profile.ps1 -OutFile $PROFILE
Write-Host "The profile @ [$PROFILE] has been created and old profile removed."
Write-Host "Please back up any persistent components of your old profile to [$HOME\Documents\PowerShell\Profile.ps1] as there is an updater in the installed profile which uses the hash to update the profile and will lead to loss of changes"
}
catch {
Write-Error "Failed to backup and update the profile. Error: $_"
}
}
# Nano Install
try {
winget install -e --accept-source-agreements --accept-package-agreements GNU.Nano
}
catch {
Write-Error "Failed to install Nano. Error: $_"
}
# OMP Install
try {
winget install -e --accept-source-agreements --accept-package-agreements JanDeDobbeleer.OhMyPosh
}
catch {
Write-Error "Failed to install Oh My Posh. Error: $_"
}
# Font Install
try {
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")
$fontFamilies = (New-Object System.Drawing.Text.InstalledFontCollection).Families.Name
if ($fontFamilies -notcontains "CaskaydiaCove NF") {
$webClient = New-Object System.Net.WebClient
$webClient.DownloadFileAsync((New-Object System.Uri("https://github.com/ryanoasis/nerd-fonts/releases/download/v3.2.1/CascadiaCode.zip")), ".\CascadiaCode.zip")
while ($webClient.IsBusy) {
Start-Sleep -Seconds 2
}
Expand-Archive -Path ".\CascadiaCode.zip" -DestinationPath ".\CascadiaCode" -Force
$destination = (New-Object -ComObject Shell.Application).Namespace(0x14)
Get-ChildItem -Path ".\CascadiaCode" -Recurse -Filter "*.ttf" | ForEach-Object {
If (-not(Test-Path "C:\Windows\Fonts\$($_.Name)")) {
$destination.CopyHere($_.FullName, 0x10)
}
}
Remove-Item -Path ".\CascadiaCode" -Recurse -Force
Remove-Item -Path ".\CascadiaCode.zip" -Force
}
}
catch {
Write-Error "Failed to download or install the Cascadia Code font. Error: $_"
}
# Final check and message to the user
if ((Test-Path -Path $PROFILE) -and (winget list --name "OhMyPosh" -e) -and ($fontFamilies -contains "CaskaydiaCove NF")) {
Write-Host "Setup completed successfully. Please restart your PowerShell session to apply changes."
} else {
Write-Warning "Setup completed with errors. Please check the error messages above."
}
# Choco install
try {
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
}
catch {
Write-Error "Failed to install Chocolatey. Error: $_"
}
# Terminal Icons Install
try {
Install-Module -Name Terminal-Icons -Repository PSGallery -Force
}
catch {
Write-Error "Failed to install Terminal Icons module. Error: $_"
}
# zoxide Install
try {
winget install -e --id ajeetdsouza.zoxide
Write-Host "zoxide installed successfully."
}
catch {
Write-Error "Failed to install zoxide. Error: $_"
}

1
ssh/.empty Normal file
View File

@ -0,0 +1 @@

1
zsh/.empty Normal file
View File

@ -0,0 +1 @@