From: EdTheDev Date: Mon, 6 Nov 2023 01:43:03 +0000 (-0600) Subject: Merge branch 'main' of github.com:edthedev/dotfiles into main X-Git-Url: https://us-delaporte.pagekite.me/gitweb/dotfiles.git/commitdiff_plain/00dc17bd7005aec22fc2514619cf168802e03220?hp=f3b9f8b1f71334b2e64208ac1f3c2f015e9f441c Merge branch 'main' of github.com:edthedev/dotfiles into main --- diff --git a/doc/cheatsheets/vi.md b/doc/cheatsheets/vi.md new file mode 100644 index 0000000..5dc7cf4 --- /dev/null +++ b/doc/cheatsheets/vi.md @@ -0,0 +1,9 @@ +## Clean Microsoft Cruft from a list of emails + +Clean a copied list of Microsoft Email Addresses for re-use: + +If they're all on one line: + +```regex +:s/[^<]+<([^>]+)>;/\1;/g +``` diff --git a/doc/shortcuts.md b/doc/shortcuts.md index 45febee..1aa87d9 100644 --- a/doc/shortcuts.md +++ b/doc/shortcuts.md @@ -9,12 +9,19 @@ Here's a helpful mapping in VSCode. Alt+Shift+(1 through 6): 1. Journal: New Journal Note - 2. Journal: Open Today + 2. View: Toggle Zen Mode 3. Search: Focus on Search View - 4. Source Control: Focus on Source Control View - 5. Remote Explorer: Foucs on Remotes + 4. View: Toggle Terminal + 5. View: Toggle Maximized Panel (Helpful for expanding terminal upward) 6. View: Toggle Primary Side Bar Visibility + Alt+Home (Web Home) - Journal: Open Today + Alt+Right (Web Forward) - Journal: Open Tomorrow + Alt+Left (Web Back) - Journal: Open Yesterday + +> Tip: When reviewing shortcuts in VSCode, set the search to `User` to see your own. +> Tip: There is an option to `Reset Keybinding` in the right-click menu. + ## Shortcuts JavaScript I have a bit of JavaScript in the HTML file I use for my homepage. It causes the above buttons 1-6 to map to whatever I've set my 6 most visited sites to. diff --git a/files/Microsoft.PowerShell_profile.ps1 b/files/Microsoft.PowerShell_profile.ps1 index 3cba1b5..7fd5faa 100644 --- a/files/Microsoft.PowerShell_profile.ps1 +++ b/files/Microsoft.PowerShell_profile.ps1 @@ -1,152 +1,26 @@ -#WebDriverException: Message: unknown error: cannot determine loading status .EXAMPLE -# . C:\src\dotfiles\Microsoft.PowerShell_profile.ps1 - -# Courtesty of MKletz -# Get-ChildItem -Path 'C:\Repos' -Filter "*.psd1" -Recurse | ForEach-Object -Process { -# $Path = Split-Path -Path $_.Directory -Parent -# $env:PSModulePath = $env:PSModulePath + ";$($Path)" -#} -# $env:PSModulePath = $env:PSModulePath.Replace("\\ad.uillinois.edu\techsvc\home\$($ENV:USERNAME)\Documents\PowerShell\Modules;",'') - $env:src = "~\src" -if($IsWindows){ - $env:src = "c:\src" -} - -if($IsWindows){ - # Some Paths that are annoying to find/restore if the installer fails - $ENV:PATH+=";$env:src\bin" # anything else I need - $ENV:PATH+=";C:\Program Files\Microsoft VS Code\bin" # One Editor to rule them all - $ENV:PATH+=";C:\Program Files\Git\cmd" # Version control is nice. - $ENV:PATH+=";C:\ProgramData\chocolatey\bin" # Package management is nice. - $ENV:PATH+=";C:\bin\x16emu" # Package management is nice. - $ENV:PATH+=";C:\Program Files (x86)\GnuWin32\bin" # GNU Utils - i.e. rm - $ENV:PATH+=";C:\PENGUIN" # Flag to ensure my profile kicked in. - $ENV:PATH+=";$env:src\x16-demo\tools" # x16 python tools - $ENV:PATH+=";$env:src\flutter\bin" # Flutter for Dart -} -else { - $ENV:PATH+=";$env:src/bin" # anything else I need - $ENV:PATH+=":$HOME/x16/x16-emulator" # x16 Emulator - $ENV:PATH+=":$HOME/src/x16-demo/tools" # x16 python tools -} - -# Command line tools -$ENV:PATH+=";$env:src\chart" # command line chart utility edthedev\chart -$ENV:PATH+=";$env:src\agenda" # command line chart utility edthedev\chart -$ENV:PATH+=";$env:src\todolist" # todo list utility edthedev\todolist -$env:todolist = "C:\Users\delaport\Journal\" -# New-Alias todo todolist - -# alias renumber $HOME/src/x16-demo/ - -$env:Journal = "~\Journal" # allows cd $env:journal -# $env:minion = "$env:src\minion" - -# Import some home grown PowerShell modules, if they are installed. -# -$modPaths = Get-Childitem -ErrorAction Ignore -Path "$env:src\dotfiles\psmodules" -# $modPaths += Get-Childitem -ErrorAction Ignore -Path "$env:minion\psmodule" - -# https://github.com/uillinois-community/powershell-scripts -# $modPaths += Get-Childitem -ErrorAction Ignore -Path "$env:src\powershell-scripts\modules" - -# Windows Only Modules -# if($IsWindows){ -# $modPaths += Get-Childitem -ErrorAction Ignore -Path "$env:src\dotfiles\win_psmodules" -# } -# if($modPaths.length -eq 0){ -# Write-Host "No modules found." -# } - -# $enabledMods = 'dash.psm1','docker.psm1'; -# $modPaths | ForEach-Object { -# $fileName = $_.FullName -# if($enabledModules -Contains $_.Name ){ -# if($filename -Like "*.psm1") { -# Import-Module $fileName -# Write-Host ">> Loaded $fileName" -# } -# } -# } - - - -# Linux-like up/down in shell -Set-PSReadlineKeyHandler -Key UpArrow -Function HistorySearchBackward -Set-PSReadlineKeyHandler -Key DownArrow -Function HistorySearchForward -Set-PSReadlineOption -HistorySavePath $env:src\PSHistory.log - -# Minion alias commands - 'today' -# . C:\src\minion\profiles\alias.ps1 -# . $env:minion\profiles\alias.ps1 -# Add Minion go executable to path. -# . $env:minion\profiles\path.ps1 -# Add Minion to path -# Write-Host "+ Added minion command to path." -# if($IsWindows){ -# $ENV:PATH+=";$env:minion\go" # Flag to ensure my profile kicked in. -# } - -# Unix dies hard. -New-Alias which get-command -# New-Alias rm Remove-Item +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 # Delay loading PoshGit for speed. function Enable-PoshGit { Import-Module posh-git } New-Alias pg Enable-PoshGit -Write-Host "+ Type 'pg' to enable PoshGit" - -function Invoke-X16Emu { - param( - [string]$File - ) - x16emu.exe -bas $File -keymap en-us -} - -New-Alias x16 Invoke-X16Emu - -if((Get-Location).Path -eq $HOME){ - cd $env:src -} - -function Get-GitLog() { - git log --oneline -} -function Get-GitStatus() { - git status -b --short -} - -# Tell my scripts which GitHub repositories to look in. -$env:GITHUB_USERNAME = 'edthedev' -$env:GITHUB_REPOS = @( - 'techservicesillinois/SecOps-Tools', - 'techservicesillinois/secdev-job-aids', - 'techservicesillinois/awscli-login', - 'techservicesillinois/farmit', - 'uillinois-community/uillinois-community.github.io', - 'techservicesillinois/SecOps-Powershell-CSOC', - 'techservicesillinois/SecOps-Powershell-CISDSC', - 'techservicesillinois/secops-splunk-null-router' -) -join ' ' -$ENV:TS_REPOS = $ENV:GITHUB_REPOS.split(' ') | Where { $_ -like 'techser*' } - - -# Nice for git -New-Alias ol Get-GitLog -New-Alias st Get-GitStatus - -# Dashboard -New-Alias dash Show-MyDashboard # from dash.psm1 +Set-Alias code codium # Prefer Codium -function Get-JournalAgenda() { - agenda.exe -path "$HOME/Journal/{YYYY}/{MM}-{DD}.md" -} -New-Alias today Get-JournalAgenda +# You can pry my unix commands out of my cold dead fingers +Set-Alias which get-command +# Reject Windows heritage, act like Vi +Set-PSReadlineOption -HistorySavePath $env:src\PSHistory.log +Set-PSReadlineOption -BellStyle Visual +Set-PSReadlineOption -ViModeIndicator Prompt +Set-PSReadlineOption -EditMode Vi -function Invoke-FixWslVPN { - Get-NetAdapter | Where-Object {$_.InterfaceDescription -Match "Cisco AnyConnect Secure Mobility Client Virtual Miniport Adapter for Windows x64"} | Set-NetIPInterface -InterfaceMetric 6000 -} +Write-Host "+ Type 'pg' to enable PoshGit" +Write-Host 'See $env:realProfile for version controlled profile file.' +# Let's face it, I'm about to cd into my source directory +if((Get-Location).Path -eq $HOME){ cd $env:src } \ No newline at end of file diff --git a/doc/dasboard.css b/files/dasboard.css similarity index 56% rename from doc/dasboard.css rename to files/dasboard.css index ef264d8..cac6d39 100644 --- a/doc/dasboard.css +++ b/files/dasboard.css @@ -18,10 +18,6 @@ Include this `div` tag to float panels to the right. */ -body { - color: white; - background-color: #1e3877; -} code { color: white; } @@ -29,7 +25,6 @@ pre { background-color: rgba(0, 122, 204, 0.5); } a { - color: #9ab6d9; outline-style: dashed; outline-width: medium; padding: 1em; @@ -50,3 +45,33 @@ ul { .right { float:right; } + + +/* Dark Theme */ +:root { + /* Backgrounds */ + --main-bg-color: #181818; + --code-bg-color: #222222; + + /* Foregrounds */ + --main-text-color: #bbbbbb; + --link-text-color: #22A7F0; + --visited-link-color: #7462E0; +} + +body +{ + /* font-family: 'times new roman', times, serif; */ + font-family: monospace; + font-size:2vw; + color: var(--main-text-color); + background-color: var(--main-bg-color) !important; + margin: 0em; +} + +a { + color: var(--link-text-color); +} +a:visited { + color: var(--visited-link-color); +} \ No newline at end of file diff --git a/files/dashboard.ps1 b/files/dashboard.ps1 new file mode 100644 index 0000000..6012df2 --- /dev/null +++ b/files/dashboard.ps1 @@ -0,0 +1,7 @@ +# Dashboard +New-Alias dash Show-MyDashboard # from dash.psm1 + +function Get-JournalAgenda() { + agenda.exe -path "$HOME/Journal/{YYYY}/{MM}-{DD}.md" +} +New-Alias today Get-JournalAgenda \ No newline at end of file diff --git a/files/env.ps1 b/files/env.ps1 new file mode 100644 index 0000000..d27bd8c --- /dev/null +++ b/files/env.ps1 @@ -0,0 +1,16 @@ +$env:Journal = "~\Journal" # allows cd $env:journal +$env:todolist = "C:\Users\delaport\Journal\" +# Tell my scripts which GitHub repositories to look in. +$env:GITHUB_USERNAME = 'edthedev' +$env:GITHUB_REPOS = @( + 'techservicesillinois/SecOps-Tools', + 'techservicesillinois/secdev-job-aids', + 'techservicesillinois/awscli-login', + 'techservicesillinois/farmit', + 'uillinois-community/uillinois-community.github.io', + 'techservicesillinois/SecOps-Powershell-CSOC', + 'techservicesillinois/SecOps-Powershell-CISDSC', + 'techservicesillinois/secops-splunk-null-router' +) -join ' ' +$ENV:TS_REPOS = $ENV:GITHUB_REPOS.split(' ') | Where { $_ -like 'techser*' } + diff --git a/files/keybindings.json b/files/keybindings.json new file mode 100644 index 0000000..bce479f --- /dev/null +++ b/files/keybindings.json @@ -0,0 +1,71 @@ +// Place your key bindings in this file to override the defaultsauto[] +[ + { + "key": "shift+alt+8", + "command": "workbench.action.moveEditorToFirstGroup" + }, + { + "key": "shift+alt+1", + "command": "-workbench.action.moveEditorToFirstGroup" + }, + { + "key": "shift+alt+1", + "command": "journal.note" + }, + { + "key": "alt+home", + "command": "journal.today" + }, + { + "key": "shift+alt+3", + "command": "workbench.view.search.focus" + }, + { + "key": "shift+alt+v", + "command": "workbench.view.scm", + "when": "workbench.scm.active" + }, + { + "key": "ctrl+shift+g", + "command": "-workbench.view.scm", + "when": "workbench.scm.active" + }, + { + "key": "shift+alt+6", + "command": "workbench.action.toggleSidebarVisibility" + }, + { + "key": "ctrl+b", + "command": "-workbench.action.toggleSidebarVisibility" + }, + { + "key": "shift+alt+5", + "command": "workbench.action.toggleMaximizedPanel" + }, + { + "key": "shift+alt+4", + "command": "workbench.action.terminal.toggleTerminal", + "when": "terminal.active" + }, + { + "key": "ctrl+`", + "command": "-workbench.action.terminal.toggleTerminal", + "when": "terminal.active" + }, + { + "key": "alt+right", + "command": "journal.tomorrow" + }, + { + "key": "alt+left", + "command": "journal.yesterday" + }, + { + "key": "shift+alt+2", + "command": "workbench.action.toggleZenMode" + }, + { + "key": "ctrl+k z", + "command": "-workbench.action.toggleZenMode" + } +] \ No newline at end of file diff --git a/files/load_modules.ps1 b/files/load_modules.ps1 new file mode 100644 index 0000000..3804802 --- /dev/null +++ b/files/load_modules.ps1 @@ -0,0 +1,5 @@ + +$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 new file mode 100644 index 0000000..88d6bb8 --- /dev/null +++ b/files/paths.ps1 @@ -0,0 +1,36 @@ +function Add-ToPath { + param ( + $Path, + [switch]$Optional=$false + ) + if(Test-Path $Path){ + $ENV:PATH+=";$PATH" + } else { + if(-Not $Optional) { + Write-Error "Add-ToPath failed for $PATH" + } + } +} + +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\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:\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 + Add-ToPath "$env:src\bin" -optional # anything else I need +} +else { + Add-ToPath "$env:src/bin" -optional # anything else I need + Add-ToPath "$HOME/x16/x16-emulator" -optional # x16 Emulator + Add-ToPath "$HOME/src/x16-demo/tools" -optional # x16 python tools +} + +# 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 diff --git a/install/codium.sh b/install/codium.sh new file mode 100644 index 0000000..8328848 --- /dev/null +++ b/install/codium.sh @@ -0,0 +1 @@ +winget install vscodium \ No newline at end of file diff --git a/psmodules/X16Emu.psm1 b/psmodules/X16Emu.psm1 new file mode 100644 index 0000000..43e46cd --- /dev/null +++ b/psmodules/X16Emu.psm1 @@ -0,0 +1,10 @@ + +# Set-Alias renumber $HOME/src/x16-demo/ +function Invoke-X16Emu { + param( + [string]$File + ) + x16emu.exe -bas $File -keymap en-us +} + +New-Alias x16 Invoke-X16Emu \ No newline at end of file diff --git a/psmodules/add_to_profile.psm1 b/psmodules/add_to_profile.psm1 new file mode 100644 index 0000000..4223f65 --- /dev/null +++ b/psmodules/add_to_profile.psm1 @@ -0,0 +1,8 @@ +function Add-ToProfile { + param ( + $Path + ) + $profileContents = [string]::join([environment]::newline, (get-content -path $Path)) + invoke-expression $profileContents +} +Export-ModuleMember -Function Add-ToProfile \ No newline at end of file diff --git a/psmodules/drivespace.psm1 b/psmodules/drivespace.psm1 index 342311b..b946f86 100644 --- a/psmodules/drivespace.psm1 +++ b/psmodules/drivespace.psm1 @@ -40,5 +40,5 @@ $Files = Get-Job -Name "FileCollection" | Receive-Job Get-Job -Name "FileCollection" | Remove-Job } -Export-ModuleMember -Function Show-Drivespace +Export-ModuleMember -Function Show-DriveSpace Export-ModuleMember -Function Show-LargeFiles diff --git a/psmodules/fix_vpn.psm1 b/psmodules/fix_vpn.psm1 new file mode 100644 index 0000000..d8b2e57 --- /dev/null +++ b/psmodules/fix_vpn.psm1 @@ -0,0 +1,4 @@ +function Invoke-FixWslVPN { + Get-NetAdapter | Where-Object {$_.InterfaceDescription -Match "Cisco AnyConnect Secure Mobility Client Virtual Miniport Adapter for Windows x64"} | Set-NetIPInterface -InterfaceMetric 6000 +} +Export-ModuleMember -Function Invoke-FixWslVPN \ No newline at end of file diff --git a/psmodules/git_cleverness.psm1 b/psmodules/git_cleverness.psm1 new file mode 100644 index 0000000..c5a9eee --- /dev/null +++ b/psmodules/git_cleverness.psm1 @@ -0,0 +1,7 @@ +function Get-GitLog() { + git log --oneline +} + +function Get-GitStatus() { + git status -b --short +} diff --git a/setup/codium.sh b/setup/codium.sh new file mode 100644 index 0000000..d425a1f --- /dev/null +++ b/setup/codium.sh @@ -0,0 +1,17 @@ +codium --install-extension ban.spellright +codium --install-extension bierner.markdown-mermaid +codium --install-extension brunnerh.insert-unicodium +codium --install-extension ms-vscodium-remote.remote-containers +codium --install-extension ms-vscodium-remote.remote-ssh +codium --install-extension ms-vscodium-remote.remote-ssh-edit +codium --install-extension ms-vscodium-remote.remote-wsl +codium --install-extension ms-vscodium-remote.vscodium-remote-extensionpack +codium --install-extension ms-vscodium.remote-explorer +codium --install-extension ms-vscodium.remote-server +codium --install-extension pajoma.vscodium-journal +codium --install-extension rioj7.vscodium-json-validate +codium --install-extension tomasr8.close-all-but-this +codium --install-extension vscodiumvim.vim +codium --install-extension yzane.markdown-pdf +codium --install-extension yzhang.markdown-all-in-one +codium --install-extension ZainChen.json \ No newline at end of file