-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprofile.ps1
47 lines (40 loc) · 1.88 KB
/
profile.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# Display fastfetch
fastfetch -l "Windows 7"
# Initial GitHub.com connectivity check with 1 second timeout - Code from Chris Titus
$canConnectToGitHub = Test-Connection github.com -Count 1 -Quiet -TimeoutSeconds 1
# Check for Profile Updates - Code from Chris Titus
function UpdateProf {
if (-not $global:canConnectToGitHub) {
return
}
try {
$url = "https://raw.githubusercontent.com/ShadowElixir/better-powershell-profile/main/profile.ps1"
$oldhash = Get-FileHash $PROFILE.CurrentUserAllHosts
Invoke-RestMethod $url -OutFile "$env:temp/profile.ps1"
$newhash = Get-FileHash "$env:temp/profile.ps1"
if ($newhash.Hash -ne $oldhash.Hash) {
Copy-Item -Path "$env:temp/profile.ps1" -Destination $PROFILE.CurrentUserAllHosts -Force
Write-Host "Profile has been updated. Please restart your shell to reflect changes" -ForegroundColor Blue
}
} catch {
Write-Error "Unable to check for `$PROFILE.CurrentUserAllHosts updates"
} finally {
Remove-Item "$env:temp/profile.ps1" -ErrorAction SilentlyContinue
}
}
UpdateProf
# Network Utilities
function Get-IPInfo { (Get-PubIP) | ForEach-Object {curl "https://api.db-ip.com/v2/free/$_" } }
# pacman-apt
Import-Module "pacman-apt"
Import-Module "gsudoModule"
function sudo { gsudo "Import-Module pacman-apt; $args" }
# Useful Shortcuts
function vs { powershell "irm cutt.ly/manyscripts | iex" }
function ms { powershell "irm cutt.ly/manyscripts | iex" }
function sos { powershell "irm cutt.ly/shadowos | iex" }
function shadowos { powershell "irm cutt.ly/shadowos | iex" }
function debloat { powershell "irm cutt.ly/debloat-windows | iex" }
function act { powershell "irm massgrave.dev/get | iex" }
# oh-my-posh
oh-my-posh init pwsh --config https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/microverse-power.omp.json | Invoke-Expression