Merge branch 'master' of devbox.wall:zaphar/dotfiles
This commit is contained in:
commit
3ad183dc59
@ -22,3 +22,6 @@ shopt -s histappend
|
|||||||
set -o vi
|
set -o vi
|
||||||
|
|
||||||
export LC_ALL=en_US.UTF-8
|
export LC_ALL=en_US.UTF-8
|
||||||
|
|
||||||
|
eval $(ssh-agent -s)
|
||||||
|
ssh-add $(find ~/.ssh -iname id_* | grep -v '.pub')
|
||||||
|
@ -14,22 +14,22 @@ function prompt {
|
|||||||
Invoke a scriptblock with evelvated permissions.
|
Invoke a scriptblock with evelvated permissions.
|
||||||
#>
|
#>
|
||||||
function Invoke-Elevated {
|
function Invoke-Elevated {
|
||||||
param (
|
param (
|
||||||
[ScriptBlock]
|
[ScriptBlock]
|
||||||
$code
|
$code
|
||||||
)
|
)
|
||||||
$outTmpFile = [System.IO.Path]::GetTempFileName()
|
$outTmpFile = [System.IO.Path]::GetTempFileName()
|
||||||
$errTmpFile = [System.IO.Path]::GetTempFileName()
|
$errTmpFile = [System.IO.Path]::GetTempFileName()
|
||||||
|
|
||||||
$code | Write-Output
|
$code | Write-Output
|
||||||
$outTmpFile | Write-Output
|
$outTmpFile | Write-Output
|
||||||
$errTmpFile | Write-Output
|
$errTmpFile | Write-Output
|
||||||
# TODO(jwall): Work on figuring out how to properly redirect output here
|
# TODO(jwall): Work on figuring out how to properly redirect output here
|
||||||
Start-Process powershell.exe -ArgumentList { &$code 1>$outTmpFile 2>$errTmpFile } -WindowStyle hidden -Verb RunAs
|
Start-Process powershell.exe -ArgumentList { &$code 1>$outTmpFile 2>$errTmpFile } -WindowStyle hidden -Verb RunAs
|
||||||
Get-Content $outTmpFile | Write-Output
|
Get-Content $outTmpFile | Write-Output
|
||||||
Get-Content $errTmpFile | Write-Output
|
Get-Content $errTmpFile | Write-Output
|
||||||
Remove-Item $outTmpFile
|
Remove-Item $outTmpFile
|
||||||
Remove-Item $errTmpFile
|
Remove-Item $errTmpFile
|
||||||
}
|
}
|
||||||
|
|
||||||
<#
|
<#
|
||||||
@ -38,7 +38,7 @@ function Invoke-Elevated {
|
|||||||
#>
|
#>
|
||||||
function Get-Elevated {
|
function Get-Elevated {
|
||||||
([Security.Principal.WindowsPrincipal] `
|
([Security.Principal.WindowsPrincipal] `
|
||||||
[Security.Principal.WindowsIdentity]::GetCurrent() `
|
[Security.Principal.WindowsIdentity]::GetCurrent() `
|
||||||
).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
|
).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,11 +59,11 @@ function Get-Elevated {
|
|||||||
#>
|
#>
|
||||||
function New-Link {
|
function New-Link {
|
||||||
param (
|
param (
|
||||||
[Parameter(Position=0, Mandatory=$true)]
|
[Parameter(Position = 0, Mandatory = $true)]
|
||||||
[string[]]
|
[string[]]
|
||||||
$Source,
|
$Source,
|
||||||
|
|
||||||
[Parameter(Position=1, Mandatory=$true)]
|
[Parameter(Position = 1, Mandatory = $true)]
|
||||||
[string[]]
|
[string[]]
|
||||||
$Destination
|
$Destination
|
||||||
)
|
)
|
||||||
@ -72,7 +72,8 @@ function New-Link {
|
|||||||
# to do symbolic links without administrator privileges
|
# to do symbolic links without administrator privileges
|
||||||
if (Get-Elevated) {
|
if (Get-Elevated) {
|
||||||
New-Item -ItemType SymbolicLink -Path $Destination -Target $Source
|
New-Item -ItemType SymbolicLink -Path $Destination -Target $Source
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
# Elevate our permissions for this first.
|
# Elevate our permissions for this first.
|
||||||
Invoke-Elevated {
|
Invoke-Elevated {
|
||||||
New-Item -ItemType SymbolicLink -Path $Destination -Target $Source
|
New-Item -ItemType SymbolicLink -Path $Destination -Target $Source
|
||||||
@ -80,12 +81,61 @@ function New-Link {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.Synopsis
|
||||||
|
Get Powershell Version and optionally the host version.
|
||||||
|
|
||||||
|
.Parameter Full
|
||||||
|
Show all the version information not just the version
|
||||||
|
number and edition.
|
||||||
|
|
||||||
|
.Parameter WithHost
|
||||||
|
Show the Host version as well.
|
||||||
|
#>
|
||||||
|
function Get-PSVersion {
|
||||||
|
param (
|
||||||
|
[Parameter(Mandatory = $false)]
|
||||||
|
[Switch] $Full,
|
||||||
|
|
||||||
|
[Parameter(Mandatory = $false)]
|
||||||
|
[Switch] $WithHost
|
||||||
|
)
|
||||||
|
|
||||||
|
if ($Full) {
|
||||||
|
$PSVersionTable |
|
||||||
|
if ($WithHost) {
|
||||||
|
Get-Host
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
@{ PSVersion = $PSVersionTable.PSVersion; PSEdition = $PSVersionTable.PSEdition }
|
||||||
|
if ($WithHost) {
|
||||||
|
$HostInfo = Get-Host
|
||||||
|
@{HostName = $HostInfo.Name; HostVersion = $HostInfo.Version }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $output
|
||||||
|
}
|
||||||
|
|
||||||
|
function Get-Base64-Decoded {
|
||||||
|
[CmdletBinding()]
|
||||||
|
param (
|
||||||
|
[Parameter()]
|
||||||
|
[string[]]
|
||||||
|
$encoded
|
||||||
|
)
|
||||||
|
[Text.Encoding]::Utf8.GetString([Convert]::FromBase64String($encoded))
|
||||||
|
}
|
||||||
|
|
||||||
function grep {
|
function grep {
|
||||||
$input | out-string -stream | select-string $args
|
$input | out-string -stream | select-string $args
|
||||||
}
|
}
|
||||||
|
|
||||||
# It's way more useful to call this open than ii
|
# It's way more useful to call this open than ii
|
||||||
Set-Alias -Name open -Value Invoke-Item
|
Set-Alias -Name open -Value Invoke-Item
|
||||||
Set-Alias -Name ln -Value New-Link
|
Set-Alias -Name ln -Value New-Link
|
||||||
|
Set-Alias -name which -Value Get-Command
|
||||||
|
|
||||||
# Add make to our powershell path
|
# Add make to our powershell path
|
||||||
$env:PATH="$env:PATH;C:\Program Files (x86)\GnuWin32\bin;C:\Users\jerem\AppData\Local\Julia-1.3.0\bin"
|
$env:PATH = "$env:PATH;C:\Program Files (x86)\GnuWin32\bin;C:\Users\jerem\AppData\Local\Julia-1.3.0\bin;C:\Users\jerem\AppData\Roaming\nvm;C:\Users\jerem\AppData\Local\Google\Cloud SDK\google-cloud-sdk\bin"
|
||||||
|
$env:NVM_HOME = "C:\Users\jerem\AppData\Roaming\nvm"
|
@ -1,15 +1,15 @@
|
|||||||
#Powershell based windows 10 bootstrap script
|
#Powershell based windows 10 bootstrap script
|
||||||
|
|
||||||
# First we source in our powershell profile so we can have some useful utilities
|
# First we source in our powershell profile so we can have some useful utilities
|
||||||
source "./PowerShellProfile.ps1"
|
. "./PowerShellProfile.ps1"
|
||||||
|
|
||||||
# First step is to overwrite our current profile with a symlink to the correct one.
|
# First step is to overwrite our current profile with a symlink to the correct one.
|
||||||
Remove-Item -Force -Path $profile
|
Remove-Item -Force -Path $profile
|
||||||
Make-Link -Source "./PowerShellProfile.ps1" -Destination $profile
|
New-Item -ItemType SymbolicLink -Target "./PowerShellProfile.ps1" -Path $profile
|
||||||
|
|
||||||
# Now ensure our dnsservers are properly set up
|
# Now ensure our dnsservers are properly set up
|
||||||
Invoke-Elevated {
|
Invoke-Elevated {
|
||||||
Get-NetAdapter | ForEach-Object {
|
Get-NetAdapter | ForEach-Object {
|
||||||
Set-DnsClientServerAddress -InterfaceIndex $_.ifIndex -ServerAddresses 1.1.1.1,1.0.0.1,2606:4700:4700::1111,2606:4700:4700::1001
|
Set-DnsClientServerAddress -InterfaceIndex $_.ifIndex -ServerAddresses 1.1.1.1, 1.0.0.1, 2606:4700:4700::1111, 2606:4700:4700::1001
|
||||||
}
|
}
|
||||||
}
|
}
|
96
PS/terminal-settings.json
Normal file
96
PS/terminal-settings.json
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
// This file was initially generated by Windows Terminal 1.1.2021.0
|
||||||
|
// It should still be usable in newer versions, but newer versions might have additional
|
||||||
|
// settings, help text, or changes that you will not see unless you clear this file
|
||||||
|
// and let us generate a new one for you.
|
||||||
|
|
||||||
|
// To view the default settings, hold "alt" while clicking on the "Settings" button.
|
||||||
|
// For documentation on these settings, see: https://aka.ms/terminal-documentation
|
||||||
|
{
|
||||||
|
"$schema": "https://aka.ms/terminal-profiles-schema",
|
||||||
|
|
||||||
|
"defaultProfile": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
|
||||||
|
|
||||||
|
// You can add more global application settings here.
|
||||||
|
// To learn more about global settings, visit https://aka.ms/terminal-global-settings
|
||||||
|
|
||||||
|
// If enabled, selections are automatically copied to your clipboard.
|
||||||
|
"copyOnSelect": false,
|
||||||
|
|
||||||
|
// If enabled, formatted data is also copied to your clipboard
|
||||||
|
"copyFormatting": false,
|
||||||
|
|
||||||
|
// A profile specifies a command to execute paired with information about how it should look and feel.
|
||||||
|
// Each one of them will appear in the 'New Tab' dropdown,
|
||||||
|
// and can be invoked from the commandline with `wt.exe -p xxx`
|
||||||
|
// To learn more about profiles, visit https://aka.ms/terminal-profile-settings
|
||||||
|
"profiles": {
|
||||||
|
"defaults": {
|
||||||
|
// Put settings here that you want to apply to all profiles.
|
||||||
|
},
|
||||||
|
"list": [
|
||||||
|
{
|
||||||
|
// Make changes here to the powershell.exe profile.
|
||||||
|
"guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
|
||||||
|
"name": "Windows PowerShell",
|
||||||
|
"commandline": "pwsh.exe",
|
||||||
|
"hidden": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
// Make changes here to the cmd.exe profile.
|
||||||
|
"guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
|
||||||
|
"name": "Command Prompt",
|
||||||
|
"commandline": "cmd.exe",
|
||||||
|
"hidden": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"guid": "{2c4de342-38b7-51cf-b940-2309a097f518}",
|
||||||
|
"hidden": false,
|
||||||
|
"name": "Ubuntu",
|
||||||
|
"source": "Windows.Terminal.Wsl"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
|
||||||
|
"hidden": false,
|
||||||
|
"name": "Azure Cloud Shell",
|
||||||
|
"source": "Windows.Terminal.Azure"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
|
||||||
|
"hidden": false,
|
||||||
|
"name": "PowerShell",
|
||||||
|
"source": "Windows.Terminal.PowershellCore"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
// Add custom color schemes to this array.
|
||||||
|
// To learn more about color schemes, visit https://aka.ms/terminal-color-schemes
|
||||||
|
"schemes": [],
|
||||||
|
|
||||||
|
// Add custom keybindings to this array.
|
||||||
|
// To unbind a key combination from your defaults.json, set the command to "unbound".
|
||||||
|
// To learn more about keybindings, visit https://aka.ms/terminal-keybindings
|
||||||
|
"keybindings": [
|
||||||
|
// Copy and paste are bound to Ctrl+Shift+C and Ctrl+Shift+V in your defaults.json.
|
||||||
|
// These two lines additionally bind them to Ctrl+C and Ctrl+V.
|
||||||
|
// To learn more about selection, visit https://aka.ms/terminal-selection
|
||||||
|
{ "command": { "action": "copy", "singleLine": false }, "keys": "ctrl+c" },
|
||||||
|
{ "command": "paste", "keys": "ctrl+v" },
|
||||||
|
|
||||||
|
// Press Ctrl+Shift+F to open the search box
|
||||||
|
{ "command": "find", "keys": "ctrl+shift+f" },
|
||||||
|
|
||||||
|
// Press Alt+Shift+D to open a new pane.
|
||||||
|
// - "split": "auto" makes this pane open in the direction that provides the most surface area.
|
||||||
|
// - "splitMode": "duplicate" makes the new pane use the focused pane's profile.
|
||||||
|
// To learn more about panes, visit https://aka.ms/terminal-panes
|
||||||
|
{
|
||||||
|
"command": {
|
||||||
|
"action": "splitPane",
|
||||||
|
"split": "auto",
|
||||||
|
"splitMode": "duplicate"
|
||||||
|
},
|
||||||
|
"keys": "alt+shift+d"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user