From: Edward Delaporte Date: Mon, 13 Nov 2023 14:17:26 +0000 (-0600) Subject: Merge branch 'main' of github.com:edthedev/dotfiles X-Git-Url: https://apps.delaporte.us/gitweb/dotfiles.git/commitdiff_plain/efae2fef386d0ef034983eecfdcdae31c5404d48?hp=0f4b589cfb23f913262bd4f52f264cca7e358cfd Merge branch 'main' of github.com:edthedev/dotfiles --- diff --git a/doc/start_windows.md b/doc/start_windows.md index 539194e..29629ac 100644 --- a/doc/start_windows.md +++ b/doc/start_windows.md @@ -56,3 +56,18 @@ Set git username. git config --global user.email "edward@delaporte.us" git config --global user.name "Edward Delaporte" ``` + + +## Setup PowerShell Profile + +Edit your actual profile, +``` +code $profile +``` + +And add something like: + +``` powershell +$env:realProfile = "$HOME\dotfiles\files\Microsoft.PowerShell_profile.ps1" +$profileContents = [string]::join([environment]::newline, (get-content -path $env:realProfile));invoke-expression $profileContents +``` diff --git a/doc/synoloyg_nas.md b/doc/synoloyg_nas.md new file mode 100644 index 0000000..6029b6e --- /dev/null +++ b/doc/synoloyg_nas.md @@ -0,0 +1,13 @@ + + +## Client Setup + +1. In the Synology web interface, under 'Synology Drive', there are direct links to download the Drive client. + +1. Setup a sync job or two. + +1. You're going to want to edit XLS files. + + ```powershell + winget install --id=TheDocumentFoundation.LibreOffice -e + ``` \ No newline at end of file diff --git a/files/Microsoft.PowerShell_profile.ps1 b/files/Microsoft.PowerShell_profile.ps1 index 4b70fe8..04d9c45 100644 --- a/files/Microsoft.PowerShell_profile.ps1 +++ b/files/Microsoft.PowerShell_profile.ps1 @@ -1,8 +1,8 @@ -$env:src = "~\src" -Import-Module $env:src\dotfiles\psmodules\add_to_profile.psm1 -Add-ToProfile $env:src\dotfiles\files\paths.ps1 -Add-ToProfile $env:src\dotfiles\files\env.ps1 -Add-ToProfile $env:src\dotfiles\files\load_modules.ps1 +$env:src = "$HOME\src" +$env:dotfiles = "$HOME\dotfiles" +Import-Module $env:dotfiles\psmodules\add_to_profile.psm1 +Add-ToProfile $env:dotfiles\files\paths.ps1 +Add-ToProfile $env:dotfiles\files\env.ps1 # Delay loading PoshGit for speed. function Enable-PoshGit { @@ -22,6 +22,13 @@ Set-PSReadlineOption -EditMode Vi Write-Host "+ Type 'pg' to enable PoshGit" Write-Host 'See $env:realProfile for version controlled profile file.' + +# Load some modules +$env:psmodules = "$env:dotfiles\psmodules" +Import-Module "$env:psmodules\dash.psm1" +Import-Module $env:PSModules\file_management.psm1 +Import-Module "$env:psmodules\fix_vpn.psm1" + # Let's face it, I'm about to cd into my source directory if((Get-Location).Path -eq $HOME){ cd $env:src } @@ -29,4 +36,4 @@ function Get-JournalAgenda() { # Write-Host "Reading from $HOME\Journal\{YYYY}\{MM}-{DD}.md" agenda.exe -path "$HOME\Journal\{YYYY}\{MM}-{DD}.md" } -New-Alias today Get-JournalAgenda \ No newline at end of file +New-Alias today Get-JournalAgenda diff --git a/files/load_modules.ps1 b/files/load_modules.ps1 index 3804802..e69de29 100644 --- a/files/load_modules.ps1 +++ b/files/load_modules.ps1 @@ -1,5 +0,0 @@ - -$modPath = "$env:src\dotfiles\psmodules" -Import-Module "$modPath\dash.psm1" -Import-Module "$modPath\drivespace.psm1" -Import-Module "$modPath\fix_vpn.psm1" \ No newline at end of file diff --git a/files/paths.ps1 b/files/paths.ps1 index 1b53bb8..b57e14a 100644 --- a/files/paths.ps1 +++ b/files/paths.ps1 @@ -15,10 +15,10 @@ function Add-ToPath { if($IsWindows){ # Some Paths that are annoying to find/restore if the installer fails Add-ToPath "C:\Program Files\Git\cmd" # Version control is nice. - Add-ToPath "C:\Program Files\Microsoft VS Code\bin" # One Editor to rule them all + Add-ToPath "C:\Program Files\Microsoft VS Code\bin" -optional # One Editor to rule them all Add-ToPath "C:\Program Files\Git\cmd" # Version control is nice. Add-ToPath "C:\ProgramData\chocolatey\bin" # Package management is nice. - Add-ToPath "C:\Program Files (x86)\GnuWin32\bin" # GNU Utils - i.e. rm + Add-ToPath "C:\Program Files (x86)\GnuWin32\bin" -optional # GNU Utils - i.e. rm Add-ToPath "C:\bin\x16emu" -optional # X16 Emulator Add-ToPath "$env:src\x16-demo\tools" -optional # x16 python tools Add-ToPath "$env:src\flutter\bin" -optional # Flutter for Dart @@ -35,4 +35,8 @@ else { # Command line tools Add-ToPath "$env:src\chart" -optional # command line chart utility edthedev\chart Add-ToPath "$env:src\agenda" -optional # command line chart utility edthedev\chart -Add-ToPath "$env:src\todolist" -optional # todo list utility edthedev\todolist \ No newline at end of file +Add-ToPath "$env:src\todolist" -optional # todo list utility edthedev\todolist + + +# $env:path+=";C:\Program Files\Git\bin" +# $env:path+=";C:\Program Files (x86)\Microsoft VS Code\" diff --git a/psmodules/drivespace.psm1 b/psmodules/file_management.psm1 similarity index 68% rename from psmodules/drivespace.psm1 rename to psmodules/file_management.psm1 index b946f86..bbb6fa1 100644 --- a/psmodules/drivespace.psm1 +++ b/psmodules/file_management.psm1 @@ -42,3 +42,20 @@ Get-Job -Name "FileCollection" | Remove-Job Export-ModuleMember -Function Show-DriveSpace Export-ModuleMember -Function Show-LargeFiles + +# Stay awake to allow large transfers to complete +# without permanently giving up battery saving features +function Invoke-StayAwake() { + param($minutes=90) + $wsh = New-Object -ComObject WScript.Shell + do{ + "Staying awake for $minutes minutes" + $minutes-=1; + # Send Shift+F15 + $wsh.SendKeys('+{F15}') + Start-Sleep -seconds 59 + }until($minutes -lt 0) + # Thank you to http://www.zhornsoftware.co.uk/caffeine/ +} + +Export-ModuleMember -Function Invoke-StayAwake \ No newline at end of file diff --git a/psmodules/sprint.psm1 b/psmodules/sprint.psm1 deleted file mode 100644 index 74040fb..0000000 --- a/psmodules/sprint.psm1 +++ /dev/null @@ -1,33 +0,0 @@ - -function Show-SprintCharts(){ - $closed = Get-GHClosed - $closed_count = ($closed | Measure-Object).Count - Add-Content -Path ~/.chart_closed -Value "|$closed_count" - $env:closed = Get-Content -Path ~/.chart_closed - - $orphans = Get-GHNoMilestone -repository SecOps-Tools - $orphans_count = ($orphans | Measure-Object -Property updated_at -Min -Max).Count - Add-Content -Path ~/.chart_orphans -Value "|$orphans_count" - $env:orphans = Get-Content -Path ~/.chart_orphans - - $unsized = Get-GHUnsized - $unsized_count = ($unsized | Measure-Object).Count - Add-Content -Path ~/.chart_unsized -Value "|$unsized_count" - $env:unsized = Get-Content -Path ~/.chart_unsized - - Write-Host "## Closed Issues this Sprint: $closed_count" - Write-Host "'''sh" - chart -var "closed" - Write-Host "''' " - Write-Host "## Count of Unsized Issues: $unsized_count" - Write-Host "'''sh" - chart -var "unsized" - Write-Host "''' " - Write-Host "## Count of Issues with no milestone: $orphans_count" - Write-Host "'''sh" - chart -var "orphans" - Write-Host "''' " - -} - -Export-ModuleMember -Function Show-SprintCharts \ No newline at end of file diff --git a/win/stay_awake.ps1 b/psmodules/stay_awake.psm1 similarity index 100% rename from win/stay_awake.ps1 rename to psmodules/stay_awake.psm1