- run
go clean -modcache
- run
sudo --preserve-env find $HOME/go/pkg/mod -exec rm -rf {} +
Usage of named aliases for types in an effort to emulate enumeration behavior from other languages can cause issues.
Using a named type for an alias gives the illusion of control, but since a literal value can be placed as it matches the type, it doesn't really do anything but provide an additional layer of abstraction.
Example:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this uses aliases to simulate what a linux user would normally expect to write | |
# idiomatic powershell leans on clarity over being terse, so "%" would be ForEach-Object for example. | |
$Files = gci -Recurse -Filter package.json | Where Name -notmatch "node_modules" | % { [pscustomobject]@{FullName = $_.FullName; Content = (gc $_.FullName -raw | ConvertFrom-Json) }} | |
$UpdateFiles = $files | ? {$_.Content.Dependencies -match 'temporalio'} | |
$UpdateFiles | % { | |
$f = $_ # $_ = pipelined object with all properties available | |
$f.Content.Dependencies.temporalio = '^0.13.0' # this is object property reference because ConvertFrom-Json gave us an object, not raw text | |
$f.Content | ConvertTo-Json -depth 100 | Out-File -Path $f.FullName -Force # convert back to json as it was actually an object | |
} |
FROM mcr.microsoft.com/vscode/devcontainers/universal:1-${VARIANT} as BASE
RUN sh <(curl -L https://nixos.org/nix/install) --no-daemon
RUN mkdir -p /home/codespace/.config/nixpkgs && echo '{ allowUnfree = true; }' >> /home/codespace/.config/nixpkgs/config.nix
RUN echo '. /home/codespace/.nix-profile/etc/profile.d/nix.sh' >> /home/codespace/.bashrc
# Install git
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# choco install go -y | |
# brew install go | |
# should use latest to simplify go install commands. | |
go install github.com/kpym/gm@latest | |
# help | |
&"$ENV:HOME/go/bin/gm" -h |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// envBool returns a boolean from an environment variable existing or not. | |
Synthesizing 10/10 solutions | |
======= | |
# mean prob: 0.8506432006730708 | |
func envBool(key string) bool { | |
if val, ok := os.LookupEnv(key); ok { | |
if val == "true" || val == "1" { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get Extension Data from Settings Sync, and put the list of extensions in this here block | |
$extensions = Get-Clipboard | convertfrom-json -depth 10 | |
# $extensions = @' | |
# '@ | convertfrom-json -depth 10 | |
$parsed = $extensions | Where {$_.disabled -ne $true -and $_.Installed -eq $true} | |
$parsed.Identifier | |
# Print output to copy |
- Install Git-Compose
- Set preference of ssh or https.
Default behavior is https.
To change to ssh use:
gico config set --prefer-remote ssh
Use in current directory to initialize quickly with: gico init
, or use a remote yaml url to quickly setup a new dev.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.LINK | |
Operation Types: https://docs.microsoft.com/en-us/rest/api/azure/devops/wit/work%20items/update?view=azure-devops-rest-6.0#operation | |
How to Use This API: https://docs.microsoft.com/en-us/rest/api/azure/devops/wit/work%20items/update?view=azure-devops-rest-6.0 | |
Gotcha: | |
However, this isn't always the case. For instance, running a script on my machine, using my own base64 encoded PAT, ../_apis/../projects needs `Basic` but ../_apis/../pullrequests needs `Bearer`. When running through AzDO, they all need `Bearer`. | |
https://developercommunity.visualstudio.com/t/using-powershell-script-to-call-azure-devops-api-w/816540 | |
... but it appears that if you use your account's PAT, you need to use `Basic` and encode it with a : (colon) at the beginning of the PAT: |
- don't use cmd prompt for anything, use PowerShell
- install latest windows terminal from store, don't use default terminals, they are terrible and less featured.
- Suggest installing PowerShell 7 as your normal windows base terminal to use.
- Install Scoop to make this super easy to install.
scoop install pwsh
- Open
pwsh
(PowerShell 7) as your default in Terminal