]> apps.delaporte.us Git - dotfiles.git/blob - files/Microsoft.PowerShell_profile.ps1
b14b695f24c690241c84e4d75849895e46e932e0
[dotfiles.git] / files / Microsoft.PowerShell_profile.ps1
1 #WebDriverException: Message: nknown error: cannot determine loading status .EXAMPLE
2 # . C:\src\dotfiles\Microsoft.PowerShell_profile.ps1
3
4 # Courtesty of MKletz
5 # Get-ChildItem -Path 'C:\Repos' -Filter "*.psd1" -Recurse | ForEach-Object -Process {
6 # $Path = Split-Path -Path $_.Directory -Parent
7 # $env:PSModulePath = $env:PSModulePath + ";$($Path)"
8 #}
9 # $env:PSModulePath = $env:PSModulePath.Replace("\\ad.uillinois.edu\techsvc\home\$($ENV:USERNAME)\Documents\PowerShell\Modules;",'')
10
11 function Add-ToProfile {
12 param (
13 $Path
14 )
15 $profileContents = [string]::join([environment]::newline, (get-content -path $Path))
16 invoke-expression $profileContents
17 }
18
19
20 $env:src = "~\src"
21 if($IsWindows){
22 $env:src = "c:\src"
23 }
24
25 Add-ToProfile $env:src\dotfiles\files\paths.ps1
26 Add-ToProfile $env:src\dotfiles\files\env.ps1
27
28 # You can pry my unix commands out of my cold dead fingers
29 Set-Alias which get-command
30
31 # Linux-like up/down in shell
32 Set-PSReadlineKeyHandler -Key UpArrow -Function HistorySearchBackward
33 Set-PSReadlineKeyHandler -Key DownArrow -Function HistorySearchForward
34 Set-PSReadlineOption -HistorySavePath $env:src\PSHistory.log
35
36 # Delay loading PoshGit for speed.
37 function Enable-PoshGit {
38 Import-Module posh-git
39 }
40 New-Alias pg Enable-PoshGit
41 Write-Host "+ Type 'pg' to enable PoshGit"
42
43
44 if((Get-Location).Path -eq $HOME){
45 cd $env:src
46 }
47
48 function Get-GitLog() {
49 git log --oneline
50 }
51
52 function Get-GitStatus() {
53 git status -b --short
54 }
55
56 # Tell my scripts which GitHub repositories to look in.
57 $env:GITHUB_USERNAME = 'edthedev'
58 $env:GITHUB_REPOS = @(
59 'techservicesillinois/SecOps-Tools',
60 'techservicesillinois/secdev-job-aids',
61 'techservicesillinois/awscli-login',
62 'techservicesillinois/farmit',
63 'uillinois-community/uillinois-community.github.io',
64 'techservicesillinois/SecOps-Powershell-CSOC',
65 'techservicesillinois/SecOps-Powershell-CISDSC',
66 'techservicesillinois/secops-splunk-null-router'
67 ) -join ' '
68 $ENV:TS_REPOS = $ENV:GITHUB_REPOS.split(' ') | Where { $_ -like 'techser*' }
69
70
71 # Nice for git
72 New-Alias ol Get-GitLog
73 New-Alias st Get-GitStatus
74
75 # Dashboard
76 New-Alias dash Show-MyDashboard # from dash.psm1
77
78 function Get-JournalAgenda() {
79 agenda.exe -path "$HOME/Journal/{YYYY}/{MM}-{DD}.md"
80 }
81 New-Alias today Get-JournalAgenda
82
83 function Invoke-FixWslVPN {
84 Get-NetAdapter | Where-Object {$_.InterfaceDescription -Match "Cisco AnyConnect Secure Mobility Client Virtual Miniport Adapter for Windows x64"} | Set-NetIPInterface -InterfaceMetric 6000
85 }
86
87 # Write-Host "Real profile file is at $env:realProfile ($$env:realProfile)"