conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "human", "value": "Add a powershell script to make it a single step to program the combined hex file to the micro\n" }, { "from": "gpt", "value": "[CmdletBinding()]\r\nParam(\r\n [Parameter(Position=1, Mandatory=$True)]$HexFile,\r\n $STVPDir = \"${env:ProgramFiles(x86)}\\STMicroelectronics\\st_toolset\\stvp\",\r\n $Tool = \"ST-LINK\"\r\n)\r\n\r\n$STVPApp = Join-Path $STVPDir \"STVP_CmdLine.exe\"\r\n\r\n$STVPArgs = @(\r\n \"-BoardName=$Tool\"\r\n '-Device=STM8S003K3',\r\n '-log',\r\n '-verif',\r\n \"-FileProg=\"\"$HexFile\"\"\",\r\n \"-FileData=\"\"$HexFile\"\"\")\r\nWrite-Host \"Arguments to STVP_CmdLine: $STVPArgs\"\r\n\r\nWrite-Host \"Press space to exit the programming loop.\"\r\n\r\n\r\nStart-Process $STVPApp -ArgumentList $STVPArgs -NoNewWindow -Wait\r\ncls" } ]
powershell
chosen
[ { "from": "system", "value": "Fix path to aver again\n" }, { "from": "human", "value": "# Create a build tag, formatted like {build}.{branch}.{sha7}\n# Use aver to patch versions of assemblies and nupkg-packages\npwd\n$sha = \"$env:APPVEYOR_REPO_COMMIT\".substring(0,7)\n$env:MY_BUILD_TAG = \"$env:APPVEYOR_BUILD_NUMBER.$env:APPVEYOR_REPO_BRANCH.$sha\"\n..\\tools\\aver.exe set \"$($env:APPVEYOR_BUILD_FOLDER)\" -scan -build \"$env:MY_BUILD_TAG\" \n" }, { "from": "gpt", "value": "# Create a build tag, formatted like {build}.{branch}.{sha7}\n# Use aver to patch versions of assemblies and nupkg-packages\n$sha = \"$env:APPVEYOR_REPO_COMMIT\".substring(0,7)\n$env:MY_BUILD_TAG = \"$env:APPVEYOR_BUILD_NUMBER.$env:APPVEYOR_REPO_BRANCH.$sha\"\n& .\\tools\\aver.exe set \"$($env:APPVEYOR_BUILD_FOLDER)\" -scan -build \"$env:MY_BUILD_TAG\" \n" } ]
powershell
chosen
[ { "from": "system", "value": "tests: Fix instructions in doc validator\n\nChange-Id: Ie0d5d87da5e36e4206c6af73451ff28e3ad4b100\n" }, { "from": "human", "value": "# Powershell script for running the vktrace trace/replay auto test\r\n# To run this test:\r\n# cd <this-dir>\r\n# powershell C:\\src\\LoaderAndTools\\vktracereplay.ps1 [-Debug]\r\n\r\nif ($args[0] -eq \"-Debug\") {\r\n $dPath = \"Debug\"\r\n} else {\r\n $dPath = \"Release\"\r\n}\r\n\r\nwrite-host -background black -foreground green \"[ RUN ] \" -nonewline\r\nwrite-host \"vkvalidatelayerdoc.ps1: Validate layer documentation\"\r\n\r\n# Run doc validation from project root dir\r\npush-location ..\\..\r\n\r\n# Validate that layer documentation matches source contents\r\npython vk_layer_documentation_generate.py --validate\r\n\r\n# Report result based on exit code\r\nif (!$LASTEXITCODE) {\r\n write-host -background black -foreground green \"[ PASSED ] \" -nonewline;\r\n $exitstatus = 0\r\n} else {\r\n echo 'Validation of vk_validation_layer_details.md failed'\r\n write-host -background black -foreground red \"[ FAILED ] \" -nonewline;\r\n echo '1 FAILED TEST'\r\n $exitstatus = 1\r\n}\r\n\r\npop-location\r\nexit $exitstatus\r\n" }, { "from": "gpt", "value": "# Powershell script for running the layer validation details doc validator\r\n# To run this test:\r\n# From a Windows powershell:\r\n# cd C:\\src\\Vulkan-LoaderAndValidationLayers\\build\\tests\r\n# .\\vkvalidatelayerdoc.ps1 [-Debug]\r\n\r\nif ($args[0] -eq \"-Debug\") {\r\n $dPath = \"Debug\"\r\n} else {\r\n $dPath = \"Release\"\r\n}\r\n\r\nwrite-host -background black -foreground green \"[ RUN ] \" -nonewline\r\nwrite-host \"vkvalidatelayerdoc.ps1: Validate layer documentation\"\r\n\r\n# Run doc validation from project root dir\r\npush-location ..\\..\r\n\r\n# Validate that layer documentation matches source contents\r\npython vk_layer_documentation_generate.py --validate\r\n\r\n# Report result based on exit code\r\nif (!$LASTEXITCODE) {\r\n write-host -background black -foreground green \"[ PASSED ] \" -nonewline;\r\n $exitstatus = 0\r\n} else {\r\n echo 'Validation of vk_validation_layer_details.md failed'\r\n write-host -background black -foreground red \"[ FAILED ] \" -nonewline;\r\n echo '1 FAILED TEST'\r\n $exitstatus = 1\r\n}\r\n\r\npop-location\r\nexit $exitstatus\r\n" } ]
powershell
chosen
[ { "from": "system", "value": "Update Hybrid Worker DSC Config to check for MMA\n\n- Switched to using DSC to install and check for the monitoring agent\n" }, { "from": "human", "value": "Configuration HybridWorkerConfiguration {\n\n param(\n\n [Parameter(Mandatory=$true)]\n [System.String] $AutomationEndpoint,\n\n [Parameter(Mandatory=$false)]\n [System.String] $HybridGroupName = \"MyHybridWorker\"\n\n )\n\n Import-DscResource -ModuleName HybridRunbookWorker\n\n\n Node $AllNodes.NodeName {\n HybridRunbookWorker Onboard {\n Ensure = 'Present'\n Endpoint = $AutomationEndpoint\n Token = Get-AutomationPSCredential -Name \"TokenCredential\"\n GroupName = $HybridGroupName\n }\n }\n}" }, { "from": "gpt", "value": "Configuration HybridWorkerConfiguration {\n\n param(\n\n [Parameter(Mandatory=$true)]\n [System.String] $AutomationEndpoint,\n\n [Parameter(Mandatory=$false)]\n [System.String] $HybridGroupName = \"MyHybridWorker\"\n\n )\n\n Import-DscResource -ModuleName HybridRunbookWorker\n Import-DscResource -ModuleName xPSDesiredStateConfiguration -ModuleVersion 4.0.0.0\n\n $OIPackageLocalPath = \"C:\\MMASetup-AMD64.exe\"\n $WorkspaceID = Get-AutomationVariable -Name \"WorkspaceId\" \n $WorkspaceKey = Get-AutomationVariable -Name \"WorkspaceKey\"\n\n\n\n Node $AllNodes.NodeName {\n HybridRunbookWorker Onboard {\n Ensure = 'Present'\n Endpoint = $AutomationEndpoint\n Token = Get-AutomationPSCredential -Name \"TokenCredential\"\n GroupName = $HybridGroupName\n }\n\n xRemoteFile OIPackage {\n Uri = \"https://opsinsight.blob.core.windows.net/publicfiles/MMASetup-AMD64.exe\"\n DestinationPath = $OIPackageLocalPath\n }\n\n Service OIService\n {\n Name = \"HealthService\"\n State = \"Running\"\n DependsOn = \"[Package]OI\"\n }\n\n Package OI {\n Ensure = \"Present\"\n Path = $OIPackageLocalPath\n Name = \"Microsoft Monitoring Agent\"\n ProductId = \"E854571C-3C01-4128-99B8-52512F44E5E9\"\n Arguments = '/C:\"setup.exe /qn ADD_OPINSIGHTS_WORKSPACE=1 OPINSIGHTS_WORKSPACE_ID=' + $WorkspaceID + ' OPINSIGHTS_WORKSPACE_KEY=' + $WorkspaceKey + ' AcceptEndUserLicenseAgreement=1\"'\n DependsOn = \"[xRemoteFile]OIPackage\"\n }\n }\n}" } ]
powershell
chosen
[ { "from": "system", "value": "Add 'Clean' and 'InstallDependencies' tasks for Invoke-Build\n" }, { "from": "human", "value": "#Requires -Modules 'InvokeBuild'\nParam (\n [string]$BuildOutput = \"$PSScriptRoot\\BuildOutput\",\n\n [string[]]$Dependency = @('Coveralls','Pester','PsScriptAnalyzer')\n)\n\nFunction Write-TaskBanner ( [string]$TaskName )\n{\n \"`n\" + ('-' * 79) + \"`n\" + \"`t`t`t $TaskName `n\" + ('-' * 79) + \"`n\"\n}\n\ntask Clean {\n Write-TaskBanner -TaskName $Task.Name\n\n If (Test-Path -Path $BuildOutput) {\n \"Removing existing files and folders in $BuildOutput\\\"\n Get-ChildItem .\\BuildOutput\\ | Remove-Item -Force -Recurse\n }\n Else {\n \"$BuildOutput is not present, nothing to clean up.\"\n }\n}\n\ntask InstallDependencies {\n Write-TaskBanner -TaskName $Task.Name\n\n Foreach ( $Depend in $Script:Dependency ) {\n Install-Module $Depend -Scope CurrentUser -Force\n Import-Module $Depend -Force\n }\n}\n\n# Default task : runs all tasks\ntask . Clean, InstallDependencies" }, { "from": "gpt", "value": "#Requires -Modules 'InvokeBuild'\nParam (\n [string]$BuildOutput = \"$PSScriptRoot\\BuildOutput\",\n\n [string[]]$Dependency = @('Coveralls','Pester','PsScriptAnalyzer')\n)\n\nFunction Write-TaskBanner ( [string]$TaskName )\n{\n \"`n\" + ('-' * 79) + \"`n\" + \"`t`t`t $TaskName `n\" + ('-' * 79) + \"`n\"\n}\n\ntask Clean {\n Write-TaskBanner -TaskName $Task.Name\n\n If (Test-Path -Path $BuildOutput) {\n \"Removing existing files and folders in $BuildOutput\\\"\n Get-ChildItem .\\BuildOutput\\ | Remove-Item -Force -Recurse\n }\n Else {\n \"$BuildOutput is not present, nothing to clean up.\"\n }\n}\n\ntask InstallDependencies {\n Write-TaskBanner -TaskName $Task.Name\n\n Foreach ( $Depend in $Script:Dependency ) {\n Install-Module $Depend -Scope CurrentUser -Force -Verbose\n Import-Module $Depend -Force -Verbose\n }\n}\n\n# Default task : runs all tasks\ntask . Clean, InstallDependencies" } ]
powershell
chosen
[ { "from": "human", "value": "Migrate slot swap script from AzureRM to Az Powershell\n" }, { "from": "gpt", "value": "# make sure the script stops if one of the swaps failed\n$ErrorActionPreference = \"Stop\"\n\nSelect-AzSubscription -Subscription \"Websites migration\"\n\n$ParametersObject = @{\n\ttargetSlot = \"staging\"\n}\n\nWrite-Host swapping bay site ....\nInvoke-AzResourceAction -ResourceGroupName explorer-bay -ResourceType Microsoft.Web/sites -ResourceName explorer-bay -Action slotsswap -Parameters $ParametersObject -ApiVersion 2015-08-01 -Force\n\nWrite-Host swapping blu site ....\nInvoke-AzResourceAction -ResourceGroupName explorer-blu -ResourceType Microsoft.Web/sites -ResourceName explorer-blu -Action slotsswap -Parameters $ParametersObject -ApiVersion 2015-08-01 -Force\n\nWrite-Host swapping db3 site ....\nInvoke-AzResourceAction -ResourceGroupName explorer-db3 -ResourceType Microsoft.Web/sites -ResourceName explorer-db3 -Action slotsswap -Parameters $ParametersObject -ApiVersion 2015-08-01 -Force\n\nWrite-Host swapping hk1 site ....\nInvoke-AzResourceAction -ResourceGroupName explorer-hk1 -ResourceType Microsoft.Web/sites -ResourceName explorer-hk1 -Action slotsswap -Parameters $ParametersObject -ApiVersion 2015-08-01 -Force\n\nWrite-Host Done Swapping all sites\n" } ]
powershell
chosen
[ { "from": "system", "value": "Add indexes for albums and images\n" }, { "from": "human", "value": "# Extract the ZIP if not already extracted\n$BackupPath = Join-Path $PSScriptRoot \".\\final7.55e3678c7664.zip\"\n$Destination = Join-Path $PSScriptRoot \".\\final7\"\n\nif ((Test-Path $Destination) -eq $false)\n{\n Write-Host \"Extracting '$BackupPath' to '$Destination'...\"\n Add-Type -Assembly \"System.IO.Compression.FileSystem\"\n [IO.Compression.ZipFile]::ExtractToDirectory($BackupPath, $Destination)\n}\n\n# Remove the existing collections, if any\n$cmd = 'use photos\ndb.albums.drop();\ndb.images.drop();'\n\n$cmd | mongo\n\n# Import the albums and photos\nGet-Content -Path '.\\final7\\final7\\albums.json' | mongoimport -d photos -c albums\nGet-Content -Path '.\\final7\\final7\\images.json' | mongoimport -d photos -c images\n" }, { "from": "gpt", "value": "# Extract the ZIP if not already extracted\n$BackupPath = Join-Path $PSScriptRoot \".\\final7.55e3678c7664.zip\"\n$Destination = Join-Path $PSScriptRoot \".\\final7\"\n\nif ((Test-Path $Destination) -eq $false)\n{\n Write-Host \"Extracting '$BackupPath' to '$Destination'...\"\n Add-Type -Assembly \"System.IO.Compression.FileSystem\"\n [IO.Compression.ZipFile]::ExtractToDirectory($BackupPath, $Destination)\n}\n\n# Remove the existing collections, if any\n$cmd = 'use photos\ndb.albums.drop();\ndb.images.drop();'\n\n$cmd | mongo\n\n# Import the albums and photos\nGet-Content -Path '.\\final7\\final7\\albums.json' | mongoimport -d photos -c albums\nGet-Content -Path '.\\final7\\final7\\images.json' | mongoimport -d photos -c images\n\n$cmd = 'db.albums.createIndex({\"images\":1});\ndb.images.createIndex({\"tags\":1});'\n\n$cmd | mongo photos\n" } ]
powershell
chosen
[ { "from": "system", "value": "Allow extraction of nupkg files with 7zip\n\n" }, { "from": "human", "value": "function requires_7zip($manifest, $architecture) {\n foreach($dlurl in @(url $manifest $architecture)) {\n if(file_requires_7zip $dlurl) { return $true }\n }\n}\n\nfunction requires_lessmsi ($manifest, $architecture) {\n $useLessMsi = get_config MSIEXTRACT_USE_LESSMSI\n if (!$useLessMsi) { return $false }\n\n $(url $manifest $architecture | Where-Object {\n $_ -match '\\.(msi)$'\n } | Measure-Object | Select-Object -exp count) -gt 0\n}\n\nfunction file_requires_7zip($fname) {\n $fname -match '\\.((gz)|(tar)|(tgz)|(lzma)|(bz)|(bz2)|(7z)|(rar)|(iso)|(xz)|(lzh))$'\n}\n\nfunction extract_7zip($path, $to, $recurse) {\n $output = 7z x \"$path\" -o\"$to\" -y\n if($lastexitcode -ne 0) { abort \"Exit code was $lastexitcode.\" }\n\n # check for tar\n $tar = (split-path $path -leaf) -replace '\\.[^\\.]*$', ''\n if($tar -match '\\.tar$') {\n if(test-path \"$to\\$tar\") { extract_7zip \"$to\\$tar\" $to $true }\n }\n\n if($recurse) { Remove-Item $path } # clean up intermediate files\n}\n" }, { "from": "gpt", "value": "function requires_7zip($manifest, $architecture) {\n foreach($dlurl in @(url $manifest $architecture)) {\n if(file_requires_7zip $dlurl) { return $true }\n }\n}\n\nfunction requires_lessmsi ($manifest, $architecture) {\n $useLessMsi = get_config MSIEXTRACT_USE_LESSMSI\n if (!$useLessMsi) { return $false }\n\n $(url $manifest $architecture | Where-Object {\n $_ -match '\\.(msi)$'\n } | Measure-Object | Select-Object -exp count) -gt 0\n}\n\nfunction file_requires_7zip($fname) {\n $fname -match '\\.((gz)|(tar)|(tgz)|(lzma)|(bz)|(bz2)|(7z)|(rar)|(iso)|(xz)|(lzh)|(nupkg))$'\n}\n\nfunction extract_7zip($path, $to, $recurse) {\n $output = 7z x \"$path\" -o\"$to\" -y\n if($lastexitcode -ne 0) { abort \"Exit code was $lastexitcode.\" }\n\n # check for tar\n $tar = (split-path $path -leaf) -replace '\\.[^\\.]*$', ''\n if($tar -match '\\.tar$') {\n if(test-path \"$to\\$tar\") { extract_7zip \"$to\\$tar\" $to $true }\n }\n\n if($recurse) { Remove-Item $path } # clean up intermediate files\n}\n" } ]
powershell
chosen
[ { "from": "human", "value": "Add PowerShell helper functions for activating various dev envs\n" }, { "from": "gpt", "value": "# Prepend Node.js directories to PATH variable\nFunction Enable-Nodejs {\n [CmdletBinding()]\n Param(\n [Parameter(Mandatory)]\n [ValidateNotNullOrEmpty()]\n [String]$Path\n )\n\n $LocalNpmPath = Join-Path -Path $Env:APPDATA -ChildPath 'npm'\n Set-Item -Path Env:\\Path -Value ('{0};{1};{2}' -f $LocalNpmPath, $Path, $Env:PATH)\n}\n\n# Prepend Perl directories to PATH variable\nFunction Enable-Perl {\n [CmdletBinding()]\n Param(\n [Parameter(Mandatory)]\n [ValidateNotNullOrEmpty()]\n [String]$Path\n )\n\n $RootBinPath = Join-Path -Path $Path -ChildPath 'c\\bin'\n $SiteBinPath = Join-Path -Path $Path -ChildPath 'perl\\site\\bin'\n $PerlBinPath = Join-Path -Path $Path -ChildPath 'perl\\bin'\n Set-Item -Path Env:\\Path -Value ('{0};{1};{2};{3}' -f $RootBinPath, $SiteBinPath, $PerlBinPath, $Env:PATH)\n}\n\n# Prepend Python directories to PATH variable\nFunction Enable-Python {\n [CmdletBinding()]\n Param(\n [Parameter(Mandatory)]\n [ValidateNotNullOrEmpty()]\n [String]$Path\n )\n\n $ScriptsPath = Join-Path -Path $Path -ChildPath 'Scripts'\n Set-Item -Path Env:\\Path -Value ('{0};{1};{2}' -f $ScriptsPath, $Path, $Env:PATH)\n}\n" } ]
powershell
chosen
[ { "from": "system", "value": "Change the way Executor get's downloaded...\n" }, { "from": "human", "value": "$packageName = \"executor\"\r\n$url = \"http://www.1space.dk/executor/Executor.zip\"\r\n$appDir = \"$($env:SYSTEMDRIVE)\\tools\\$($packageName)\"\r\n$downloadPath = \"$env:TEMP\\$($packageName)Download\"\r\n\r\nif (Test-Path $downloadPath) {\r\n Remove-Item $downloadPath -Recurse -Force | Out-Null\r\n}\r\n\r\nNew-Item -Type Directory -Path $downloadPath | Out-Null\r\n\r\nDownload-File $url \"$downloadPath\\$packageName.zip\"\r\n\r\nif (Test-Path $appDir) {\r\n Write-Output \"Removing previous version of package...\"\r\n Remove-Item \"$($appDir)\\*\" -Recurse -Force\r\n}\r\n\r\nNew-Item -Type Directory -Path $appDir | Out-Null\r\n\r\nUnzip-File \"$downloadPath\\$packageName.zip\" \"$downloadPath\"\r\nCopy-Item -Path \"$downloadPath\\Executor\\*\" $appDir\r\nCopy-Item -Path \"$PSScriptRoot\\*.cmd\" $appDir\r\n\r\n$location = \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\"\r\n\r\n$key = Get-Item $location\r\n\r\nif ($key.GetValue(\"Executor\", $null) -ne $null) {\r\n Remove-ItemProperty -Path $location -Name \"Executor\"\r\n}\r\n\r\nNew-ItemProperty -Path $location -Name Executor `\r\n -Value \"$env:SYSTEMDRIVE\\Tools\\executor\\executor-run.cmd\"\r\n\r\n" }, { "from": "gpt", "value": "$packageName = \"executor\"\r\n$url = \"http://www.1space.dk/executor/Executor.zip\"\r\n$appDir = \"$($env:SYSTEMDRIVE)\\tools\\$($packageName)\"\r\n$downloadPath = \"$env:LOCALAPPDATA\\Temp\\$packageName\\DownLoad\"\r\n\r\nif (Test-Path $downloadPath) {\r\n Remove-Item $downloadPath -Recurse -Force | Out-Null\r\n}\r\n\r\nNew-Item -Type Directory -Path $downloadPath | Out-Null\r\n\r\nDownload-File $url \"$downloadPath\\$packageName.zip\"\r\n\r\nif (Test-Path $appDir) {\r\n Write-Output \"Removing previous version of package...\"\r\n Remove-Item \"$($appDir)\\*\" -Recurse -Force\r\n}\r\n\r\nNew-Item -Type Directory -Path $appDir | Out-Null\r\n\r\nUnzip-File \"$downloadPath\\$packageName.zip\" \"$downloadPath\"\r\nCopy-Item -Path \"$downloadPath\\Executor\\*\" $appDir -Recurse\r\nCopy-Item -Path \"$PSScriptRoot\\*.cmd\" $appDir\r\n\r\n$location = \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\"\r\n\r\n$key = Get-Item $location\r\n\r\nif ($key.GetValue(\"Executor\", $null) -ne $null) {\r\n Remove-ItemProperty -Path $location -Name \"Executor\"\r\n}\r\n\r\nNew-ItemProperty -Path $location -Name Executor `\r\n -Value \"$env:SYSTEMDRIVE\\Tools\\executor\\executor-run.cmd\"\r\n\r\n" } ]
powershell
chosen
[ { "from": "human", "value": "Add script to configure Azure\n" }, { "from": "gpt", "value": "# Adds application settings to Azure.\n#\n# This script needs to be run before first publishing of the website to Azure or\n# if any of the settings change.\n\nparam(\n [CmdletBinding(SupportsShouldProcess=$true)]\n \n [Parameter(Mandatory = $false)] \n [string] $WebSiteName = \"croquet-australia-api\",\n [Parameter(Mandatory = $false)] \n [string] $WebAppBaseUri = \"https://croquet-australia-tournaments.azurewebsites.net/\"\n)\n\n$appSettings = @{ ` \n \"WebApp:BaseUri\" = $WebAppBaseUri;\n}\n\nSet-AzureWebsite -Name \"$WebSiteName\" -AppSettings $appSettings " } ]
powershell
chosen
[ { "from": "system", "value": "Copy build into static site folder first\n" }, { "from": "human", "value": "param([string]$buildFolder, [string]$email, [string]$username, [string]$personalAccessToken, [string]$repoName)\n\nWrite-Host \"- Set config settings....\"\ngit config --global user.email $email\ngit config --global user.name $username\ngit config --global push.default matching\n\nWrite-Host \"- Clone gh-pages branch....\"\ncd \"$($buildFolder)\\..\\\"\nmkdir gh-pages\ngit clone --quiet --branch=gh-pages https://$($username):$($personalAccessToken)@github.com/$($repoName) .\\gh-pages\\\ncd gh-pages\ngit status\n\nWrite-Host \"- Clean gh-pages folder....\"\nGet-ChildItem -Attributes !r | Remove-Item -Recurse -Force\n\nWrite-Host \"- Copy contents of static-site folder into gh-pages folder....\"\ncopy-item -path ..\\static-site\\* -Destination $pwd.Path -Recurse\n\ngit status\n$thereAreChanges = git status | select-string -pattern \"Changes not staged for commit:\",\"Untracked files:\" -simplematch\nif ($thereAreChanges -ne $null) {\n Write-host \"- Committing changes to documentation...\"\n git add --all\n git status\n git commit -m \"skip ci - static site regeneration\"\n git status\n Write-Host \"- Push it....\"\n git push --quiet\n Write-Host \"- Pushed it good!\"\n}\nelse {\n write-host \"- No changes to documentation to commit\"\n}\n" }, { "from": "gpt", "value": "param([string]$buildFolder, [string]$email, [string]$username, [string]$personalAccessToken, [string]$repoName)\n\nWrite-Host \"- Set config settings....\"\ngit config --global user.email $email\ngit config --global user.name $username\ngit config --global push.default matching\n\nWrite-Host \"- Copy contents of build folder into a static-site folder....\"\ncopy-item -path .\\build\\* -Destination ..\\static-site\\* -Recurse\n\nWrite-Host \"- Clone gh-pages branch....\"\ncd \"$($buildFolder)\\..\\\"\nmkdir gh-pages\ngit clone --quiet --branch=gh-pages https://$($username):$($personalAccessToken)@github.com/$($repoName) .\\gh-pages\\\ncd gh-pages\ngit status\n\nWrite-Host \"- Clean gh-pages folder....\"\nGet-ChildItem -Attributes !r | Remove-Item -Recurse -Force\n\nWrite-Host \"- Copy contents of static-site folder into gh-pages folder....\"\ncopy-item -path ..\\static-site\\* -Destination $pwd.Path -Recurse\n\ngit status\n$thereAreChanges = git status | select-string -pattern \"Changes not staged for commit:\",\"Untracked files:\" -simplematch\nif ($thereAreChanges -ne $null) {\n Write-host \"- Committing changes to documentation...\"\n git add --all\n git status\n git commit -m \"skip ci - static site regeneration\"\n git status\n Write-Host \"- Push it....\"\n git push --quiet\n Write-Host \"- Pushed it good!\"\n}\nelse {\n write-host \"- No changes to documentation to commit\"\n}\n" } ]
powershell
chosen
[ { "from": "system", "value": "Add User Agent to Powershell Client" }, { "from": "human", "value": "$capcode = $args[0]\n$msgbody = $args[1]\n\n$sourcename \t= \"***Source name***\"\n$appurl \t= \"http://***App URL***/api/messages\" #http://www.example.com:3000/api/messages\n$apikey \t= \"***API Key***\"\n\n$datetime = [Math]::Floor([decimal](Get-Date(Get-Date).ToUniversalTime()-uformat \"%s\"))\n\n$url = $appurl \n $data = @{\n\t\t\taddress=$capcode\n\t\t\tmessage=$msgbody\n\t\t\tdatetime=$datetime \n\t\t\tsource=$sourcename\n }\n$json = $data | ConvertTo-Json\n$response = Invoke-RestMethod $url -Method post -Body $json -Header @{\"apikey\"=$apikey} -ContentType 'application/json'\n\nexit\n" }, { "from": "gpt", "value": "$capcode = $args[0]\n$msgbody = $args[1]\n\n$sourcename \t= \"***Source name***\"\n$appurl \t= \"http://***App URL***/api/messages\" #http://www.example.com:3000/api/messages\n$apikey \t= \"***API Key***\"\n\n$datetime = [Math]::Floor([decimal](Get-Date(Get-Date).ToUniversalTime()-uformat \"%s\"))\n\n$url = $appurl \n $data = @{\n\t\t\taddress=$capcode\n\t\t\tmessage=$msgbody\n\t\t\tdatetime=$datetime \n\t\t\tsource=$sourcename\n }\n$json = $data | ConvertTo-Json\n$response = Invoke-RestMethod $url -Method post -Body $json -Header @{\"apikey\"=$apikey} -ContentType 'application/json' -UserAgent 'PagerMon psclient.ps1'\n\nexit\n" } ]
powershell
chosen
[ { "from": "system", "value": "Update machine 0.9.0, compose 1.10.0" }, { "from": "human", "value": "# install docker tools\nchoco install -y docker-machine -version 0.8.2\nchoco install -y docker-compose -version 1.9.0\n" }, { "from": "gpt", "value": "# install docker tools\nchoco install -y docker-machine -version 0.9.0\nchoco install -y docker-compose -version 1.10.0\n" } ]
powershell
chosen
[ { "from": "system", "value": "Print message when restoring nuget packages\n" }, { "from": "human", "value": "<#\n.SYNOPSIS\n Restores NuGet packages.\n.PARAMETER Path\n The path of the solution, directory, packages.config or project.json file to restore packages from.\n If not specified, the current directory is used.\n.PARAMETER Verbosity\n#>\nParam(\n [Parameter(Position=1)]\n [string]$Path=(Get-Location),\n [Parameter()]\n [ValidateSet('Quiet','Normal','Detailed')]\n [string]$Verbosity='normal'\n)\n\n$nugetPath = & \"$PSScriptRoot\\Get-NuGetTool.ps1\"\n\nWrite-Verbose \"Restoring NuGet packages for $Path\"\n& $nugetPath restore $Path -Verbosity $Verbosity\nif ($lastexitcode -ne 0) { throw }\n" }, { "from": "gpt", "value": "<#\n.SYNOPSIS\n Restores NuGet packages.\n.PARAMETER Path\n The path of the solution, directory, packages.config or project.json file to restore packages from.\n If not specified, the current directory is used.\n.PARAMETER Verbosity\n#>\nParam(\n [Parameter(Position=1)]\n [string]$Path=(Get-Location),\n [Parameter()]\n [ValidateSet('Quiet','Normal','Detailed')]\n [string]$Verbosity='normal'\n)\n\n$nugetPath = & \"$PSScriptRoot\\Get-NuGetTool.ps1\"\n\nWrite-Host \"Restoring NuGet packages for $Path\" -ForegroundColor Yellow\n& $nugetPath restore $Path -Verbosity $Verbosity\nif ($lastexitcode -ne 0) { throw }\n" } ]
powershell
chosen
[ { "from": "system", "value": "Fix nuget package restore after moving nuget.config\n" }, { "from": "human", "value": "<#\n.SYNOPSIS\n Restores NuGet packages.\n.PARAMETER Path\n The path of the solution, directory, packages.config or project.json file to restore packages from.\n If not specified, the current directory is used.\n.PARAMETER Verbosity\n#>\nParam(\n [Parameter(Position=1)]\n [string]$Path=(Get-Location),\n [Parameter()]\n [ValidateSet('Quiet','Normal','Detailed')]\n [string]$Verbosity='normal'\n)\n\n$nugetPath = & \"$PSScriptRoot\\Get-NuGetTool.ps1\"\n\nWrite-Host \"Restoring NuGet packages for $Path\" -ForegroundColor Yellow\n& $nugetPath restore $Path -Verbosity $Verbosity\nif ($lastexitcode -ne 0) { throw }\n" }, { "from": "gpt", "value": "<#\n.SYNOPSIS\n Restores NuGet packages.\n.PARAMETER Path\n The path of the solution, directory, packages.config or project.json file to restore packages from.\n If not specified, the current directory is used.\n.PARAMETER Verbosity\n#>\nParam(\n [Parameter(Position=1)]\n [string]$Path=(Get-Location),\n [Parameter()]\n [ValidateSet('Quiet','Normal','Detailed')]\n [string]$Verbosity='normal'\n)\n\n$nugetPath = & \"$PSScriptRoot\\Get-NuGetTool.ps1\"\n\nWrite-Host \"Restoring NuGet packages for $Path\" -ForegroundColor Yellow\n& $nugetPath restore $Path -Verbosity $Verbosity -ConfigFile \"$PSScriptRoot\\..\\src\\nuget.config\"\nif ($lastexitcode -ne 0) { throw }\n" } ]
powershell
chosen
[ { "from": "system", "value": "Install node packages: pass python path on cli\n" }, { "from": "human", "value": "function Install-NodePackages($packages) {\n\tforeach ($package in $packages) {\n\t\tUpdate-NodePackage $package\n\t}\n}\n\nfunction Get-InstalledNodePackages {\n\tif ($script:installedNodePackages -eq $null) {\n\t\t$script:installedNodePackages = (& npm list -g --depth=0) | Out-String\n\t}\n\treturn $script:installedNodePackages\n}\n\nfunction Update-NodePackage($name) {\n\t$installed = Get-InstalledNodePackages\n\tif ($installed -like \"*$name@*\") {\n\t\tWrite-Output \"Updating $name\"\n\t\tnpm update -g $name\n\t} else {\n\t\tWrite-Output \"Installing $name\"\n\t\tnpm install -g $name\n\t}\n}" }, { "from": "gpt", "value": "# Passing Python Path on install:\n# npm install --python=c:\\bin\\python2\n\nfunction Install-NodePackages($packages) {\n\tforeach ($package in $packages) {\n\t\tUpdate-NodePackage $package\n\t}\n}\n\nfunction Get-InstalledNodePackages {\n\tif ($script:installedNodePackages -eq $null) {\n\t\t$script:installedNodePackages = (& npm list -g --depth=0) | Out-String\n\t}\n\treturn $script:installedNodePackages\n}\n\nfunction Update-NodePackage($name) {\n\t$installed = Get-InstalledNodePackages\n\tif ($installed -like \"*$name@*\") {\n\t\tWrite-Output \"Updating $name\"\n\t\tnpm update -g $name\n\t} else {\n\t\tWrite-Output \"Installing $name\"\n\t\tnpm install -g $name\n\t}\n}" } ]
powershell
chosen
[ { "from": "system", "value": "Enable WSL during choco install." }, { "from": "human", "value": "$osVersion = [Environment]::OSVersion.Version.Major\r\n$osRelId = (gp 'HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion').ReleaseId\r\nif ($osVersion -ne 10 -or $osRelId -lt 1703) {\r\n\tthrow \"This package requires Windows 10 Fall Creators Update or later.\"\r\n}\r\n\r\nif ($Env:PROCESSOR_ARCHITECTURE -ne 'AMD64') {\r\n\tthrow \"This package requires a 64-bit Windows.\"\r\n}\r\n\r\nNew-ItemProperty -Force -Path 'HKLM:\\System\\CurrentControlSet\\Control\\Session Manager\\Kernel' -Name 'obcaseinsensitive' -Value 0 -PropertyType Dword\r\nWrite-Warning 'Please restart your system to let registry changes take effect.'\r\n\r\n$packageName = 'lxrunoffline'\r\n$url = 'https://github.com/DDoSolitary/LxRunOffline/releases/download/v{VERSION}/LxRunOffline-v{VERSION}.zip'\r\n$unzipLocation = Join-Path (Get-ToolsLocation) $packageName\r\nif (Test-Path $unzipLocation) {\r\n\trm -Recurse $unzipLocation\r\n}\r\nInstall-ChocolateyZipPackage -PackageName $packageName -Url $url -UnzipLocation $unzipLocation -Checksum '{CHECKSUM}' -ChecksumType 'sha256'\r\nInstall-ChocolateyPath -PathToInstall $unzipLocation -PathType 'Machine'\r\n" }, { "from": "gpt", "value": "$osVersion = [Environment]::OSVersion.Version.Major\r\n$osRelId = (gp 'HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion').ReleaseId\r\nif ($osVersion -ne 10 -or $osRelId -lt 1703) {\r\n\tthrow \"This package requires Windows 10 Fall Creators Update or later.\"\r\n}\r\n\r\nif ($Env:PROCESSOR_ARCHITECTURE -ne 'AMD64') {\r\n\tthrow \"This package requires a 64-bit Windows.\"\r\n}\r\n\r\nEnable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux\r\n\r\nNew-ItemProperty -Force -Path 'HKLM:\\System\\CurrentControlSet\\Control\\Session Manager\\Kernel' -Name 'obcaseinsensitive' -Value 0 -PropertyType Dword\r\nWrite-Warning 'Please restart your system to let registry changes take effect.'\r\n\r\n$packageName = 'lxrunoffline'\r\n$url = 'https://github.com/DDoSolitary/LxRunOffline/releases/download/v{VERSION}/LxRunOffline-v{VERSION}.zip'\r\n$unzipLocation = Join-Path (Get-ToolsLocation) $packageName\r\nif (Test-Path $unzipLocation) {\r\n\trm -Recurse $unzipLocation\r\n}\r\nInstall-ChocolateyZipPackage -PackageName $packageName -Url $url -UnzipLocation $unzipLocation -Checksum '{CHECKSUM}' -ChecksumType 'sha256'\r\nInstall-ChocolateyPath -PathToInstall $unzipLocation -PathType 'Machine'\r\n" } ]
powershell
chosen
[ { "from": "system", "value": "Allow to specify project name from parameter\n" }, { "from": "human", "value": "function Add-FluentMigration\n{\n [CmdletBinding(DefaultParameterSetName = 'Name')]\n param (\n [parameter(Position = 0,\n Mandatory = $true)]\n [string] $Name)\n $timestamp = (Get-Date -Format yyyyMMddHHmmss)\n\n $project = Get-Project\n $namespace = $project.Properties.Item(\"DefaultNamespace\").Value.ToString() + \".Migrations\"\n $projectPath = [System.IO.Path]::GetDirectoryName($project.FullName)\n $migrationsPath = [System.IO.Path]::Combine($projectPath, \"Migrations\")\n $outputPath = [System.IO.Path]::Combine($migrationsPath, \"$timestamp\" + \"_$name.cs\")\n\n if (-not (Test-Path $migrationsPath))\n {\n [System.IO.Directory]::CreateDirectory($migrationsPath)\n }\n\n \"using FluentMigrator;\n\nnamespace $namespace\n{\n [Migration($timestamp)]\n public class $name : Migration\n {\n public override void Up()\n {\n }\n\n public override void Down()\n {\n }\n }\n}\" | Out-File -Encoding \"UTF8\" -Force $outputPath\n\n $project.ProjectItems.AddFromFile($outputPath)\n $project.Save()\n}\n\nExport-ModuleMember @( 'Add-FluentMigration' )\n" }, { "from": "gpt", "value": "function Add-FluentMigration\n{\n [CmdletBinding(DefaultParameterSetName = 'Name')]\n param (\n [parameter(Position = 0,\n Mandatory = $true)]\n [string] $Name,\n [string] $ProjectName)\n $timestamp = (Get-Date -Format yyyyMMddHHmmss)\n\n if ($ProjectName) {\n $project = Get-Project $ProjectName\n if ($project -is [array])\n {\n throw \"More than one project '$ProjectName' was found. Please specify the full name of the one to use.\"\n }\n }\n else {\n $project = Get-Project\n }\n $namespace = $project.Properties.Item(\"DefaultNamespace\").Value.ToString() + \".Migrations\"\n $projectPath = [System.IO.Path]::GetDirectoryName($project.FullName)\n $migrationsPath = [System.IO.Path]::Combine($projectPath, \"Migrations\")\n $outputPath = [System.IO.Path]::Combine($migrationsPath, \"$timestamp\" + \"_$name.cs\")\n\n if (-not (Test-Path $migrationsPath))\n {\n [System.IO.Directory]::CreateDirectory($migrationsPath)\n }\n\n \"using FluentMigrator;\n\nnamespace $namespace\n{\n [Migration($timestamp)]\n public class $name : Migration\n {\n public override void Up()\n {\n }\n\n public override void Down()\n {\n }\n }\n}\" | Out-File -Encoding \"UTF8\" -Force $outputPath\n\n $project.ProjectItems.AddFromFile($outputPath)\n $project.Save()\n}\n\nExport-ModuleMember @( 'Add-FluentMigration' )\n" } ]
powershell
chosen
[ { "from": "system", "value": "Use dism.exe OR the Get-WindowsFeature cmdlet\n" }, { "from": "human", "value": "function ListWindowsFeatures\n{ \n $cachepath = \"${env:temp}/ListWindowsFeatures.xml\"\n $maxAge = 2\n\n $cache = Get-Item $cachepath -erroraction SilentlyContinue\n\n if($cache -ne $null -and ((get-date) - $cache.LastWriteTime).minutes -lt $maxage){\n return Import-Clixml $cachepath\n }\n else{\n try\n {\n $dism = DISM /Online /Get-Features /Format:List | Where-Object {$_} \n\n if($LASTEXITCODE -ne 0)\n {\n Write-Error $dism\n Break\n }\n\n $f = $dism[4..($dism.length-2)]\n $feature = for($i=0; $i -lt $f.length;$i+=2)\n {\n $tmp = $f[$i],$f[$i+1] -replace '^([^:]+:\\s)'\n \n New-Object PSObject -Property @{\n Name = $tmp[0]\n State = $tmp[1]\n }\n }\n\n $feature | Export-Clixml $cachepath\n\n return $feature\n }\n catch\n {\n Throw\n }\n\n }\n}" }, { "from": "gpt", "value": "function ListWindowsFeatures\n{ \n\nparam(\n [string]$feature,\n [string]$provider=\"dism\"\n )\n\n $cachepath = \"${env:temp}/ListWindowsFeatures-${provider}.xml\"\n $maxAge = 2\n\n $cache = Get-Item $cachepath -erroraction SilentlyContinue\n\n if($cache -ne $null -and ((get-date) - $cache.LastWriteTime).minutes -lt $maxage){\n $features = Import-Clixml $cachepath | Select *| Where-Object {(($_.name -like $feature) -or ($_.displayName -like $feature)) -and (($_.installed -eq $true) -or ($_.state -eq \"Enabled\"))}\n return $features\n }\n else{\n\n switch($provider)\n {\n \"dism\" { return features_dism | Select * | Where-Object {($_.name -eq $feature) -and ($_.state -eq \"Enabled\")} }\n \"powershell\" { return features_powershell | Select * | Where-Object {(($_.name -like $feature) -or ($_.displayName -like $feature)) -and ($_.installed -eq $true)} }\n default {throw \"Unsupported provider\"}\n }\n\n }\n}\n\nfunction features_dism{\n try\n {\n $out = DISM /Online /Get-Features /Format:List | Where-Object {$_} \n\n if($LASTEXITCODE -ne 0)\n {\n Write-Error $out\n Break\n }\n\n $f = $out[4..($out.length-2)]\n $features = for($i=0; $i -lt $f.length;$i+=2)\n {\n $tmp = $f[$i],$f[$i+1] -replace '^([^:]+:\\s)'\n \n New-Object PSObject -Property @{\n Name = $tmp[0]\n State = $tmp[1]\n }\n }\n\n $features | Export-Clixml $cachepath\n\n return $features\n }\n catch\n {\n Throw\n }\n}\n\nfunction features_powershell{\n import-module servermanager\n $features = Get-WindowsFeature\n $features | Export-Clixml $cachepath\n return Get-WindowsFeature \n}" } ]
powershell
chosen
[ { "from": "human", "value": "Add TEPP for Group parameter\n" }, { "from": "gpt", "value": "#region Initialize Cache\nif (-not [Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::Cache[\"group\"]) {\n\t[Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::Cache[\"group\"] = @{ }\n}\n#endregion Initialize Cache\n\n#region Tepp Data return\n$ScriptBlock = {\n param (\n $commandName,\n \n $parameterName,\n \n $wordToComplete,\n \n $commandAst,\n \n $fakeBoundParameter\n )\n \n $start = Get-Date\n [Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::Scripts[\"group\"].LastExecution = $start\n\t\n\t$server = $fakeBoundParameter['SqlInstance']\n\t\n\tif (-not $server) {\n\t\t$server = $fakeBoundParameter['Source']\n\t}\n\t\n\tif (-not $server) {\n\t\t$server = $fakeBoundParameter['ComputerName']\n\t}\n\t\n\tif (-not $server) { return }\n\t\n try\n {\n [DbaInstanceParameter]$parServer = $server | Select-Object -First 1\n }\n catch\n {\n [Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::Scripts[\"group\"].LastDuration = (Get-Date) - $start\n return\n }\n \n if ([Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::Cache[\"group\"][$parServer.FullSmoName.ToLower()])\n {\n foreach ($name in ([Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::Cache[\"group\"][$parServer.FullSmoName.ToLower()] | Where-DbaObject -Like \"$wordToComplete*\"))\n {\n New-DbaTeppCompletionResult -CompletionText $name -ToolTip $name\n }\n [Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::Scripts[\"group\"].LastDuration = (Get-Date) - $start\n return\n }\n \n try\n {\n $serverObject = Connect-SqlInstance -SqlInstance $parServer -SqlCredential $fakeBoundParameter['SqlCredential'] -ErrorAction Stop\n foreach ($name in ([Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::Cache[\"group\"][$parServer.FullSmoName.ToLower()] | Where-DbaObject -Like \"$wordToComplete*\"))\n {\n New-DbaTeppCompletionResult -CompletionText $name -ToolTip $name\n }\n [Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::Scripts[\"group\"].LastDuration = (Get-Date) - $start\n return\n }\n catch\n {\n [Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::Scripts[\"group\"].LastDuration = (Get-Date) - $start\n return\n }\n}\n\nRegister-DbaTeppScriptblock -ScriptBlock $ScriptBlock -Name Group\n#endregion Tepp Data return\n\n#region Update Cache\n$ScriptBlock = {\n\n $cms = New-Object Microsoft.SqlServer.Management.RegisteredServers.RegisteredServersStore($server.ConnectionContext.SqlConnectionObject)\n\t[Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::Cache[\"group\"][$FullSmoName] = $cms.DatabaseEngineServerGroup.ServerGroups.Name\n}\nRegister-DbaTeppInstanceCacheBuilder -ScriptBlock $ScriptBlock\n#endregion Update Cache\n" } ]
powershell
chosen
[ { "from": "system", "value": "Upgrade to VM version 7.0.40\n" }, { "from": "human", "value": "\n# Powershell script to pull the VM files from GitHub into the current folder.\n# Edit the following to match the version of the VM that is compatible with this image\n\nparam \n(\n [string]$VMversion=\"v7.0.39\"\n)\n\nTry \n{\n\t$scriptDir = Split-Path $script:MyInvocation.MyCommand.Path;\n\tWrite-Host \"Fetching DolphinVM.zip\" $VMversion\n\t$source = \"https://github.com/dolphinsmalltalk/DolphinVM/releases/download/$VMversion/DolphinVM.zip\";\n\t$zipFile = $scriptDir+\"\\DolphinVM.zip\";\n\tInvoke-WebRequest $source -OutFile $zipFile;\n}\nCatch\n{\n\tWrite-Host \"Unable to fetch DolphinVM.zip\" $VMversion;\n\tBreak;\n}\n\n$shell = new-object -com shell.application;\n$zip = $shell.NameSpace($zipFile);\nforeach($item in $zip.items())\n{\n\tWrite-Host \"..unpack\" $item.Name\n\t$shell.Namespace($scriptDir).copyhere($item, 0x14);\n}\nWrite-Host \"Removing Zip\"\nRemove-Item $zipFile\nWrite-Host \"Done fetching DolphinVM.zip\" $VMversion" }, { "from": "gpt", "value": "\n# Powershell script to pull the VM files from GitHub into the current folder.\n# Edit the following to match the version of the VM that is compatible with this image\n\nparam \n(\n [string]$VMversion=\"v7.0.40\"\n)\n\nTry \n{\n\t$scriptDir = Split-Path $script:MyInvocation.MyCommand.Path;\n\tWrite-Host \"Fetching DolphinVM.zip\" $VMversion\n\t$source = \"https://github.com/dolphinsmalltalk/DolphinVM/releases/download/$VMversion/DolphinVM.zip\";\n\t$zipFile = $scriptDir+\"\\DolphinVM.zip\";\n\tInvoke-WebRequest $source -OutFile $zipFile;\n}\nCatch\n{\n\tWrite-Host \"Unable to fetch DolphinVM.zip\" $VMversion;\n\tBreak;\n}\n\n$shell = new-object -com shell.application;\n$zip = $shell.NameSpace($zipFile);\nforeach($item in $zip.items())\n{\n\tWrite-Host \"..unpack\" $item.Name\n\t$shell.Namespace($scriptDir).copyhere($item, 0x14);\n}\nWrite-Host \"Removing Zip\"\nRemove-Item $zipFile\nWrite-Host \"Done fetching DolphinVM.zip\" $VMversion" } ]
powershell
chosen
[ { "from": "system", "value": "Reduce noise in package restore\n" }, { "from": "human", "value": "Write-Host \"Restoring NuGet packages...\" -ForegroundColor Yellow\nnuget restore \"$PSScriptRoot\\src\" -Verbosity quiet\n\nWrite-Host \"Restoring NPM packages...\" -ForegroundColor Yellow\nPush-Location \"$PSScriptRoot\\src\\nerdbank-gitversioning.npm\"\nnpm install\n\nWrite-Host \"Restoring Typings...\" -ForegroundColor Yellow\n .\\node_modules\\.bin\\typings install\nPop-Location\n" }, { "from": "gpt", "value": "Write-Host \"Restoring NuGet packages...\" -ForegroundColor Yellow\nnuget restore \"$PSScriptRoot\\src\" -Verbosity quiet\n\nWrite-Host \"Restoring NPM packages...\" -ForegroundColor Yellow\nPush-Location \"$PSScriptRoot\\src\\nerdbank-gitversioning.npm\"\nnpm install --loglevel error\n\nWrite-Host \"Restoring Typings...\" -ForegroundColor Yellow\n .\\node_modules\\.bin\\typings install\nPop-Location\n" } ]
powershell
chosen
[ { "from": "human", "value": "Add a script for creating revisions from source codes\n" }, { "from": "gpt", "value": "\r\n$ErrorActionPreference = \"Stop\"\r\n\r\n$scriptDir = Split-Path ( & {$MyInvocation.ScriptName}) -Parent\r\n\r\n$inspectCodePath = \"C:\\temp\\JetBrains.ReSharper.CommandLineTools.2017.1.20170613.162720\\inspectcode.exe\"\r\n$sourceCodePath = \"C:\\temp\\InspectCodeViewer\"\r\n$parseToolPath = Join-Path $scriptDir \"dist\\ParseInspectedCodes.exe\"\r\n$updateToolPath = Join-Path $scriptDir \"dist\\UpdateRevisions.exe\"\r\n$solutionsFileNames = @(\r\n,\".\\InspectCodeVisualizer.sln\"\r\n,\".\\InspectCodeViewer.sln\"\r\n);\r\n$repositoryUrlBase = \"https://github.com/banban525/InspectCodeViewer/commit/{0}\"\r\n\r\n\r\nPush-Location $sourceCodePath\r\ntry\r\n{\r\n & git checkout master -q\r\n $hashes = & git log --pretty=format:\"%H\"\r\n $hashes = $hashes[($hashes.length-1)..0]\r\n foreach($hash in $hashes)\r\n {\r\n $hash\r\n & git checkout \"$hash\" -q\r\n\r\n $solutionsFile = @($solutionsFileNames | Where-Object { Test-Path $_ } )[0]\r\n\r\n & $inspectCodePath --output=\"C:\\Temp\\InspectCodeVisualizer\\inspectCode.result.xml\" $solutionsFile \"--disable-settings-layers:GlobalAll;GlobalPerProduct;SolutionPersonal;ProjectPersonal\"\r\n \r\n & $parseToolPath --input \"C:\\Temp\\InspectCodeVisualizer\\inspectCode.result.xml\" --base $sourceCodePath --link ($repositoryUrlBase -f ($hash)) --title ($hash.Substring(0,8))\r\n #break\r\n }\r\n & $updateToolPath\r\n}\r\nfinally\r\n{\r\n Pop-Location\r\n}" } ]
powershell
chosen
[ { "from": "system", "value": "Remove Cmdlet type declaration - caused implicit conversions to string\n" }, { "from": "human", "value": "# Edit JSON preference files\n# \n# Licensed under the Apache License, Version 2.0\n# http://www.apache.org/licenses/LICENSE-2.0\n\nfunction Set-JsonPreference\n{\n [CmdletBinding()]\n param\n (\n [Parameter(Mandatory=$True,ValueFromPipeline=$True,ValueFromPipelineByPropertyName=$True)]\n\t [string] $Path,\n [Parameter(Mandatory=$True,ValueFromPipeline=$True,ValueFromPipelineByPropertyName=$True)]\n\t [string] $Category,\n [Parameter(Mandatory=$True,ValueFromPipeline=$True,ValueFromPipelineByPropertyName=$True)]\n\t [string] $Property,\n [Parameter(Mandatory=$True,ValueFromPipeline=$True,ValueFromPipelineByPropertyName=$True)]\n [AllowEmptyString()]\n\t [string] $Value\n )\n process\n {\n $json = (Get-Content $Path) | ConvertFrom-Json\n\n $categoryValue = $json.PSobject.Properties | Where-Object {$_.Name -eq $Category}\n if($categoryValue)\n {\n Add-Member -Name $Property -Value $Value -MemberType NoteProperty -InputObject $json.$Category -Force\n }\n else\n {\n $json | Add-Member -Name $category -Value @{ $Property = $Value } -MemberType NoteProperty\n }\n\n ConvertTo-Json $json -Compress | Set-Content $Path\n return $true\n }\n}" }, { "from": "gpt", "value": "# Edit JSON preference files\n# \n# Licensed under the Apache License, Version 2.0\n# http://www.apache.org/licenses/LICENSE-2.0\n\nfunction Set-JsonPreference\n{\n [CmdletBinding()]\n param\n (\n [Parameter(Mandatory=$True,ValueFromPipeline=$True,ValueFromPipelineByPropertyName=$True)]\n\t [string] $Path,\n [Parameter(Mandatory=$True,ValueFromPipeline=$True,ValueFromPipelineByPropertyName=$True)]\n\t [string] $Category,\n [Parameter(Mandatory=$True,ValueFromPipeline=$True,ValueFromPipelineByPropertyName=$True)]\n\t [string] $Property,\n [Parameter(Mandatory=$True,ValueFromPipeline=$True,ValueFromPipelineByPropertyName=$True)]\n [AllowEmptyString()]\n # Skipped type declaration to avoid unwanted conversions (example: $true should be a boolean, not a string value - \"true\")\n\t $Value\n )\n process\n {\n $json = (Get-Content $Path) | ConvertFrom-Json\n\n $categoryValue = $json.PSobject.Properties | Where-Object {$_.Name -eq $Category}\n if($categoryValue)\n {\n Add-Member -Name $Property -Value $Value -MemberType NoteProperty -InputObject $json.$Category -Force\n }\n else\n {\n $json | Add-Member -Name $category -Value @{ $Property = $Value } -MemberType NoteProperty\n }\n\n ConvertTo-Json $json -Compress | Set-Content $Path\n return $true\n }\n}" } ]
powershell
chosen
[ { "from": "system", "value": "Replace string concatenation with Path.Combine\n" }, { "from": "human", "value": "# This approach still has issues, but would be the simplest approach for this script\n# See: https://github.com/dotnet/eShopOnContainers/issues/74 \n\nParam([string] $rootPath)\n$scriptPath = Split-Path $script:MyInvocation.MyCommand.Path\n\nWrite-Host \"Current script directory is $scriptPath\" -ForegroundColor Yellow\n\nif ([string]::IsNullOrEmpty($rootPath)) {\n $rootPath = \"$scriptPath\\..\"\n}\nWrite-Host \"Root path used is $rootPath\" -ForegroundColor Yellow\n\n\n$SolutionFilePath = $rootPath + \"eShopOnContainers-ServicesAndWebApps.sln\"\n\ndotnet restore $SolutionFilePath\n\ndotnet publish $SolutionFilePath -c Release -o .\\obj\\Docker\\publish\n\n" }, { "from": "gpt", "value": "# This approach still has issues, but would be the simplest approach for this script\n# See: https://github.com/dotnet/eShopOnContainers/issues/74 \n\nParam([string] $rootPath)\n$scriptPath = Split-Path $script:MyInvocation.MyCommand.Path\n\nWrite-Host \"Current script directory is $scriptPath\" -ForegroundColor Yellow\n\nif ([string]::IsNullOrEmpty($rootPath)) {\n $rootPath = \"$scriptPath\\..\"\n}\nWrite-Host \"Root path used is $rootPath\" -ForegroundColor Yellow\n\n$SolutionFilePath = [IO.Path]::Combine($rootPath, \"eShopOnContainers-ServicesAndWebApps.sln\")\n\ndotnet restore $SolutionFilePath\n\ndotnet publish $SolutionFilePath -c Release -o .\\obj\\Docker\\publish\n\n" } ]
powershell
chosen
[ { "from": "system", "value": "Disable automatic checkpoints prior to VM removal\n" }, { "from": "human", "value": "#Requires -Modules VagrantMessages\n\nparam(\n [Parameter(Mandatory=$true)]\n [string]$VmId\n)\n\n$ErrorActionPreference = \"Stop\"\n\ntry {\n $VM = Hyper-V\\Get-VM -Id $VmId\n Hyper-V\\Remove-VM $VM -Force\n} catch {\n Write-ErrorMessage \"Failed to delete VM: ${PSItem}\"\n exit 1\n}\n" }, { "from": "gpt", "value": "#Requires -Modules VagrantMessages\n\nparam(\n [Parameter(Mandatory=$true)]\n [string]$VmId\n)\n\n$ErrorActionPreference = \"Stop\"\n\ntry {\n $VM = Hyper-V\\Get-VM -Id $VmId\n if((Get-Command Hyper-V\\Set-VM).Parameters[\"AutomaticCheckpointsEnabled\"] -ne $null) {\n Hyper-V\\Set-VM -VM $VM -AutomaticCheckpointsEnabled $false -ErrorAction SilentlyContinue\n }\n Hyper-V\\Remove-VM $VM -Force\n} catch {\n Write-ErrorMessage \"Failed to delete VM: ${PSItem}\"\n exit 1\n}\n" } ]
powershell
chosen
[ { "from": "human", "value": "Create an script to install the log4net implementation of the logging interface." }, { "from": "gpt", "value": "param($installPath, $toolsPath, $package, $project)\n\n# $project = Get-Project\n\n$log4net = $project.ProjectItems.Item(\"nohros.logging.log4net.dll\")\n\n# set Build Action to None\n$log4net.Properties.Item(\"BuildAction\").Value = 0\n\n# set Copy to Output Directy to Copy if newer\n$log4net.Properties.Item(\"CopyToOutputDirectory\").Value = 2" } ]
powershell
chosen
[ { "from": "system", "value": "Update setup to configure Engine API\n" }, { "from": "human", "value": "if (-Not (Get-Command docker -errorAction SilentlyContinue))\n{\n Install-PackageProvider -Name NuGet -Force\n Install-Module -Name DockerMsftProvider -Repository PSGallery -Force\n Install-Package -Name docker -ProviderName DockerMsftProvider -Force\n Restart-Computer -Wait -Force\n}\n\n$images = docker images | Out-String\n\nif (-Not ($images -like \"*microsoft/nanoserver*\"))\n{\n docker pull microsoft/nanoserver\n}\n\nif (-Not (Test-Path node\\node.exe))\n{\n wget -Uri https://nodejs.org/dist/v6.9.5/node-v6.9.5-x64.msi -OutFile node.msi -UseBasicParsing\n Start-Process -FilePath msiexec -ArgumentList /q, /i, node.msi -Wait\n Remove-Item -Path node.msi\n Copy-Item '\\Program Files\\nodejs\\node.exe' node\\node.exe\n}\n\nif (-Not ($images -like \"*serverless-node*\"))\n{\n cd node\n docker build -t serverless-node .\n}\n" }, { "from": "gpt", "value": "if (-Not (Get-Command docker -errorAction SilentlyContinue))\n{\n Install-PackageProvider -Name NuGet -Force\n Install-Module -Name DockerMsftProvider -Repository PSGallery -Force\n Install-Package -Name docker -ProviderName DockerMsftProvider -Force\n Restart-Computer -Wait -Force\n}\n\ndockerd --unregister-service\nnet stop docker\ndockerd -H npipe:////./pipe/docker_engine -H 0.0.0.0:2375 --register-service\nnet start docker\n\n$images = docker images | Out-String\n\nif (-Not ($images -like \"*microsoft/nanoserver*\"))\n{\n docker pull microsoft/nanoserver\n}\n\nif (-Not (Test-Path node\\node.exe))\n{\n wget -Uri https://nodejs.org/dist/v6.9.5/node-v6.9.5-x64.msi -OutFile node.msi -UseBasicParsing\n Start-Process -FilePath msiexec -ArgumentList /q, /i, node.msi -Wait\n Remove-Item -Path node.msi\n Copy-Item '\\Program Files\\nodejs\\node.exe' node\\node.exe\n}\n\nif (-Not ($images -like \"*serverless-node*\"))\n{\n cd node\n docker build -t serverless-node .\n}\n" } ]
powershell
chosen
[ { "from": "system", "value": "Allow nugetApiKey to be specified as a parameter not a property.\n" }, { "from": "human", "value": "properties {\n $nugetApiKey = \"\"\n\n $binRoot = \"..\\bin\"\n $solution = \"..\\Harbour.RedisTempData.sln\"\n $testsRoot = \"..\\tests\\Harbour.RedisTempData.Test\"\n $nuspec = \"..\\Harbour.RedisTempData.nuspec\"\n\n $nuget = resolve-path \"..\\.nuget\\nuget.exe\"\n $xunit = resolve-path \"..\\packages\\xunit.runners.*\\tools\\xunit.console.clr4.exe\"\n}\n\ntask default -depends build-package\n\ntask clean {\n if (test-path $binRoot) {\n rm $binRoot -force -recurse\n }\n}\n\ntask build -depends clean {\n\n exec {\n # NOTE: 1591 is XML docs.\n msbuild \"$solution\" /t:\"Clean;Build\" /p:Configuration=\"Release\" /p:NoWarn=1591\n }\n\n}\n\ntask test {\n\n exec {\n $testBin = resolve-path \"$testsRoot\\bin\\Release\\Harbour.RedisTempData.Test.dll\"\n & $xunit \"$testBin\" /noshadow\n }\n\n}\n\ntask build-package -depends build, test {\n \n mkdir $binRoot\n\n exec {\n & $nuget pack $nuspec -outputDirectory $binRoot\n }\n\n}\n\ntask publish-package -depends build-package {\n\n exec {\n $nugetPackage = resolve-path \"$binRoot\\*.nupkg\"\n & $nuget push \"$nugetPackage\" $nugetApiKey\n }\n\n}" }, { "from": "gpt", "value": "properties {\n $binRoot = \"..\\bin\"\n $solution = \"..\\Harbour.RedisTempData.sln\"\n $testsRoot = \"..\\tests\\Harbour.RedisTempData.Test\"\n $nuspec = \"..\\Harbour.RedisTempData.nuspec\"\n\n $nuget = resolve-path \"..\\.nuget\\nuget.exe\"\n $xunit = resolve-path \"..\\packages\\xunit.runners.*\\tools\\xunit.console.clr4.exe\"\n}\n\ntask default -depends build-package\n\ntask clean {\n if (test-path $binRoot) {\n rm $binRoot -force -recurse\n }\n}\n\ntask build -depends clean {\n\n exec {\n # NOTE: 1591 is XML docs.\n msbuild \"$solution\" /t:\"Clean;Build\" /p:Configuration=\"Release\" /p:NoWarn=1591\n }\n\n}\n\ntask test {\n\n exec {\n $testBin = resolve-path \"$testsRoot\\bin\\Release\\Harbour.RedisTempData.Test.dll\"\n & $xunit \"$testBin\" /noshadow\n }\n\n}\n\ntask build-package -depends build, test {\n \n mkdir $binRoot\n\n exec {\n & $nuget pack $nuspec -outputDirectory $binRoot\n }\n\n}\n\ntask publish-package -depends build-package {\n\n exec {\n $nugetPackage = resolve-path \"$binRoot\\*.nupkg\"\n & $nuget push \"$nugetPackage\" $nugetApiKey\n }\n\n}" } ]
powershell
chosen
[ { "from": "system", "value": "Update test version that we will run training against\n" }, { "from": "human", "value": "[CmdletBinding(PositionalBinding=$false)]\nparam (\n [switch]$release = $false)\n\nSet-StrictMode -version 2.0\n$ErrorActionPreference = \"Stop\"\n\ntry {\n . (Join-Path $PSScriptRoot \"build-utils.ps1\")\n Push-Location $repoDir\n \n Write-Host \"Repo Dir $repoDir\"\n Write-Host \"Binaries Dir $binariesDir\"\n \n $buildConfiguration = if ($release) { \"Release\" } else { \"Debug\" }\n $configDir = Join-Path (Join-Path $binariesDir \"VSSetup\") $buildConfiguration\n \n $optProfToolDir = Get-PackageDir \"Roslyn.OptProf.RunSettings.Generator\"\n $optProfToolExe = Join-Path $optProfToolDir \"tools\\roslyn.optprof.runsettings.generator.exe\"\n $configFile = Join-Path $repoDir \"build\\config\\optprof.json\"\n $outputFolder = Join-Path $configDir \"Insertion\\RunSettings\"\n $optProfArgs = \"--configFile $configFile --outputFolder $outputFolder --buildNumber 28302.01 \"\n \n Exec-Console $optProfToolExe $optProfArgs\n exit 0\n}\ncatch {\n Write-Host $_\n Write-Host $_.Exception\n Write-Host $_.ScriptStackTrace\n exit 1\n}\nfinally {\n Pop-Location\n}" }, { "from": "gpt", "value": "[CmdletBinding(PositionalBinding=$false)]\nparam (\n [switch]$release = $false)\n\nSet-StrictMode -version 2.0\n$ErrorActionPreference = \"Stop\"\n\ntry {\n . (Join-Path $PSScriptRoot \"build-utils.ps1\")\n Push-Location $repoDir\n \n Write-Host \"Repo Dir $repoDir\"\n Write-Host \"Binaries Dir $binariesDir\"\n \n $buildConfiguration = if ($release) { \"Release\" } else { \"Debug\" }\n $configDir = Join-Path (Join-Path $binariesDir \"VSSetup\") $buildConfiguration\n \n $optProfToolDir = Get-PackageDir \"Roslyn.OptProf.RunSettings.Generator\"\n $optProfToolExe = Join-Path $optProfToolDir \"tools\\roslyn.optprof.runsettings.generator.exe\"\n $configFile = Join-Path $repoDir \"build\\config\\optprof.json\"\n $outputFolder = Join-Path $configDir \"Insertion\\RunSettings\"\n $optProfArgs = \"--configFile $configFile --outputFolder $outputFolder --buildNumber 28315.3001 \"\n \n Exec-Console $optProfToolExe $optProfArgs\n exit 0\n}\ncatch {\n Write-Host $_\n Write-Host $_.Exception\n Write-Host $_.ScriptStackTrace\n exit 1\n}\nfinally {\n Pop-Location\n}" } ]
powershell
chosen
[ { "from": "system", "value": "Handle identity differently in Service User PowerShell script\n" }, { "from": "human", "value": "try {\n $right = Carbon\\Test-Privilege -Identity $($args[0]) -Privilege SeServiceLogonRight\n if (-not $right) {\n Carbon\\Grant-Privilege -Identity $($args[0]) -Privilege SeServiceLogonRight\n echo \"Changed\"\n }\n} catch [System.Exception] {\n throw \"Carbon\\Test-Privilege failed: $url with ${_}\"\n}\n" }, { "from": "gpt", "value": "$identity = $($args[0])\n\ntry {\n $right = Carbon\\Test-Privilege -Identity ${identity} -Privilege SeServiceLogonRight\n if (-not $right) {\n Carbon\\Grant-Privilege -Identity ${identity} -Privilege SeServiceLogonRight\n echo \"Changed\"\n }\n} catch [System.Exception] {\n throw \"Carbon\\Test-Privilege failed: identity=${identity} with ${_}\"\n}\n" } ]
powershell
chosen
[ { "from": "system", "value": "Exit script of either of the dotnet task fails.\n" }, { "from": "human", "value": "if (-not (Test-Path env:APPVEYOR_BUILD_NUMBER)) { $env:APPVEYOR_BUILD_NUMBER = '0' }\n$suffix = \"build.\" + $env:APPVEYOR_BUILD_NUMBER\n$TOOLS_DIR = Join-Path $PSScriptRoot \"tools\"\n$NUGET_EXE = Join-Path $TOOLS_DIR \"nuget.exe\"\n\ndotnet build src\\LibLog.sln -c Release\ndotnet test src\\LibLog.Tests -c Release --no-build\n\nGet-ChildItem ./src/*.pp -Recurse | ForEach-Object { Remove-Item $_ }\n\n$files = (Get-ChildItem -Path ./src/LibLog -Filter *.cs -File) +\n (Get-ChildItem -Path ./src/LibLog/LogProviders -Filter *.cs -File)\n\n$files | ForEach-Object { \n $in = (Get-Content $_.FullName).Replace('YourRootNamespace.', '$rootnamespace$.');\n Set-Content ($_.FullName + \".pp\") -Value '// <auto-generated/>', $in;\n}\n\n& $NUGET_EXE pack src/LibLog/LibLog.nuspec -Suffix $suffix -OutputDirectory artifacts\n" }, { "from": "gpt", "value": "function Run-Task\n{\n param(\n [scriptblock] $block\n )\n\n & $block\n\n if($LASTEXITCODE -ne 0)\n {\n exit $LASTEXITCODE\n }\n}\n\nif (-not (Test-Path env:APPVEYOR_BUILD_NUMBER)) { $env:APPVEYOR_BUILD_NUMBER = '0' }\n$suffix = \"build.\" + $env:APPVEYOR_BUILD_NUMBER\n$TOOLS_DIR = Join-Path $PSScriptRoot \"tools\"\n$NUGET_EXE = Join-Path $TOOLS_DIR \"nuget.exe\"\n\nRun-Task { dotnet build src\\LibLog.sln -c Release }\nRun-Task { dotnet test src\\LibLog.Tests -c Release --no-build }\n\nGet-ChildItem ./src/*.pp -Recurse | ForEach-Object { Remove-Item $_ }\n\n$files = (Get-ChildItem -Path ./src/LibLog -Filter *.cs -File) +\n (Get-ChildItem -Path ./src/LibLog/LogProviders -Filter *.cs -File)\n\n$files | ForEach-Object { \n $in = (Get-Content $_.FullName).Replace('YourRootNamespace.', '$rootnamespace$.');\n Set-Content ($_.FullName + \".pp\") -Value '// <auto-generated/>', $in;\n}\n\n& $NUGET_EXE pack src/LibLog/LibLog.nuspec -Suffix $suffix -OutputDirectory artifacts\n" } ]
powershell
chosen
[ { "from": "system", "value": "Add -v/--version parameter to show current git commit version\n\ncloses #1829" }, { "from": "human", "value": "#requires -v 3\nparam($cmd)\n\nset-strictmode -off\n\n. \"$psscriptroot\\..\\lib\\core.ps1\"\n. (relpath '..\\lib\\commands')\n\nreset_aliases\n\n$commands = commands\n\nif (@($null, '-h', '--help', '/?') -contains $cmd) { exec 'help' $args }\nelseif ($commands -contains $cmd) { exec $cmd $args }\nelse { \"scoop: '$cmd' isn't a scoop command. See 'scoop help'.\"; exit 1 }\n" }, { "from": "gpt", "value": "#requires -v 3\nparam($cmd)\n\nset-strictmode -off\n\n. \"$psscriptroot\\..\\lib\\core.ps1\"\n. \"$psscriptroot\\..\\lib\\git.ps1\"\n. \"$psscriptroot\\..\\lib\\buckets.ps1\"\n. (relpath '..\\lib\\commands')\n\nreset_aliases\n\n$commands = commands\nif (@('-v', '--version') -contains $args) {\n pushd $(versiondir 'scoop' 'current')\n write-host \"Current Scoop version:\"\n git_log --oneline HEAD -n 1\n write-host \"\"\n popd\n\n buckets | % {\n pushd $(bucketdir $_)\n if(test-path '.git') {\n write-host \"'$_' bucket:\"\n git_log --oneline HEAD -n 1\n write-host \"\"\n }\n popd\n }\n}\nelseif (@($null, '-h', '--help', '/?') -contains $cmd) { exec 'help' $args }\nelseif ($commands -contains $cmd) { exec $cmd $args }\nelse { \"scoop: '$cmd' isn't a scoop command. See 'scoop help'.\"; exit 1 }\n" } ]
powershell
chosen
[ { "from": "human", "value": "Add PowerShell completion support for dotnet-suggest\n" }, { "from": "gpt", "value": "if (!(Get-Command -Name dotnet-suggest -ErrorAction Ignore)) {\n Write-Verbose -Message (Get-DotFilesMessage -Message 'Skipping dotnet-suggest settings as unable to locate dotnet-suggest.')\n return\n}\n\nWrite-Verbose -Message (Get-DotFilesMessage -Message 'Loading dotnet-suggest settings ...')\n\n# dotnet-suggest\n# https://github.com/dotnet/command-line-api/wiki/dotnet-suggest\n$env:DOTNET_SUGGEST_SCRIPT_VERSION = '1.0.0'\n\n$RegisteredApps = (dotnet-suggest list | Out-String).Split([Environment]::NewLine, [StringSplitOptions]::RemoveEmptyEntries)\nRegister-ArgumentCompleter -Native -CommandName $RegisteredApps -ScriptBlock {\n Param($wordToComplete, $commandAst, $cursorPosition)\n $CommandPath = (Get-Command -Name $commandAst.CommandElements[0]).Source\n $CommandArgs = $CommandAst.Extent.ToString().Replace('\"', '\\\"')\n dotnet-suggest get -e $CommandPath --position $cursorPosition -- $CommandArgs | ForEach-Object {\n [Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)\n }\n}\n\nRemove-Variable -Name 'RegisteredApps'\n" } ]
powershell
chosen
[ { "from": "system", "value": "Change Write-Exception for Stop-Function and change Write-Verbose for Write-Message to standarize messaging system\n" }, { "from": "human", "value": "#requires -version 3.0\n \nFunction Test-PSRemoting {\n<#\nJeff Hicks\nhttps://www.petri.com/test-network-connectivity-powershell-test-connection-cmdlet\n#>\n [cmdletbinding()]\n \n Param(\n [Parameter(Position=0,Mandatory,HelpMessage = \"Enter a computername\",ValueFromPipeline)]\n [ValidateNotNullorEmpty()]\n [string]$Computername,\n $Credential = [System.Management.Automation.PSCredential]::Empty\n )\n \n Begin {\n Write-Verbose -Message \"Starting $($MyInvocation.Mycommand)\" \n } #begin\n \n Process {\n Write-Verbose -Message \"Testing $computername\"\n Try {\n $r = Test-WSMan -ComputerName $Computername -Credential $Credential -Authentication Default -ErrorAction Stop\n $True \n }\n Catch {\n Write-Verbose $_.Exception.Message\n $False\n \n }\n \n } #Process\n \n End {\n Write-Verbose -Message \"Ending $($MyInvocation.Mycommand)\"\n } #end\n \n} #close function\n" }, { "from": "gpt", "value": "#requires -version 3.0\n \nFunction Test-PSRemoting {\n<#\nJeff Hicks\nhttps://www.petri.com/test-network-connectivity-powershell-test-connection-cmdlet\n#>\n [cmdletbinding()]\n \n Param(\n [Parameter(Position=0,Mandatory,HelpMessage = \"Enter a computername\",ValueFromPipeline)]\n [ValidateNotNullorEmpty()]\n [string]$Computername,\n $Credential = [System.Management.Automation.PSCredential]::Empty\n )\n \n Begin {\n Write-Message -Level Verbose -Message \"Starting $($MyInvocation.Mycommand)\"\n } #begin\n \n Process {\n Write-Message -Level Verbose -Message \"Testing $computername\"\n Try {\n $r = Test-WSMan -ComputerName $Computername -Credential $Credential -Authentication Default -ErrorAction Stop\n $True \n }\n Catch {\n Stop-Function -Message \"Remote testing failed for computer $ComputerName\" -Target $ComputerName -ErrorRecord $_ -Continue\n return $false\n }\n \n } #Process\n \n End {\n Write-Message -Level Verbose -Message \"Ending $($MyInvocation.Mycommand)\"\n } #end\n \n} #close function\n" } ]
powershell
chosen
[ { "from": "system", "value": "Fix up name of file we are pushing!\n" }, { "from": "human", "value": "# Push the package if the version number has changed.\r\n#\r\n[CmdletBinding()]\r\nparam()\r\n\r\n# Get the current package numbers\r\n$pkgName = \"AtlasSSH\"\r\n$current = $(nuget list $pkgName)\r\n$version = $current.Split()[1]\r\nWrite-Verbose \"Nuget has version $version of Package $pkgName\"\r\n\r\n# Get the current contents of the nuspec file\r\n$nuspec = Get-Content .\\AtlasWorkFlows.nuspec | Select-String $version\r\nif ($nuspec.Count -gt 0) {\r\n\tWrite-Verbose \"Version $version is already on the myget server. Will not push.\"\r\n} else {\r\n rm .\\*.nupkg\r\n nuget pack -IncludeReferencedProjects -Prop Configuration=Release .\\AtlasWorkflows.csproj\r\n\tnuget push .\\AtlasWorkFlows.*.nupkg -Source https://www.nuget.org\r\n}\r\n" }, { "from": "gpt", "value": "# Push the package if the version number has changed.\r\n#\r\n[CmdletBinding()]\r\nparam()\r\n\r\n# Get the current package numbers\r\n$pkgName = \"AtlasSSH\"\r\n$current = $(nuget list $pkgName)\r\n$version = $current.Split()[1]\r\nWrite-Verbose \"Nuget has version $version of Package $pkgName\"\r\n\r\n# Get the current contents of the nuspec file\r\n$nuspec = Get-Content .\\AtlasWorkFlows.nuspec | Select-String $version\r\nif ($nuspec.Count -gt 0) {\r\n\tWrite-Verbose \"Version $version is already on the myget server. Will not push.\"\r\n} else {\r\n rm .\\*.nupkg\r\n nuget pack -IncludeReferencedProjects -Prop Configuration=Release .\\AtlasWorkflows.csproj\r\n\tnuget push .\\AtlasSSH.*.nupkg -Source https://www.nuget.org\r\n}\r\n" } ]
powershell
chosen
[ { "from": "system", "value": "Add edit alias for vs code in powershell\n" }, { "from": "human", "value": "chcp 65001 | out-null\n\nfunction prompt {\n '[' + $env:username + '@' + $env:computername + ' ' + $pwd + \"]`r`n$ \"\n}\n\nfunction .. {\n Set-Location ..\n}\nfunction ... {\n Set-Location ..\\..\n}\nfunction .... {\n Set-Location ..\\..\\..\n}\n\nSet-Alias l Get-ChildItem\nSet-Alias ll Get-ChildItem\nSet-Alias open Invoke-Item\n\nif (Test-Path 'C:\\Program Files\\Sublime Text 3') {\n Set-Alias edit 'C:\\Program Files\\Sublime Text 3\\sublime_text'\n}\n\n[net.webrequest]::defaultwebproxy.credentials = [net.credentialcache]::defaultcredentials\n" }, { "from": "gpt", "value": "chcp 65001 | out-null\n\nfunction prompt {\n '[' + $env:username + '@' + $env:computername + ' ' + $pwd + \"]`r`n$ \"\n}\n\nfunction .. {\n Set-Location ..\n}\nfunction ... {\n Set-Location ..\\..\n}\nfunction .... {\n Set-Location ..\\..\\..\n}\n\nSet-Alias l Get-ChildItem\nSet-Alias ll Get-ChildItem\nSet-Alias open Invoke-Item\n\nif (Test-Path 'C:\\Program Files\\Sublime Text 3') {\n Set-Alias edit 'C:\\Program Files\\Sublime Text 3\\sublime_text'\n}\n\nif (Test-Path 'C:\\Program Files (x86)\\Microsoft VS Code') {\n Set-Alias edit 'C:\\Program Files (x86)\\Microsoft VS Code\\code'\n}\n\n[net.webrequest]::defaultwebproxy.credentials = [net.credentialcache]::defaultcredentials\n" } ]
powershell
chosen
[ { "from": "system", "value": "Update runTest to skip Linux test.\n" }, { "from": "human", "value": "# Copyright(c) 2017 Google Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n# use this file except in compliance with the License. You may obtain a copy of\n# the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n# License for the specific language governing permissions and limitations under\n# the License.\n\n# TODO: Resurrect this test when bug 68199801 is fixed.\nImport-Module ..\\..\\..\\BuildTools.psm1 -DisableNameChecking\n\n\nBackupAndEdit-TextFile \"..\\QuickStart\\Program.cs\" `\n @{\"YOUR-PROJECT-ID\" = $env:GOOGLE_PROJECT_ID} `\n{\n dotnet restore\n dotnet build\n dotnet test --no-build --no-restore -v detailed\n}" }, { "from": "gpt", "value": "# Copyright(c) 2017 Google Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n# use this file except in compliance with the License. You may obtain a copy of\n# the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n# License for the specific language governing permissions and limitations under\n# the License.\n\n# TODO: Resurrect this test when bug 68199801 is fixed.\nImport-Module ..\\..\\..\\BuildTools.psm1 -DisableNameChecking\nRequire-Platform Win*\n\nBackupAndEdit-TextFile \"..\\QuickStart\\Program.cs\" `\n @{\"YOUR-PROJECT-ID\" = $env:GOOGLE_PROJECT_ID} `\n{\n dotnet restore\n dotnet build\n dotnet test --no-build --no-restore -v detailed\n}" } ]
powershell
chosen
[ { "from": "system", "value": "Allow setting LUVI_ARCH externally on windows\n" }, { "from": "human", "value": "\n$LUVI_VERSION = \"2.0.9\"\n$LIT_VERSION = \"1.2.14\"\n\n$LUVI_ARCH = \"Windows-amd64\"\n$LUVI_URL = \"https://github.com/luvit/luvi/releases/download/v$LUVI_VERSION/luvi-regular-$LUVI_ARCH.exe\"\n$LIT_URL = \"https://github.com/luvit/lit/archive/$LIT_VERSION.zip\"\n\nfunction Download-File {\nparam (\n [string]$url,\n [string]$file\n )\n Write-Host \"Downloading $url to $file\"\n $downloader = new-object System.Net.WebClient\n $downloader.Proxy.Credentials=[System.Net.CredentialCache]::DefaultNetworkCredentials;\n $downloader.DownloadFile($url, $file)\n}\n\n# Download Files\nDownload-File $LUVI_URL \"luvi.exe\"\nDownload-File $LIT_URL \"lit.zip\"\n\n# Create lit.exe using lit\nStart-Process \"luvi.exe\" -ArgumentList \"lit.zip -- make lit.zip\" -Wait -NoNewWindow\n\n# Cleanup\nRemove-Item \"lit.zip\"\n" }, { "from": "gpt", "value": "\n$LUVI_VERSION = \"2.0.9\"\n$LIT_VERSION = \"1.2.14\"\n\nif (test-path env:LUVI_ARCH) {\n $LUVI_ARCH = $env:LUVI_ARCH\n}\nelse {\n $LUVI_ARCH = \"Windows-amd64\"\n}\n$LUVI_URL = \"https://github.com/luvit/luvi/releases/download/v$LUVI_VERSION/luvi-regular-$LUVI_ARCH.exe\"\n$LIT_URL = \"https://github.com/luvit/lit/archive/$LIT_VERSION.zip\"\n\nfunction Download-File {\nparam (\n [string]$url,\n [string]$file\n )\n Write-Host \"Downloading $url to $file\"\n $downloader = new-object System.Net.WebClient\n $downloader.Proxy.Credentials=[System.Net.CredentialCache]::DefaultNetworkCredentials;\n $downloader.DownloadFile($url, $file)\n}\n\n# Download Files\nDownload-File $LUVI_URL \"luvi.exe\"\nDownload-File $LIT_URL \"lit.zip\"\n\n# Create lit.exe using lit\nStart-Process \"luvi.exe\" -ArgumentList \"lit.zip -- make lit.zip\" -Wait -NoNewWindow\n\n# Cleanup\nRemove-Item \"lit.zip\"\n" } ]
powershell
chosen
[ { "from": "system", "value": "Update to use v2 endpoint" }, { "from": "human", "value": "$apiKey = \"[API_KEY]\"\n$secretKey = \"[SECRET_KEY]\"\n$headers = @{Authorization = 'Token token=\"' + $apiKey + $secretKey + '\"'}\n \n \n#Get the list of nodes in the node group\n$nodeGroupsURI = \"https://[SERVER]/api/v1/node_groups/[NODEGROUPID]/nodes.json\"\n$nodes = Invoke-RestMethod -Method \"GET\" -Uri $nodeGroupsURI -Headers $headers\n \n#Loop over each node in the group and call start scan\nforeach($node in $nodes)\n{\n $url = $node.url + \"/start_scan.json?label=[LABEL_HERE]\"\n Invoke-RestMethod -Method \"POST\" -Uri $url -Headers $headers\n}\n" }, { "from": "gpt", "value": "$apiKey = \"[API_KEY]\"\n$secretKey = \"[SECRET_KEY]\"\n$headers = @{Authorization = 'Token token=\"' + $apiKey + $secretKey + '\"'}\n \n \n#Get the list of nodes in the node group\n$nodeGroupsURI = \"https://[SERVER]/api/v2/node_groups/[NODEGROUPID]/nodes.json\"\n$nodes = Invoke-RestMethod -Method \"GET\" -Uri $nodeGroupsURI -Headers $headers\n \n#Loop over each node in the group and call start scan\nforeach($node in $nodes)\n{\n $url = $node.url + \"/start_scan.json?label=[LABEL_HERE]\"\n Invoke-RestMethod -Method \"POST\" -Uri $url -Headers $headers\n}\n" } ]
powershell
chosen
[ { "from": "system", "value": "Include WebTools in VS install" }, { "from": "human", "value": "$ScriptPath = Split-Path -Parent $MyInvocation.MyCommand.Definition\n\n& \"$ScriptPath\\PowerShellProfile\\Microsoft.PowerShell_profile.ps1\"\n\n## Development Tools for .NET\n\nchoco install VisualStudioCommunity2013\n\nchoco install webpi\nchoco install webpicmd\n\nchoco install IIS-WebServerRole -source windowsfeatures\nchoco install IIS-ASPNET45 -source windowsfeatures\n\nchoco install SQLManagementStudio -source webpi" }, { "from": "gpt", "value": "$ScriptPath = Split-Path -Parent $MyInvocation.MyCommand.Definition\n\n& \"$ScriptPath\\PowerShellProfile\\Microsoft.PowerShell_profile.ps1\"\n\n## Development Tools for .NET\n\nchoco install VisualStudioCommunity2013 -packageParameters \"/Features:WebTools\"\n\nchoco install webpi\nchoco install webpicmd\n\nchoco install IIS-WebServerRole -source windowsfeatures\nchoco install IIS-ASPNET45 -source windowsfeatures\n\nchoco install SQLManagementStudio -source webpi\n" } ]
powershell
chosen
[ { "from": "system", "value": "Move back to devdiv pkgs. Getting 401 on msdata\n" }, { "from": "human", "value": "# DEVOPS_TOKEN is not secret so that it works on other branches. Since Devops pipeline is only accessible from \n# Microsoft, doesn't need to be secret in pipeline\n# See here on how to generate a new token:\n# https://devdiv.visualstudio.com/DevDiv/_packaging?_a=connect&feed=Pylance%40Local\n$str = \"registry=https://registry.npmjs.org/\n@pylance:registry=https://msdata.pkgs.visualstudio.com/_packaging/DSVM_Image/npm/registry/\nalways-auth=true\n; begin auth token\n//msdata.pkgs.visualstudio.com/_packaging/DSVM_Image/npm/registry/:username=msdata\n//msdata.pkgs.visualstudio.com/_packaging/DSVM_Image/npm/registry/:_password=$Env:MAPPED_AZURE_DEVOPS_TOKEN\n//msdata.pkgs.visualstudio.com/_packaging/DSVM_Image/npm/registry/:email=email\n//msdata.pkgs.visualstudio.com/_packaging/DSVM_Image/npm/:username=msdata\n//msdata.pkgs.visualstudio.com/_packaging/DSVM_Image/npm/:_password=$Env:MAPPED_AZURE_DEVOPS_TOKEN\n//msdata.pkgs.visualstudio.com/_packaging/DSVM_Image/npm/:email=email\n; end auth token\n\"\n\nWrite-Host \"Writing .npmrc with token $Env:MAPPED_AZURE_DEVOPS_TOKEN from environment\"\nSet-Content -Path \".npmrc\" -Value $str\nGet-Content -Path \".npmrc\"\n" }, { "from": "gpt", "value": "# DEVOPS_TOKEN is not secret so that it works on other branches. Since Devops pipeline is only accessible from \n# Microsoft, doesn't need to be secret in pipeline\n# See here on how to generate a new token:\n# https://devdiv.visualstudio.com/DevDiv/_packaging?_a=connect&feed=Pylance%40Local\n$str = \"registry=https://devdiv.pkgs.visualstudio.com/_packaging/Pylance%40Local/npm/registry/ \n \nalways-auth=true\n; begin auth token\n//devdiv.pkgs.visualstudio.com/_packaging/Pylance%40Local/npm/registry/:username=devdiv\n//devdiv.pkgs.visualstudio.com/_packaging/Pylance%40Local/npm/registry/:_password=$Env:MAPPED_AZURE_DEVOPS_TOKEN\n//devdiv.pkgs.visualstudio.com/_packaging/Pylance%40Local/npm/registry/:email=npm requires email to be set but doesn't use the value\n//devdiv.pkgs.visualstudio.com/_packaging/Pylance%40Local/npm/:username=devdiv\n//devdiv.pkgs.visualstudio.com/_packaging/Pylance%40Local/npm/:_password=$Env:MAPPED_AZURE_DEVOPS_TOKEN\n//devdiv.pkgs.visualstudio.com/_packaging/Pylance%40Local/npm/:email=npm requires email to be set but doesn't use the value\n; end auth token\n\"\n\nWrite-Host \"Writing .npmrc with token $Env:MAPPED_AZURE_DEVOPS_TOKEN from environment\"\nSet-Content -Path \".npmrc\" -Value $str\nGet-Content -Path \".npmrc\"\n" } ]
powershell
chosen
[ { "from": "system", "value": "Refactor output path. Fix file size debug print.\n" }, { "from": "human", "value": "param([string]$buildFolder)\r\n\r\n$path = \"$($buildFolder)\\src\\WebSite\"\r\n$port = 58537\r\n$delay = 3000\r\n\r\nWrite-Host \"Running IIS Express from '$($path)'.\"\r\nStart-Process \"C:\\Program Files (x86)\\IIS Express\\iisexpress.exe\" -NoNewWindow -ArgumentList \"/path:$($path) /port:$($port)\"\r\n\r\nWrite-Host \"Waiting $($delay).\"\r\nStart-Sleep -Milliseconds $delay\r\n\r\nWrite-Host \"Running StaticSiteCrawler.\"\r\n#Start-Process \"$($buildFolder)\\Tools\\StaticSiteCrawler.cmd\" -Wait\r\n.\\Tools\\StaticSiteCrawler.exe http://localhost:$($port)/ ..\\output /\r\n\r\nWrite-Host \"Content of output:\"\r\n$items = Get-ChildItem -Path ..\\output\r\nForEach ($item in $items) \r\n{ \r\n $size = (Get-Item $item).Length\r\n Write-Host \"$($item) - $($size)\"\r\n}\r\n\r\nWrite-Host \"Stopping IIS Express.\"\r\nStop-Process -Name iisexpress" }, { "from": "gpt", "value": "param([string]$buildFolder)\r\n\r\n$outputPath = \"..\\output\";\r\n$sitePath = \"$($buildFolder)\\src\\WebSite\"\r\n$port = 58537\r\n$delay = 5000\r\n\r\nWrite-Host \"Running IIS Express from '$($sitePath)'.\"\r\nStart-Process \"C:\\Program Files (x86)\\IIS Express\\iisexpress.exe\" -NoNewWindow -ArgumentList \"/path:$($sitePath) /port:$($port)\"\r\n\r\nWrite-Host \"Waiting $($delay).\"\r\nStart-Sleep -Milliseconds $delay\r\n\r\nWrite-Host \"Running StaticSiteCrawler.\"\r\n#Start-Process \"$($buildFolder)\\Tools\\StaticSiteCrawler.cmd\" -Wait\r\n.\\Tools\\StaticSiteCrawler.exe http://localhost:$($port)/ $outputPath /\r\n\r\nWrite-Host \"Content of output:\"\r\n$items = Get-ChildItem -Path $outputPath\r\nForEach ($item in $items) \r\n{ \r\n $size = (Get-Item \"$($outputPath)\\$($item)\").Length\r\n Write-Host \"$($item) - $($size)B\"\r\n}\r\n\r\nWrite-Host \"Stopping IIS Express.\"\r\nStop-Process -Name iisexpress" } ]
powershell
chosen
[ { "from": "system", "value": "test: Enable stream_processor testcase on AppVeyor\n\nSigned-off-by: Hiroshi Hatake <a476a6e5b5893650242fbf0b2961500a9bd9032e@clear-code.com>\n" }, { "from": "human", "value": "cd build\n\n# CACHE GENERATION\ncmake -G \"$ENV:msvc\" -DCMAKE_BUILD_TYPE=\"$ENV:configuration\" `\n -DCIO_BACKEND_FILESYSTEM=Off `\n -DFLB_TESTS_INTERNAL=On `\n -D FLB_WITHOUT_flb-rt-out_elasticsearch=On `\n -D FLB_WITHOUT_flb-rt-out_td=On `\n -D FLB_WITHOUT_flb-rt-out_forward=On `\n -D FLB_WITHOUT_flb-rt-in_disk=On `\n -D FLB_WITHOUT_flb-rt-in_proc=On `\n -D FLB_WITHOUT_flb-it-pipe=On `\n -D FLB_WITHOUT_flb-it-parser=On `\n -D FLB_WITHOUT_flb-it-unit_sizes=On `\n -D FLB_WITHOUT_flb-it-http_client=On `\n -D FLB_WITHOUT_flb-it-network=On `\n -D FLB_WITHOUT_flb-it-pack=On `\n -D FLB_WITHOUT_flb-it-stream_processor=On `\n ../\n\n# COMPILE\ncmake --build . --config \"$ENV:configuration\"\n\n# RUNNING TESTS\nctest -C \"$ENV:configuration\" --build-run-dir $PWD --output-on-failure\n" }, { "from": "gpt", "value": "cd build\n\n# CACHE GENERATION\ncmake -G \"$ENV:msvc\" -DCMAKE_BUILD_TYPE=\"$ENV:configuration\" `\n -DCIO_BACKEND_FILESYSTEM=Off `\n -DFLB_TESTS_INTERNAL=On `\n -D FLB_WITHOUT_flb-rt-out_elasticsearch=On `\n -D FLB_WITHOUT_flb-rt-out_td=On `\n -D FLB_WITHOUT_flb-rt-out_forward=On `\n -D FLB_WITHOUT_flb-rt-in_disk=On `\n -D FLB_WITHOUT_flb-rt-in_proc=On `\n -D FLB_WITHOUT_flb-it-pipe=On `\n -D FLB_WITHOUT_flb-it-parser=On `\n -D FLB_WITHOUT_flb-it-unit_sizes=On `\n -D FLB_WITHOUT_flb-it-http_client=On `\n -D FLB_WITHOUT_flb-it-network=On `\n -D FLB_WITHOUT_flb-it-pack=On `\n ../\n\n# COMPILE\ncmake --build . --config \"$ENV:configuration\"\n\n# RUNNING TESTS\nctest -C \"$ENV:configuration\" --build-run-dir $PWD --output-on-failure\n" } ]
powershell
chosen
[ { "from": "system", "value": "Set the PYTHONPATH on Windows\n\nSummary: A previous change broke building Buck on Windows due to a python import.\n\nTest Plan: `./bin/buck build buck`\n\nReviewed By: @bhamiltoncx\n\nfb-gh-sync-id: d1fa8d9\n" }, { "from": "human", "value": "# Invoke the buck wrappers scripts with Python.\npython (Join-Path (Join-Path (Split-Path (Split-Path $PSCommandPath)) programs) buck.py) $args\n" }, { "from": "gpt", "value": "# Invoke the buck wrappers scripts with Python.\n$env:PYTHONPATH=(Join-Path (Join-Path (Split-Path (Split-Path $PSCommandPath)) third-party) nailgun)\npython (Join-Path (Join-Path (Split-Path (Split-Path $PSCommandPath)) programs) buck.py) $args\n" } ]
powershell
chosen
[ { "from": "system", "value": "Fix specifying dotnet pack version using tag\n" }, { "from": "human", "value": "param (\n\t[string]$BuildVersionNumber=$(throw \"-BuildVersionNumber is required.\"),\n\t[string]$TagVersionNumber\n)\n\n& dotnet restore .\\src\\SemVer\\SemVer.csproj #2>1\n\nif ($TagVersionNumber) {\n & dotnet pack .\\src\\SemVer\\SemVer.csproj -c Release /p:VersionPrefix=\"$BuildVersionNumber\" /p:VersionSuffix=\"$TagVersionNumber\" 2>&1\n} else {\n & dotnet pack .\\src\\SemVer\\SemVer.csproj -c Release /p:VersionPrefix=\"$BuildVersionNumber\" 2>&1\n}\n" }, { "from": "gpt", "value": "param (\n\t[string]$BuildVersionNumber=$(throw \"-BuildVersionNumber is required.\"),\n\t[string]$TagVersionNumber\n)\n\n& dotnet restore .\\src\\SemVer\\SemVer.csproj #2>1\n\nif ($TagVersionNumber) {\n & dotnet pack .\\src\\SemVer\\SemVer.csproj -c Release /p:VersionPrefix=\"$TagVersionNumber\" 2>&1\n} else {\n & dotnet pack .\\src\\SemVer\\SemVer.csproj -c Release /p:VersionPrefix=\"$BuildVersionNumber\" 2>&1\n}\n" } ]
powershell
chosen
[ { "from": "system", "value": "Fix path for nightly docker binaries\n" }, { "from": "human", "value": "stop-service docker\nwget -outfile C:\\Windows\\System32\\dockerd.exe -uri https://master.dockerproject.org/windows/amd64/dockerd.exe\nwget -outfile C:\\Windows\\System32\\docker.exe -uri https://master.dockerproject.org/windows/amd64/docker.exe\nstart-service docker\n" }, { "from": "gpt", "value": "stop-service docker\nwget -outfile $env:ProgramFiles\\docker\\dockerd.exe -uri https://master.dockerproject.org/windows/amd64/dockerd.exe\nwget -outfile $env:ProgramFiles\\docker\\docker.exe -uri https://master.dockerproject.org/windows/amd64/docker.exe\nstart-service docker\n" } ]
powershell
chosen
[ { "from": "system", "value": "Allow ctrl+d in powershell sessions\n" }, { "from": "human", "value": "chcp 65001 | out-null\n\nfunction prompt {\n '[' + $env:username + '@' + $env:computername + ' ' + $pwd + \"]`r`n$ \"\n}\n\nfunction .. {\n Set-Location ..\n}\nfunction ... {\n Set-Location ..\\..\n}\nfunction .... {\n Set-Location ..\\..\\..\n}\n\nSet-Alias l Get-ChildItem\nSet-Alias ll Get-ChildItem\nSet-Alias open Invoke-Item\n\nif (Get-Command \"code\" -ErrorAction SilentlyContinue) {\n function edit {\n Start-Process code -WindowStyle Minimized $args\n }\n} elseif (Get-Command \"atom\" -ErrorAction SilentlyContinue) {\n Set-Alias edit atom\n} elseif (Test-Path 'C:\\Program Files\\Sublime Text 3') {\n Set-Alias edit 'C:\\Program Files\\Sublime Text 3\\sublime_text'\n}\n\n[net.webrequest]::defaultwebproxy.credentials = [net.credentialcache]::defaultcredentials\n\nif (Get-Command Import-Module -ErrorAction SilentlyContinue) {\n Import-Module PSReadLine\n\n $ChocolateyProfile = \"$env:ChocolateyInstall\\helpers\\chocolateyProfile.psm1\"\n if (Test-Path($ChocolateyProfile)) {\n Import-Module \"$ChocolateyProfile\"\n }\n\n}\n" }, { "from": "gpt", "value": "chcp 65001 | out-null\n\nfunction prompt {\n '[' + $env:username + '@' + $env:computername + ' ' + $pwd + \"]`r`n$ \"\n}\n\nfunction .. {\n Set-Location ..\n}\nfunction ... {\n Set-Location ..\\..\n}\nfunction .... {\n Set-Location ..\\..\\..\n}\n\nSet-Alias l Get-ChildItem\nSet-Alias ll Get-ChildItem\nSet-Alias open Invoke-Item\n\nif (Get-Command \"code\" -ErrorAction SilentlyContinue) {\n function edit {\n Start-Process code -WindowStyle Minimized $args\n }\n} elseif (Get-Command \"atom\" -ErrorAction SilentlyContinue) {\n Set-Alias edit atom\n} elseif (Test-Path 'C:\\Program Files\\Sublime Text 3') {\n Set-Alias edit 'C:\\Program Files\\Sublime Text 3\\sublime_text'\n}\n\n[net.webrequest]::defaultwebproxy.credentials = [net.credentialcache]::defaultcredentials\n\nif (Get-Command Import-Module -ErrorAction SilentlyContinue) {\n Import-Module PSReadLine\n\n Set-PSReadlineKeyHandler -Key Ctrl+d -Function DeleteCharOrExit\n\n $ChocolateyProfile = \"$env:ChocolateyInstall\\helpers\\chocolateyProfile.psm1\"\n if (Test-Path($ChocolateyProfile)) {\n Import-Module \"$ChocolateyProfile\"\n }\n\n}\n" } ]
powershell
chosen
[ { "from": "human", "value": "Add script for manually create release\n" }, { "from": "gpt", "value": "Set-StrictMode -Version Latest\n$ErrorActionPreference = 'Stop'\n#------------------------------\n\nImport-Module '.\\setup.ps1' -Args (,('msbuild', 'nunit'))\n\nif (Test-Path $releaseDir)\n{\n Remove-Item $releaseDir -Force -Recurse\n}\n\nNew-Item -ItemType directory -Path $releaseDir | Out-Null\n\nWrite-Output \"Update CHANGELOG.md\"\nWrite-Output \"Update version in Assemblies\"\n\nPause\n\n# Build\nInvoke-MSBuild $solution $msbuildProperties -Verbose\n\n# Test\nStart-Process $driverMerged -RedirectStandardError $errorLog -RedirectStandardOutput $outputLog\nInvoke-NUnit $testFiles -Verbose\n& taskkill ('/im', 'Winium.Desktop.Driver.exe', '/f')\n\n# Pack driver\nAdd-Type -assembly \"system.io.compression.filesystem\"\n$driverMergedPath = Split-Path $driverMerged\n[IO.Compression.ZipFile]::CreateFromDirectory($driverMergedPath, \"$releaseDir/Winium.Desktop.Driver.zip\")\n\nWrite-Output \"Add and push tag using git tag -a -m 'Version *.*.*' v*.*.*\"\nWrite-Output \"Upload and attach $releaseDir\\* files to release\"\n" } ]
powershell
chosen
[ { "from": "system", "value": "Update build to use dotnet instead of msbuild--for whatever reason, a nuget restore is not happening with the build of the swigged.llvm project.\n" }, { "from": "human", "value": "#\n# Build script for Windows native and Net Standard libraries of Swigged.LLVM.\n# Invokes a Cmd.exe shell script and updates the environment.\n\nfunction Invoke-CmdScript {\n param(\n [String] $scriptName\n )\n $cmdLine = \"\"\"$scriptName\"\" $args & set\"\n & $Env:SystemRoot\\system32\\cmd.exe /c $cmdLine |\n select-string '^([^=]*)=(.*)$' | foreach-object {\n $varName = $_.Matches[0].Groups[1].Value\n $varValue = $_.Matches[0].Groups[2].Value\n set-item Env:$varName $varValue\n }\n}\n\nGet-Date\n$ErrorActionPreference = \"Stop\"\nInvoke-CmdScript \"C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Auxiliary\\Build\\vcvarsall.bat\" x64\nmsbuild swigged-llvm\\swigged.llvm.sln /p:Configuration=Release /p:Platform=\"Any CPU\"\nGet-Date\ncd swigged-llvm\\swigged.llvm.native\n.\\build.ps1\nGet-Date\n" }, { "from": "gpt", "value": "#\n# Build script for Windows native and Net Standard libraries of Swigged.LLVM.\n# Invokes a Cmd.exe shell script and updates the environment.\n\nfunction Invoke-CmdScript {\n param(\n [String] $scriptName\n )\n $cmdLine = \"\"\"$scriptName\"\" $args & set\"\n & $Env:SystemRoot\\system32\\cmd.exe /c $cmdLine |\n select-string '^([^=]*)=(.*)$' | foreach-object {\n $varName = $_.Matches[0].Groups[1].Value\n $varValue = $_.Matches[0].Groups[2].Value\n set-item Env:$varName $varValue\n }\n}\n\nGet-Date\n$ErrorActionPreference = \"Stop\"\nInvoke-CmdScript \"C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Auxiliary\\Build\\vcvarsall.bat\" x64\ncd swigged-llvm\ndotnet restore\ndotnet build\n# msbuild swigged-llvm\\swigged.llvm.sln /p:Configuration=Release /p:Platform=\"Any CPU\"\nGet-Date\ncd swigged.llvm.native\n.\\build.ps1\nGet-Date\n" } ]
powershell
chosen
[ { "from": "system", "value": "Include classname in test name\n" }, { "from": "human", "value": "write-host \"Present working directory: $($pwd)\"\n\n$testsuites = [xml](get-content .\\test-results\\*.xml)\n$anyFailures = $FALSE\n\nforeach ($testsuite in $testsuites.testsuite) {\n\n write-host \" $($testsuite.name)\"\n\n foreach ($testcase in $testsuite.testcase){\n $failed = $testcase.failure\n $time = [decimal]$testsuite.time * 1000 # from seconds to milliseconds\n\n if ($failed) {\n write-host \"Failed $($testcase.name) $($testcase.failure.message)\"\n Add-AppveyorTest $testcase.name -Outcome Failed -FileName $testsuite.name -ErrorMessage $testcase.failure.message -Duration $time\n $anyFailures = $TRUE\n }\n else {\n write-host \"Passed $($testcase.name)\"\n Add-AppveyorTest $testcase.name -Outcome Passed -FileName $testsuite.name -Duration $time\n }\n }\n}\n\nif ($anyFailures -eq $TRUE){\n write-host \"Failing build as there are broken tests\"\n $host.SetShouldExit(1)\n}\n" }, { "from": "gpt", "value": "write-host \"Present working directory: $($pwd)\"\n\n$testsuites = [xml](get-content .\\test-results\\*.xml)\n$anyFailures = $FALSE\n\nforeach ($testsuite in $testsuites.testsuite) {\n\n write-host \" $($testsuite.name)\"\n\n foreach ($testcase in $testsuite.testcase){\n $failed = $testcase.failure\n $time = [decimal]$testsuite.time * 1000 # from seconds to milliseconds\n $testName = \"$($testcase.classname) $($testcase.name)\"\n\n if ($failed) {\n write-host \"Failed $($testcase.name) $($testcase.failure.message)\"\n Add-AppveyorTest $testcase.name -Outcome Failed -FileName $testsuite.name -ErrorMessage $testcase.failure.message -Duration $time\n $anyFailures = $TRUE\n }\n else {\n write-host \"Passed $($testcase.name)\"\n Add-AppveyorTest $testcase.name -Outcome Passed -FileName $testsuite.name -Duration $time\n }\n }\n}\n\nif ($anyFailures -eq $TRUE){\n write-host \"Failing build as there are broken tests\"\n $host.SetShouldExit(1)\n}\n" } ]
powershell
chosen
[ { "from": "system", "value": "Stop Docker Engine and remvoe key.json to recreate on first Vagrant up\n" }, { "from": "human", "value": "Write-Host \"WARNING: DO NOT USE DOCKER IN PRODUCTION WITHOUT TLS\"\nWrite-Host \"Enabling Docker unsecure port 2375\"\n\nif (!(Get-NetFirewallRule | where {$_.Name -eq \"DockerUnsecure2375\"})) {\n New-NetFirewallRule -Name \"DockerUnsecure2375\" -DisplayName \"Docker unsecure on TCP/2375\" -Protocol tcp -LocalPort 2375 -Action Allow -Enabled True\n}\n\nWrite-Host \"Enabling Docker to listen on unsecure port 2375\"\ncp C:\\programdata\\docker\\runDockerDaemon.cmd C:\\programdata\\docker\\runDockerDaemon.cmd.bak\ncat C:\\programdata\\docker\\runDockerDaemon.cmd.bak | %{$_ -replace '^docker daemon -D -b \"Virtual Switch\"$','docker daemon -D -b \"Virtual Switch\" -H 0.0.0.0:2375'} | Set-Content C:\\programdata\\docker\\runDockerDaemon.cmd\n\nWrite-Host \"Restarting Docker\"\nStop-Service docker\nStart-Service docker\n" }, { "from": "gpt", "value": "Write-Host \"WARNING: DO NOT USE DOCKER IN PRODUCTION WITHOUT TLS\"\nWrite-Host \"Enabling Docker unsecure port 2375\"\n\nif (!(Get-NetFirewallRule | where {$_.Name -eq \"DockerUnsecure2375\"})) {\n New-NetFirewallRule -Name \"DockerUnsecure2375\" -DisplayName \"Docker unsecure on TCP/2375\" -Protocol tcp -LocalPort 2375 -Action Allow -Enabled True\n}\n\nWrite-Host \"Enabling Docker to listen on unsecure port 2375\"\ncp C:\\ProgramData\\docker\\runDockerDaemon.cmd C:\\ProgramData\\docker\\runDockerDaemon.cmd.bak\ncat C:\\ProgramData\\docker\\runDockerDaemon.cmd.bak | %{$_ -replace '^docker daemon -D -b \"Virtual Switch\"$','docker daemon -D -b \"Virtual Switch\" -H 0.0.0.0:2375'} | Set-Content C:\\ProgramData\\docker\\runDockerDaemon.cmd\n\nWrite-Host \"Stopping Docker\"\nStop-Service docker\n\n# Do not restart Docker as it creates the key.json with an unique ID\n# This should not exist in the Vagrant basebox so you can spin up\n# multiple Vagrant boxes for a Docker swarm etc.\n\nWrite-Host \"Removing key.json to recreate key.json on first vagrant up\"\nrm C:\\ProgramData\\docker\\config\\key.json\n" } ]
powershell
chosen
[ { "from": "system", "value": "Fix for the updated xunit version\n" }, { "from": "human", "value": "# Create Coverage folder if not exists\r\nNew-Item -ItemType Directory -Force -Path TestAndCoverage\r\n\r\n# Clear the Coverage folder\r\nRemove-Item TestAndCoverage\\* -recurse\r\n\r\n# Define the BuildConfiguration\r\nNew-Variable -Name BuildConfiguration -Value ($env:BuildConfiguration)\r\nif ([string]::IsNullOrEmpty($BuildConfiguration))\r\n{\r\n\t\tSet-Variable -Name BuildConfiguration -Value \"Debug\"\r\n}\r\n\r\n# Run Unit Tests and Coverage\r\n.\\packages\\OpenCover.4.6.519\\tools\\OpenCover.Console.exe -register:user -output:TestAndCoverage\\coverage.xml -target:\"packages\\xunit.runner.console.2.2.0\\tools\\xunit.console.x86.exe\" -targetargs:\"tests\\DocFunctions.Lib.Unit\\bin\\$BuildConfiguration\\DocFunctions.Lib.Unit.dll -noshadow -xml TestAndCoverage\\UnitTestResults.xml\" -filter:\"+[DocFunctions.Lib*]* -[DocFunctions.Lib.Unit]*\" -hideskipped:Attribute\r\n\r\n# Convert Coverage Report to Cobertura format\r\n.\\packages\\OpenCoverToCoberturaConverter.0.2.6.0\\tools\\OpenCoverToCoberturaConverter.exe -input:TestAndCoverage\\coverage.xml -output:TestAndCoverage\\cobertura.xml\r\n\r\n# Generate Coverage Report\r\n.\\packages\\ReportGenerator.2.5.7\\tools\\ReportGenerator.exe TestAndCoverage\\coverage.xml TestAndCoverage\\coverage" }, { "from": "gpt", "value": "# Create Coverage folder if not exists\r\nNew-Item -ItemType Directory -Force -Path TestAndCoverage\r\n\r\n# Clear the Coverage folder\r\nRemove-Item TestAndCoverage\\* -recurse\r\n\r\n# Define the BuildConfiguration\r\nNew-Variable -Name BuildConfiguration -Value ($env:BuildConfiguration)\r\nif ([string]::IsNullOrEmpty($BuildConfiguration))\r\n{\r\n\t\tSet-Variable -Name BuildConfiguration -Value \"Debug\"\r\n}\r\n\r\n# Run Unit Tests and Coverage\r\n.\\packages\\OpenCover.4.6.519\\tools\\OpenCover.Console.exe -register:user -output:TestAndCoverage\\coverage.xml -target:\"packages\\xunit.runner.console.2.3.1\\tools\\net452\\xunit.console.x86.exe\" -targetargs:\"tests\\DocFunctions.Lib.Unit\\bin\\$BuildConfiguration\\DocFunctions.Lib.Unit.dll -noshadow -xml TestAndCoverage\\UnitTestResults.xml\" -filter:\"+[DocFunctions.Lib*]* -[DocFunctions.Lib.Unit]*\" -hideskipped:Attribute\r\n\r\n# Convert Coverage Report to Cobertura format\r\n.\\packages\\OpenCoverToCoberturaConverter.0.2.6.0\\tools\\OpenCoverToCoberturaConverter.exe -input:TestAndCoverage\\coverage.xml -output:TestAndCoverage\\cobertura.xml\r\n\r\n# Generate Coverage Report\r\n.\\packages\\ReportGenerator.2.5.7\\tools\\ReportGenerator.exe TestAndCoverage\\coverage.xml TestAndCoverage\\coverage" } ]
powershell
chosen
[ { "from": "system", "value": "Add output to show the progress of the export powershell script\n" }, { "from": "human", "value": "$docsFolderName = \"..\\docs\";\n$angularOutputFolderName = \"dist\";\n\nIf (Test-Path $docsFolderName) {\n Remove-Item $docsFolderName -Recurse;\n}\n\nng build --prod --base-href \"https://bigeggtools.github.io/PowerMode/\";\n\nCopy-Item $angularOutputFolderName -Destination $docsFolderName -Recurse;\n" }, { "from": "gpt", "value": "$docsFolderName = \"..\\docs\";\n$angularOutputFolderName = \"dist\";\n\nIf (Test-Path $docsFolderName) {\n Write-Output \"Cleanup the GitHub pages folder.\";\n Remove-Item $docsFolderName -Recurse;\n}\n\nWrite-Output \"Start build the Angular SAP.\";\nng build --prod --base-href \"https://bigeggtools.github.io/PowerMode/\";\n\nWrite-Output \"Copy the Angular SAP to GitHub pages folder.\";\nCopy-Item $angularOutputFolderName -Destination $docsFolderName -Recurse;\n\nWrite-Output \"Done.\";\n" } ]
powershell
chosen
[ { "from": "system", "value": "Fix Dropbox Documents Library Link\n" }, { "from": "human", "value": "param(\n[string]$a\n)\n<# \n.\\go.ps1 \"Text Comment for Commit\"\n#>\nif (!$a)\n{ \n\t$a = Read-Host 'comment: or (<cr> for generic comment)'\n}\nif (!$a)\n{\n\t$a = Get-Date\n\t$a = $a + \" page updated.\"\n}\ngit add -A\ngit commit -m $a\ngit push\necho \"Copying webpage to Dropbox\"\ncopy \"$env:USERPROFILE\\Documents\\github\\webpage\\index.html\" \"$env:USERPROFILE\\Documents\\My Dropbox\\ftp sync\\index.html\"" }, { "from": "gpt", "value": "param(\n[string]$a\n)\n<# \n.\\go.ps1 \"Text Comment for Commit\"\n\n\tMake sure to have a \"My Dropbox\" link in the Documents Library\n#>\nif (!$a)\n{ \n\t$a = Read-Host 'comment: or (<cr> for generic comment)'\n}\nif (!$a)\n{\n\t$a = Get-Date\n\t$a = $a + \" page updated.\"\n}\ngit add -A\ngit commit -m $a\ngit push\necho \"Copying webpage to Dropbox\"\ncopy \"$env:USERPROFILE\\Documents\\github\\webpage\\index.html\" \"$env:USERPROFILE\\Documents\\My Dropbox\\ftp sync\\index.html\"" } ]
powershell
chosen
[ { "from": "system", "value": "Change to release build for unit tests.\n" }, { "from": "human", "value": "$testProjectLocations = @('test/UnitTests')\n$outputLocation = 'testResults'\n$dotnetTestArgs = '-c DebugCI'\niex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/StephenCleary/BuildTools/599beba35b53f495d4df6e5c323573aa839137a3/Coverage.ps1'))\n" }, { "from": "gpt", "value": "$testProjectLocations = @('test/UnitTests')\n$outputLocation = 'testResults'\n$dotnetTestArgs = '-c Release'\niex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/StephenCleary/BuildTools/599beba35b53f495d4df6e5c323573aa839137a3/Coverage.ps1'))\n" } ]
powershell
chosen
[ { "from": "system", "value": "Check the Azure Powershell version installed\n" }, { "from": "human", "value": "############################\n##\n## Helper functions\n##\n############################\nfunction Load-Module\n{\n Param (\n $ModuleName,\n $ModuleLocation\n )\n if (Get-Module -Name $ModuleName -Verbose:$False -EA Stop)\n {\n Remove-Module -Name $ModuleName -Verbose:$False -EA Stop\n }\n $QualifiedModuleName = $ModuleLocation + \"\\\" + $ModuleName\n $Ignore = Import-Module -Name $QualifiedModuleName -PassThru -Verbose:$False -EA Stop\n}\n\n##\n# script initialization\n##\nLoad-Module -ModuleName AzureUtilities -ModuleLocation .\\Modules" }, { "from": "gpt", "value": "############################\n##\n## Helper functions\n##\n############################\nfunction Load-Module\n{\n Param (\n $ModuleName,\n $ModuleLocation\n )\n if (Get-Module -Name $ModuleName -Verbose:$False -EA Stop)\n {\n Remove-Module -Name $ModuleName -Verbose:$False -EA Stop\n }\n $QualifiedModuleName = $ModuleLocation + \"\\\" + $ModuleName\n $Ignore = Import-Module -Name $QualifiedModuleName -PassThru -Verbose:$False -EA Stop\n}\n\nfunction Check-Azure-Version\n{\n Param ([version]$requiredVersion)\n\n if (-Not (Get-Module -ListAvailable -Name Azure)) {\n Throw \"Azure Powershell SDK is not installed.\" \n }\n\n if (-Not (Get-Module Azure)) {\n Import-Module Azure\n }\n\n $version = (Get-Module Azure).Version\n Write-Host \"Azure Powershell SDK Version $($version) is installed.\"\n\n if ($version -lt $requiredVersion) {\n Throw \"This script requires at least version $($requiredVersion) of the Azure Powershell SDK.\"\n }\n}\n\n##\n# script initialization\n##\nCheck-Azure-Version \"0.9.3\"\n\nLoad-Module -ModuleName AzureUtilities -ModuleLocation .\\Modules\n" } ]
powershell
chosen
[ { "from": "system", "value": "Split autocomplete options by newline and enclose multiword options in quotes\n\nThat is how PowerShell composes arguments - if it is enclosed in quotes it is treated as a single one\n" }, { "from": "human", "value": "$Completion_clc = {\n \n param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter)\n\n (invoke-expression \"$parameterName --generate-bash-completion\").Split(\" \") |\n ForEach-Object {\n New-Object System.Management.Automation.CompletionResult $_, $_, 'ParameterValue', ('{0} ({1})' -f $_, $_)\n }\n}\n\n# Register the handler.\nif (-not $global:options) {\n $global:options = @{CustomArgumentCompleters = @{};NativeArgumentCompleters = @{}}\n}\n$global:options['NativeArgumentCompleters']['clc.exe'] = $Completion_clc\n\n# Override tabexpansion2. \n$function:tabexpansion2 = $function:tabexpansion2 -replace\n 'End\\r\\n{',\n 'End { if ($null -ne $options) { $options += $global:options} else {$options = $global:options}'\n" }, { "from": "gpt", "value": "$Completion_clc = {\n \n param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter)\n\n (invoke-expression \"$parameterName --generate-bash-completion\").Split(\"`n\") |\n ForEach-Object {\n if ($_ -like '* *') {\n \"'$_'\"\n } else {\n $_\n }\n } |\n ForEach-Object {\n New-Object System.Management.Automation.CompletionResult $_, $_, 'ParameterValue', ('{0} ({1})' -f $_, $_)\n }\n}\n\n# Register the handler.\nif (-not $global:options) {\n $global:options = @{CustomArgumentCompleters = @{};NativeArgumentCompleters = @{}}\n}\n$global:options['NativeArgumentCompleters']['clc.exe'] = $Completion_clc\n\n# Override tabexpansion2. \n$function:tabexpansion2 = $function:tabexpansion2 -replace\n 'End\\r\\n{',\n 'End { if ($null -ne $options) { $options += $global:options} else {$options = $global:options}'\n" } ]
powershell
chosen
[ { "from": "system", "value": "Fix typo in windows test script\n" }, { "from": "human", "value": "npm install\n\n$ErrorFound = $False\n\ntry\n{\n\tIf ($args.Length -eq 0)\n\t{\n\t\tnpm run start-neo4j\n\t}\n\telse\n\t{\n\t\t$env.NEORUN_START_ARGS=\"$args\"\n\t\tnpm run start-neo4j\n\t}\n\n\tnpm test\n\tif(-Not ($?)) #failed to execute npm test\n\t{\n\t\t$ErrorFound = $True\n\t}\n}\nfinally\n{\n\tnpm run stop-neo4j\n\tif($ErrorFound -eq $True)\n\t{\n\t\tWrite-Host \"Exit with code 1\"\n\t\texit 1\n\t}\n\tWrite-Host \"Exit with code 0\"\n}\n" }, { "from": "gpt", "value": "npm install\n\n$ErrorFound = $False\n\ntry\n{\n\tIf ($args.Length -eq 0)\n\t{\n\t\tnpm run start-neo4j\n\t}\n\telse\n\t{\n\t\t$env:NEORUN_START_ARGS=\"$args\"\n\t\tnpm run start-neo4j\n\t}\n\n\tnpm test\n\tif(-Not ($?)) #failed to execute npm test\n\t{\n\t\t$ErrorFound = $True\n\t}\n}\nfinally\n{\n\tnpm run stop-neo4j\n\tif($ErrorFound -eq $True)\n\t{\n\t\tWrite-Host \"Exit with code 1\"\n\t\texit 1\n\t}\n\tWrite-Host \"Exit with code 0\"\n}\n" } ]
powershell
chosen
[ { "from": "system", "value": "Update description of script [ci skip]\n" }, { "from": "human", "value": "#!/usr/bin/env pwsh\n\n<#\n.SYNOPSIS\n Tags each repo according to VersionPrefix in version.props of that repo\n.PARAMETER Shipping\n Only list repos that are shipping\n#>\n[cmdletbinding(SupportsShouldProcess = $true)]\nparam(\n [switch]$Shipping = $false\n)\n\nSet-StrictMode -Version 2\n$ErrorActionPreference = 'Stop'\n\nImport-Module -Scope Local -Force \"$PSScriptRoot/common.psm1\"\n\nAssert-Git\n\n$RepoRoot = Resolve-Path \"$PSScriptRoot/../\"\n\nGet-Submodules $RepoRoot -Shipping:$Shipping | Format-Table -Property 'module','versionPrefix'\n" }, { "from": "gpt", "value": "#!/usr/bin/env pwsh\n\n<#\n.SYNOPSIS\n Lists the version of all submodules and this repo\n.PARAMETER Shipping\n Only list repos that are shipping\n#>\n[cmdletbinding(SupportsShouldProcess = $true)]\nparam(\n [switch]$Shipping = $false\n)\n\nSet-StrictMode -Version 2\n$ErrorActionPreference = 'Stop'\n\nImport-Module -Scope Local -Force \"$PSScriptRoot/common.psm1\"\n\nAssert-Git\n\n$RepoRoot = Resolve-Path \"$PSScriptRoot/../\"\n\nGet-Submodules $RepoRoot -Shipping:$Shipping | Format-Table -Property 'module','versionPrefix'\n" } ]
powershell
chosen
[ { "from": "human", "value": "Add travis build trigger scripts. (ps and bash)\n" }, { "from": "gpt", "value": "param(\n [Parameter(Mandatory=$true)][string]$VERSION\n)\n\n$BRANCH=\"rpm_from_release\"\n\n$TRAVIS_REQUEST_BODY = @{\n request = @{\n message = \"Build insight-agent rpm package v$VERSION\"\n branch = \"$BRANCH\"\n config = @{\n branches = @{\n only = \"$BRANCH\"\n }\n install = \"export PALETTE_AGENT_VERSION=$VERSION\"\n }\n }\n}\n$TRAVIS_REQUEST_BODY_JSON = (ConvertTo-Json -Compress -Depth 10 $TRAVIS_REQUEST_BODY)\n\n$TRAVIS_REQUEST_URI = \"https://api.travis-ci.com/repo/palette-software%2FPaletteInsightAgent/requests\"\n\n$TRAVIS_REQUEST_HEADER = @{\n \"Content-Type\" = \"application/json\"\n \"Accept\" = \"application/json\"\n \"Travis-API-Version\" = \"3\"\n \"Authorization\" = \"token SUHCsC2vxM_BeE_SCV77hw\"\n}\n\nInvoke-RestMethod -Method Post -Uri $TRAVIS_REQUEST_URI -Body $TRAVIS_REQUEST_BODY_JSON -Header $TRAVIS_REQUEST_HEADER\n" } ]
powershell
chosen
[ { "from": "system", "value": "Fix typo in the deploy script.\n" }, { "from": "human", "value": "param(\r\n\t[switch] $X64\r\n)\r\n\r\n$deployPath = 'Deploy'\r\n\r\nif (Test-Path $deployPath) {\r\n Remove-Item -Recurse $deployPath\r\n}\r\n\r\nmkdir $deployPath\r\nmkdir $deployPath\\Plugins\r\nmkdir $deployPath\\Plugins\\Hell\r\n\r\n# Hell Adapter\r\n$adapterPath = if ($X64) { 'Debug' } else { 'x64\\Debug' }\r\nCopy-Item $adapterPath\\HellAdapter.dll $deployPath\\Plugins\r\nCopy-Item $adapterPath\\HellAdapter.pdb $deployPath\\Plugins\r\n\r\n# Hell API\r\n$bin = if ($X64) { 'x86' } else { 'x64' }\r\nCopy-Item HellAPI\\bin\\$bin\\Debug\\* $deployPath\r\n\r\n# Hell Manager\r\nCopy-Item HellManager\\bin\\$bin\\Debug\\* $deployPath\\Plugins\\Hell" }, { "from": "gpt", "value": "param(\r\n\t[switch] $X64\r\n)\r\n\r\n$deployPath = 'Deploy'\r\n\r\nif (Test-Path $deployPath) {\r\n Remove-Item -Recurse $deployPath\r\n}\r\n\r\nmkdir $deployPath\r\nmkdir $deployPath\\Plugins\r\nmkdir $deployPath\\Plugins\\Hell\r\n\r\n# Hell Adapter\r\n$adapterPath = if ($X64) { 'x64\\Debug' } else { 'Debug' }\r\nCopy-Item $adapterPath\\HellAdapter.dll $deployPath\\Plugins\r\nCopy-Item $adapterPath\\HellAdapter.pdb $deployPath\\Plugins\r\n\r\n# Hell API\r\n$bin = if ($X64) { 'x86' } else { 'x64' }\r\nCopy-Item HellAPI\\bin\\$bin\\Debug\\* $deployPath\r\n\r\n# Hell Manager\r\nCopy-Item HellManager\\bin\\$bin\\Debug\\* $deployPath\\Plugins\\Hell" } ]
powershell
chosen
[ { "from": "system", "value": "Comment about version for Resharper" }, { "from": "human", "value": "# Dev apps to install\n\n# Visual studio stuff\ncinstm VisualStudio2013Ultimate\ncinstm VisualStudio2012Ultimate\n\n# Visual studio add-ins\ncinstm xUnit.vs2012\ncinstm WebEssentials2012\ncinstm resharper -Version 7.1.3000.2254\ncinstm typescript\ncinstm typescript.vs\n\n# databases and tools\ncinstm MsSqlServer2012Express\ncinstm mongodb\ncinstm MongoVUE\n\n# browsers\ncinstm Firefox\ncinstm GoogleChrome\n\n# Other tools\ncinstm git\ncinstm notepadplusplus\ncinstm winmerge\ncinstm Console2\ncinstm 7zip\ncinstm nodejs.install\ncinstm fiddler\ncinstm curl\ncinstm linqpad4\n\n" }, { "from": "gpt", "value": "# Dev apps to install\n\n# Visual studio stuff\ncinstm VisualStudio2013Ultimate\ncinstm VisualStudio2012Ultimate\n\n# Visual studio add-ins\ncinstm xUnit.vs2012\ncinstm WebEssentials2012\ncinstm resharper -Version 7.1.3000.2254 # Use only resharper if you want the latests. This is what I have a license for\ncinstm typescript\ncinstm typescript.vs\n\n# databases and tools\ncinstm MsSqlServer2012Express\ncinstm mongodb\ncinstm MongoVUE\n\n# browsers\ncinstm Firefox\ncinstm GoogleChrome\n\n# Other tools\ncinstm git\ncinstm notepadplusplus\ncinstm winmerge\ncinstm Console2\ncinstm 7zip\ncinstm nodejs.install\ncinstm fiddler\ncinstm curl\ncinstm linqpad4\n\n" } ]
powershell
chosen
[ { "from": "system", "value": "Write out time as part of CI build\n" }, { "from": "human", "value": "write-host \"Present working directory: $($pwd)\"\n\n$testsuites = [xml](get-content .\\test-results\\*.xml)\n$anyFailures = $FALSE\n\nforeach ($testsuite in $testsuites.testsuite) {\n\n write-host \" $($testsuite.name)\"\n\n foreach ($testcase in $testsuite.testcase){\n $failed = $testcase.failure\n $time = [decimal]$testsuite.time * 1000 # from seconds to milliseconds\n $testName = \"$($testcase.classname) $($testcase.name)\"\n\n if ($failed) {\n write-host \"Failed $($testcase.name) $($testcase.failure.message)\"\n Add-AppveyorTest $testName -Outcome Failed -FileName $testsuite.name -ErrorMessage $testcase.failure.message -Duration $time\n $anyFailures = $TRUE\n }\n else {\n write-host \"Passed $($testcase.name)\"\n Add-AppveyorTest $testName -Outcome Passed -FileName $testsuite.name -Duration $time\n }\n }\n}\n\nif ($anyFailures -eq $TRUE){\n write-host \"Failing build as there are broken tests\"\n $host.SetShouldExit(1)\n}\n" }, { "from": "gpt", "value": "write-host \"Present working directory: $($pwd)\"\n\n$testsuites = [xml](get-content .\\test-results\\*.xml)\n$anyFailures = $FALSE\n\nforeach ($testsuite in $testsuites.testsuite) {\n\n write-host \" $($testsuite.name)\"\n\n foreach ($testcase in $testsuite.testcase){\n $failed = $testcase.failure\n $time = [decimal]$testsuite.time * 1000 # from seconds to milliseconds\n $testName = \"$($testcase.classname) $($testcase.name)\"\n\n if ($failed) {\n write-host \"Failed $($testcase.name) $($testcase.failure.message) in $($time) ms\"\n Add-AppveyorTest $testName -Outcome Failed -FileName $testsuite.name -ErrorMessage $testcase.failure.message -Duration $time\n $anyFailures = $TRUE\n }\n else {\n write-host \"Passed $($testcase.name) in $($time) ms\"\n Add-AppveyorTest $testName -Outcome Passed -FileName $testsuite.name -Duration $time\n }\n }\n}\n\nif ($anyFailures -eq $TRUE){\n write-host \"Failing build as there are broken tests\"\n $host.SetShouldExit(1)\n}\n" } ]
powershell
chosen
[ { "from": "system", "value": "Update pack and push script\n" }, { "from": "human", "value": "param()\n\nfunction Activate() {\n $msbuildPath = \"C:\\Program Files (x86)\\MSBuild\\14.0\\Bin\\MSBuild.exe\"\n $msbuildPath = \"C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\MSBuild\\15.0\\Bin\\MSBuild.exe\"\n $solutionPath = (Resolve-Path \".\\src\\Watts\\Watts.csproj\")\n\n Write-Host \"Building release $solutionPath...\"\n & $msbuildPath /t:Build /m /nologo /verbosity:quiet /p:Configuration=Release $solutionPath\n\n $nuspecPath = (Resolve-Path \".\\Watts.nuspec\").Path\n [xml]$nuspecXml = Get-Content $nuspecPath\n $version = $nuspecXml.package.metadata.version\n\n $confirmation = Read-Host -Prompt \"Are you sure you want to push v$version (y/n)\"\n if (!($confirmation.ToLower() -eq \"y\"))\n {\n return\n }\n\n nuget pack .\\Watts.nuspec\n nuget push \".\\WebApiToTypeScript.$version.nupkg\" -Source https://www.nuget.org/api/v2/package\n \n Remove-Item *.nupkg -Force\n}\n\nActivate" }, { "from": "gpt", "value": "param()\n\nfunction Activate() {\n $MSBuildPaths = @(\n \"C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Professional\\MSBuild\\15.0\\Bin\\MSBuild.exe\",\n \"C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\MSBuild\\15.0\\Bin\\MSBuild.exe\",\n \"C:\\Program Files (x86)\\MSBuild\\14.0\\Bin\\MSBuild.exe\"\n )\n\n for ($i = 0; $i -lt $MSBuildPaths.Count; $i++) {\n $MSBuildPath = $MSBuildPaths[$i];\n if (Test-Path $MSBuildPath -ErrorAction SilentlyContinue) {\n break;\n }\n }\n\n $solutionPath = (Resolve-Path \".\\src\\Watts\\Watts.csproj\")\n\n Write-Host \"Building release $solutionPath...\"\n & $MSBuildPath /t:Build /m /nologo /verbosity:quiet /p:Configuration=Release $solutionPath\n\n $nuspecPath = (Resolve-Path \".\\Watts.nuspec\").Path\n [xml]$nuspecXml = Get-Content $nuspecPath\n $version = $nuspecXml.package.metadata.version\n\n $confirmation = Read-Host -Prompt \"Are you sure you want to push v$version (y/n)\"\n if (!($confirmation.ToLower() -eq \"y\")) {\n return\n }\n\n nuget pack .\\Watts.nuspec\n nuget push \".\\WebApiToTypeScript.$version.nupkg\" -Source https://www.nuget.org/api/v2/package\n \n Remove-Item *.nupkg -Force\n}\n\nActivate" } ]
powershell
chosen
[ { "from": "system", "value": "Copy nuspec to nuget dir\n" }, { "from": "human", "value": "if($env:APPVEYOR_REPO_BRANCH -eq \"release\")\n{\n\t$root = (split-path -parent $MyInvocation.MyCommand.Definition) + '\\..'\n\t$version = [System.Reflection.Assembly]::LoadFile(\"$root\\SqlServerHelpers\\bin\\Release\\SqlServerHelpers.dll\").GetName().Version\n\t$versionStr = \"{0}.{1}.{2}.{3}\" -f ($version.Major, $version.Minor, $version.Build, $version.Revision)\n\t\n\tWrite-Host \"Generating nuspec\"\n\tnuget spec $root\\SqlServerHelpers\\bin\\Release\\SqlServerHelpers.dll\n\n\tWrite-Host \"Setting .nuspec version tag to $versionStr\"\n\n\t$content = (Get-Content $root\\NuGet\\SqlServerHelpers.nuspec) \n\t$content = $content -replace '\\$version\\$', $versionStr\n\n\t$content | Out-File $root\\NuGet\\SqlServerHelpers.compiled.nuspec\n\n\t& nuget pack $root\\NuGet\\SqlServerHelpers.compiled.nuspec\n}\nelse\n{\n\tWrite-Host \"Not packaging for nuget. To package & push to nuget, merge onto the release branch\"\n}" }, { "from": "gpt", "value": "if($env:APPVEYOR_REPO_BRANCH -eq \"release\")\n{\n\t$root = (split-path -parent $MyInvocation.MyCommand.Definition) + '\\..'\n\t$version = [System.Reflection.Assembly]::LoadFile(\"$root\\SqlServerHelpers\\bin\\Release\\SqlServerHelpers.dll\").GetName().Version\n\t$versionStr = \"{0}.{1}.{2}.{3}\" -f ($version.Major, $version.Minor, $version.Build, $version.Revision)\n\t\n\tWrite-Host \"Generating nuspec\"\n\tnuget spec $root\\SqlServerHelpers\\bin\\Release\\SqlServerHelpers.dll\n\tcp $root\\SqlServerHelpers\\bin\\Release\\SqlServerHelpers.nuspec $root\\NuGet\\SqlServerHelpers.nuspec\n\n\tWrite-Host \"Setting .nuspec version tag to $versionStr\"\n\n\t$content = (Get-Content $root\\NuGet\\SqlServerHelpers.nuspec) \n\t$content = $content -replace '\\$version\\$', $versionStr\n\n\t$content | Out-File $root\\NuGet\\SqlServerHelpers.compiled.nuspec\n\n\t& nuget pack $root\\NuGet\\SqlServerHelpers.compiled.nuspec\n}\nelse\n{\n\tWrite-Host \"Not packaging for nuget. To package & push to nuget, merge onto the release branch\"\n}" } ]
powershell
chosen
[ { "from": "human", "value": "Add build and deply script\n" }, { "from": "gpt", "value": "$env:Path += \";C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\MSBuild\\Current\\Bin\"\nMSBuild PlaylistGrabber.sln -t:Rebuild -p:Configuration=Release\nxcopy /I /Y .\\PlaylistGrabber\\bin\\Release\\netcoreapp3.1 ..\\..\\Tools\\PlaylistGrabber" } ]
powershell
chosen
[ { "from": "human", "value": "Add meta project structure placeholder\n" }, { "from": "gpt", "value": "\n# Placeholder test file. This file will be replaced during test run with the\n# latest version from claudiospizzi/PowerShellModuleBase repository.\n\nDescribe 'Meta Project Structure' {\n\n It 'should be replaced with latest version' {\n\n $false | Should Be $true\n }\n}\n" } ]
powershell
chosen
[ { "from": "system", "value": "Use slightly less memory by not building as part of the test step.\n\nChange-Id: I99c405aa64073cf075bb03b2b8c3849c591bd849\n" }, { "from": "human", "value": "# Copyright(c) 2017 Google Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n# use this file except in compliance with the License. You may obtain a copy of\n# the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n# License for the specific language governing permissions and limitations under\n# the License.\n\n# TODO: Resurrect this test when bug 68199801 is fixed.\nImport-Module ..\\..\\..\\BuildTools.psm1 -DisableNameChecking\n\n\nBackupAndEdit-TextFile \"..\\QuickStart\\Program.cs\" `\n @{\"YOUR-PROJECT-ID\" = $env:GOOGLE_PROJECT_ID} `\n{ \n dotnet restore\n dotnet test\n}" }, { "from": "gpt", "value": "# Copyright(c) 2017 Google Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n# use this file except in compliance with the License. You may obtain a copy of\n# the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n# License for the specific language governing permissions and limitations under\n# the License.\n\n# TODO: Resurrect this test when bug 68199801 is fixed.\nImport-Module ..\\..\\..\\BuildTools.psm1 -DisableNameChecking\n\n\nBackupAndEdit-TextFile \"..\\QuickStart\\Program.cs\" `\n @{\"YOUR-PROJECT-ID\" = $env:GOOGLE_PROJECT_ID} `\n{\n dotnet restore\n dotnet build\n dotnet test --no-build --no-restore -v detailed\n}" } ]
powershell
chosen
[ { "from": "system", "value": "Fix script for running node on Win\n\nSee default TARGET_DIR in install.sh\n" }, { "from": "human", "value": "echo \"This script will run epoch synchronously inside Ubuntu\"\nPause\n\nbash -c \"cd ~/epoch && ./bin/epoch console\"\n\nPause\n" }, { "from": "gpt", "value": "echo \"This script will run epoch synchronously inside Ubuntu\"\nPause\n\nbash -c \"cd ~/aeternity/node && ./bin/epoch console\"\n\nPause\n" } ]
powershell
chosen
[ { "from": "system", "value": "Check service status. You can't stop \"stoped service\".\n" }, { "from": "human", "value": "[CmdletBinding()]\n\nParam\n(\n # Param1 help description\n [Parameter(Mandatory=$true,\n ValueFromPipelineByPropertyName=$true,\n Position=0)]\n [String]\n $ServiceName\n)\n\n$service = Get-Service $ServiceName -ErrorAction SilentlyContinue\n\nif ($service)\n{\n $service.Stop()\n}\n " }, { "from": "gpt", "value": "[CmdletBinding()]\n\nParam\n(\n # Param1 help description\n [Parameter(Mandatory=$true,\n ValueFromPipelineByPropertyName=$true,\n Position=0)]\n [String]\n $ServiceName\n)\n\n$service = Get-Service $ServiceName -ErrorAction SilentlyContinue\n\nif ($servicem -and $service.CanStop)\n{\n $service.Stop()\n}\n " } ]
powershell
chosen
[ { "from": "human", "value": "Add Unit Test for Get-PSCallSta\n" }, { "from": "gpt", "value": "Describe \"Get-PSCallStack DRT Unit Tests\" -Tags DRT {\n BeforeAll {\n $scriptFileName = \"GetTryCatchCallStack.ps1\"\n $scriptFilePath = Join-Path $TestDrive -ChildPath $scriptFileName\n }\n It \"Verifies that the script block of a catch clause does not show up on the call stack\" { \n $fileStream = @\"\n function foo()\n {\n try\n {\n throw 1\n }\n catch\n {\n bar\n }\n }\n\n function bar()\n {\n try\n {\n throw 1\n }\n catch\n {\n try\n {\n throw 1\n }\n catch\n {\n Get-PSCallStack\n }\n }\n }\n\n foo\n\"@\n\n $fileStream > $scriptFilePath\n\n $results = & \"$scriptFilePath\"\n $results.Count | Should BeGreaterThan 3\n $results[0].Command | Should be \"bar\"\n $results[0].ScriptName | Should be $scriptFilePath\n $results[0].ScriptLineNumber | Should be 27\n $results[0].InvocationInfo.ScriptLineNumber | Should be 9\n\n $results[1].Command | Should be \"foo\"\n $results[1].ScriptName | Should be $scriptFilePath\n $results[1].ScriptLineNumber | Should be 9\n $results[1].InvocationInfo.ScriptLineNumber | Should be 32\n\n #InvocationInfo.ScriptLineNumber: Gets the line number of the script that contains the command\n $results[2].Command | Should be $scriptFileName\n $results[2].ScriptName | Should be $scriptFilePath\n $results[2].ScriptLineNumber | Should be 32\n $results[2].InvocationInfo.ScriptLineNumber | Should be 44\n }\n\n It \"Verify that the script block of a trap statement shows up on the call stack\" {\n $fileStream = @\"\n trap\n {\n Get-PSCallStack\n continue\n }\n\n throw 1\n\"@\n\n $fileStream > $scriptFilePath\n $results = & \"$scriptFilePath\"\n $results.Count | Should BeGreaterThan 2\n $results[0].Command | Should be $scriptFileName\n $results[0].ScriptName | Should be $scriptFilePath\n $results[0].ScriptLineNumber | Should be 3\n $results[0].InvocationInfo.ScriptLineNumber | Should be 75\n\n $results[1].Command | Should be $scriptFileName\n $results[1].ScriptName | Should be $scriptFilePath\n $results[1].ScriptLineNumber | Should be 7\n $results[1].InvocationInfo.ScriptLineNumber | Should be 75\n }\n}" } ]
powershell
chosen
[ { "from": "system", "value": "Fix paths when script moved.\n" }, { "from": "human", "value": "dotnet restore $PSScriptRoot\\..\nIf ($lastexitcode -ne 0) {\n\tWrite-Host \"Restore failed.\"\n\texit 1\n}\ndotnet test $PSScriptRoot\\..\\tests\\OpenVsixSignTool.Core.Tests\\OpenVsixSignTool.Core.Tests.csproj\n\nIf ($lastexitcode -ne 0) {\n\tWrite-Host \"Tests failed.\"\n\texit 1\n}" }, { "from": "gpt", "value": "dotnet restore $PSScriptRoot\nIf ($lastexitcode -ne 0) {\n\tWrite-Host \"Restore failed.\"\n\texit 1\n}\ndotnet test $PSScriptRoot\\tests\\OpenVsixSignTool.Core.Tests\\OpenVsixSignTool.Core.Tests.csproj\n\nIf ($lastexitcode -ne 0) {\n\tWrite-Host \"Tests failed.\"\n\texit 1\n}" } ]
powershell
chosen
[ { "from": "system", "value": "Fix invalid file name in code coverage script\n" }, { "from": "human", "value": "$output = \"$PSScriptRoot\\coverage.xml\"\nIf (Test-Path $output) {\n\tRemove-Item $output -Force\n}\n\ndotnet test -f netcoreapp3.1 /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput=$output /p:Exclude=\"[xunit.*]*\" ../source/tusdotnet.sln\n\n$key = Read-Host -Prompt 'Input Codecov key'\n./codecov.sh -f \"coverage.xml\" -t $key\n" }, { "from": "gpt", "value": "# Framework to use when generating coverage. Must be a \"real\" framework, i.e. not netstandard.\n$framework = \"netcoreapp3.1\";\n# The file path passed to coverlet...\n$coverletWantedOutput = \"$PSScriptRoot\\coverage.xml\";\n# ...which will result in the following filename.\n$coverletActualOutput = \"$PSScriptRoot\\\" + \"coverage.{framework}.xml\".Replace(\"{framework}\", $framework);\nWrite-Host $coverletWantedOutput;\nWrite-Host $coverletActualOutput;\nIf (Test-Path $coverletActualOutput) {\n\tRemove-Item $output -Force\n}\n\ndotnet test -f $framework /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput=$coverletWantedOutput /p:Exclude=\"[xunit.*]*\" ../source/tusdotnet.sln\n\n$key = Read-Host -Prompt 'Input Codecov key'\n\nif(-not (Test-Path $coverletActualOutput)) {\n\tthrow \"$coverletActualOutput was not found\";\n}\n./codecov.sh -f $coverletActualOutput -t $key" } ]
powershell
chosen
[ { "from": "system", "value": "Add a test case for directed graph implementation\n" }, { "from": "human", "value": "Import-Module PSScriptAnalyzer\n$helperNamespace = 'Microsoft.Windows.PowerShell.ScriptAnalyzer';\n\n\nDescribe \"Test Directed Graph\" {\n Context \"When a graph is created\" {\n $digraph = New-Object -TypeName 'Microsoft.Windows.PowerShell.ScriptAnalyzer.DiGraph[string]'\n $digraph.AddVertex('v1');\n $digraph.AddVertex('v2');\n $digraph.AddVertex('v3');\n $digraph.AddVertex('v4');\n $digraph.AddEdge('v1', 'v2');\n $digraph.AddEdge('v2', 'v4');\n\n It \"correctly adds the vertices\" {\n $digraph.NumVertices | Should Be 4\n }\n\n It \"correctly adds the edges\" {\n $digraph.GetNumNeighbors('v1') | Should Be 1\n $neighbors = $digraph.GetNeighbors('v1')\n $neighbors[0] | Should Be 'v2'\n }\n\n It \"finds the connection\" {\n $digraph.IsConnected('v1', 'v4') | Should Be $true\n }\n }\n}" }, { "from": "gpt", "value": "Import-Module PSScriptAnalyzer\n\nDescribe \"Test Directed Graph\" {\n Context \"When a graph is created\" {\n $digraph = New-Object -TypeName 'Microsoft.Windows.PowerShell.ScriptAnalyzer.DiGraph[string]'\n $digraph.AddVertex('v1');\n $digraph.AddVertex('v2');\n $digraph.AddVertex('v3');\n $digraph.AddVertex('v4');\n $digraph.AddVertex('v5');\n\n $digraph.AddEdge('v1', 'v2');\n $digraph.AddEdge('v1', 'v5');\n $digraph.AddEdge('v2', 'v4');\n\n It \"correctly adds the vertices\" {\n $digraph.NumVertices | Should Be 5\n }\n\n It \"correctly adds the edges\" {\n $digraph.GetNumNeighbors('v1') | Should Be 2\n $neighbors = $digraph.GetNeighbors('v1')\n $neighbors -contains 'v2' | Should Be $true\n $neighbors -contains 'v5' | Should Be $true\n }\n\n It \"finds the connection\" {\n $digraph.IsConnected('v1', 'v4') | Should Be $true\n }\n }\n}" } ]
powershell
chosen
[ { "from": "system", "value": "Fix typo in Powershell script\n" }, { "from": "human", "value": "Get-NetAdapter -Physical | ForEach-Object {\n $ifname = $_.Name\n Write-Host \"Setting DNS servers on interface $ifname to use local resolver - the system will use Stubby if it is running\"\n set-dnsclientserveraddress $ifname -ServerAddresses (\"127.0.0.1\",\"1::0\")\n}" }, { "from": "gpt", "value": "Get-NetAdapter -Physical | ForEach-Object {\n $ifname = $_.Name\n Write-Host \"Setting DNS servers on interface $ifname to use local resolver - the system will use Stubby if it is running\"\n set-dnsclientserveraddress $ifname -ServerAddresses (\"127.0.0.1\",\"0::1\")\n}" } ]
powershell
chosen
[ { "from": "system", "value": "Fix catching \"Start-VM\" exceptions on Hyper-V during starting up VM\n" }, { "from": "human", "value": "param (\n [string]$VmId = $(throw \"-VmId is required.\")\n )\n\n# Include the following modules\n$presentDir = Split-Path -parent $PSCommandPath\n$modules = @()\n$modules += $presentDir + \"\\utils\\write_messages.ps1\"\nforEach ($module in $modules) { . $module }\n\ntry {\n $vm = Get-VM -Id $VmId -ErrorAction \"stop\"\n Start-VM $vm\n $state = $vm.state\n $status = $vm.status\n $name = $vm.name\n $resultHash = @{\n state = \"$state\"\n status = \"$status\"\n name = \"$name\"\n }\n $result = ConvertTo-Json $resultHash\n Write-Output-Message $result\n}\ncatch {\n Write-Error-Message \"Failed to start a VM $_\"\n}\n" }, { "from": "gpt", "value": "param (\n [string]$VmId = $(throw \"-VmId is required.\")\n )\n\n# Include the following modules\n$presentDir = Split-Path -parent $PSCommandPath\n$modules = @()\n$modules += $presentDir + \"\\utils\\write_messages.ps1\"\nforEach ($module in $modules) { . $module }\n\ntry {\n $vm = Get-VM -Id $VmId -ErrorAction \"stop\"\n Start-VM $vm -ErrorAction \"stop\"\n $state = $vm.state\n $status = $vm.status\n $name = $vm.name\n $resultHash = @{\n state = \"$state\"\n status = \"$status\"\n name = \"$name\"\n }\n $result = ConvertTo-Json $resultHash\n Write-Output-Message $result\n}\ncatch {\n Write-Error-Message \"Failed to start a VM $_\"\n}" } ]
powershell
chosen
[ { "from": "human", "value": "Add script for list rights for all shares\n" }, { "from": "gpt", "value": "<#\n.SYNOPSIS\n to do\n\n.DESCRIPTION\n to do\n\n.EXAMPLE\n .\\rightsShares.ps1\n\n.NOTES\n File Name : rightsShares.ps1\n Author : Nicolas Le Gall - contact <at> nlegall <dot> fr\n#>\n\n$i = 0\n\n$exclude = @(\"BUILTIN\\Administrateurs\", \"CREATEUR PROPRIETAIRE\")\n$filePath = \"C:\\temp\\tmp.csv\"\n\nRemove-Item $filePath\n$servers = (Get-ADComputer -Filter * -SearchBase \"OU=Serveurs,DC=kermene,DC=fr\" -Properties Description) | Select Name, Description\nAdd-Content $filePath \"Gestionnaire;Serveur;Partage;Chemin;Membres;Autorisations\"\nforeach($server in $servers)\n{\n write-progress -id 1 -activity \"Serveurs\" -status \"$($server.name)\" -percentComplete (($i/$servers.Count) * 100)\n $i++\n try\n {\n $shares = Get-WmiObject win32_share -ComputerName $($server.name) -ErrorAction Stop\n $j = 0\n ForEach($share in $shares)\n {\n write-progress -id 2 -parentId 1 -activity \"Partages\" -status \"$($share.Name)\" -percentComplete (($j/$shares.Count) * 100)\n $j++\n if(!($share.Name.Contains('$')))\n {\n try\n {\n $acls = Get-WmiObject win32_LogicalShareSecuritySetting -Filter \"name='$($share.Name)'\" -ComputerName $($server.name)\n $acls = $acls.GetSecurityDescriptor().Descriptor.DACL\n foreach($acl in $acls)\n {\n switch($acl.AccessMask) \n { \n 2032127 {$Perm = \"Full Control\"} \n 1245631 {$Perm = \"Change\"} \n 1179817 {$Perm = \"Read\"} \n }\n Add-Content $filePath \"$($server.Description);$($server.name);$($share.name);$($share.Path);$($acl.Trustee.Name);$Perm\"\n }\n try\n {\n $rights = get-acl \"\\\\$($server.name)\\$($share.name)\" -ErrorAction Stop | select AccessToString\n $rights = $rights -split '[\\r\\n]'\n $total = \"\"\n foreach($right in $rights)\n {\n $tmp = ($right -split \" A\")[0]\n if (!($exclude.Contains($tmp)))\n {\n $total += $tmp + \" - \"\n }\n }\n $total = $total.Substring(\"17\")\n Add-Content $filePath \"$($server.Description);$($server.name);$($share.name);$($share.Path);;;$total\"\n }\n catch [System.Management.Automation.ActionPreferenceStopException]\n {\n Add-Content $filePath \";;;;;NA\"\n }\n }\n catch [System.Management.Automation.RuntimeException]\n {\n Add-Content $filePath \"\"\n }\n }\n }\n }\n catch [Exception]\n {\n Add-Content $filePath \"$($server.Description);$($server.name);NOK\"\n }\n}" } ]
powershell
chosen
[ { "from": "system", "value": "Add support for generating collectors from remote systems\n" }, { "from": "human", "value": "Param(\n [Parameter(Mandatory=$true)]\n $Class,\n [Parameter(Mandatory=$false)]\n $CollectorName = ($Class -replace 'Win32_PerfRawData_Perf','')\n)\n$members = Get-WMIObject $Class `\n | Get-Member -MemberType Properties `\n | Where-Object { $_.Definition -Match '^u?int' -and $_.Name -NotMatch '_' } `\n | Select-Object Name, @{Name=\"Type\";Expression={$_.Definition.Split(\" \")[0]}}\n$input = @{\n \"Class\"=$Class;\n \"CollectorName\"=$CollectorName;\n \"Members\"=$members\n} | ConvertTo-Json\n$outFileName = \"..\\..\\collector\\$CollectorName.go\".ToLower()\n$input | .\\collector-generator.exe | Out-File -NoClobber -Encoding UTF8 $outFileName\ngo fmt $outFileName\n" }, { "from": "gpt", "value": "Param(\n [Parameter(Mandatory=$true)]\n $Class,\n [Parameter(Mandatory=$false)]\n $CollectorName = ($Class -replace 'Win32_PerfRawData_Perf',''),\n [Parameter(Mandatory=$false)]\n $ComputerName = \"localhost\",\n [Parameter(Mandatory=$false)]\n $Credential\n)\n$ErrorActionPreference = \"Stop\"\n\nif($Credential -ne $null) {\n $wmiObject = Get-WMIObject -ComputerName $ComputerName -Credential $Credential -Class $Class\n}\nelse {\n $wmiObject = Get-WMIObject -ComputerName $ComputerName -Class $Class\n}\n\n$members = $wmiObject `\n | Get-Member -MemberType Properties `\n | Where-Object { $_.Definition -Match '^u?int' -and $_.Name -NotMatch '_' } `\n | Select-Object Name, @{Name=\"Type\";Expression={$_.Definition.Split(\" \")[0]}}\n$input = @{\n \"Class\"=$Class;\n \"CollectorName\"=$CollectorName;\n \"Members\"=$members\n} | ConvertTo-Json\n$outFileName = \"..\\..\\collector\\$CollectorName.go\".ToLower()\n$input | .\\collector-generator.exe | Out-File -NoClobber -Encoding UTF8 $outFileName\ngo fmt $outFileName\n" } ]
powershell
chosen
[ { "from": "system", "value": "Fix Powershell for building nupkg\n" }, { "from": "human", "value": "$root = (split-path -parent $MyInvocation.MyCommand.Definition)\n\n<#\n# Create NuGet package for RC\n$version = [System.Reflection.Assembly]::LoadFile(\"$root\\src\\MeasureMap\\bin\\Release\\MeasureMap.dll\").GetName().Version\n$versionStr = \"{0}.{1}.{2}-RC0{3}\" -f ($version.Major, $version.Minor, $version.Build, $version.Revision)\n\nWrite-Host \"Setting .nuspec version tag to $versionStr\"\n\n$content = (Get-Content $root\\src\\MeasureMap.nuspec) \n$content = $content -replace '\\$version\\$',$versionStr\n\n$content | Out-File $root\\src\\MeasureMap.compiled.nuspec\n\n& $root\\build\\NuGet.exe pack $root\\src\\MeasureMap.compiled.nuspec\n#>\n\n# Create NuGet package for Release\n$versionStr = \"{0}.{1}.{2}\" -f ($version.Major, $version.Minor, $version.Build)\n\nWrite-Host \"Setting .nuspec version tag to $versionStr\"\n\n$content = (Get-Content $root\\src\\MeasureMap.nuspec) \n$content = $content -replace '\\$version\\$',$versionStr\n\n$content | Out-File $root\\src\\MeasureMap.compiled.nuspec\n\n& $root\\build\\NuGet.exe pack $root\\src\\MeasureMap.compiled.nuspec" }, { "from": "gpt", "value": "$root = (split-path -parent $MyInvocation.MyCommand.Definition)\n$version = [System.Reflection.Assembly]::LoadFile(\"$root\\src\\MeasureMap\\bin\\Release\\MeasureMap.dll\").GetName().Version\n\n<#\n# Create NuGet package for RC\n$versionStr = \"{0}.{1}.{2}-RC0{3}\" -f ($version.Major, $version.Minor, $version.Build, $version.Revision)\n\nWrite-Host \"Setting .nuspec version tag to $versionStr\"\n\n$content = (Get-Content $root\\src\\MeasureMap.nuspec) \n$content = $content -replace '\\$version\\$',$versionStr\n\n$content | Out-File $root\\src\\MeasureMap.compiled.nuspec\n\n& $root\\build\\NuGet.exe pack $root\\src\\MeasureMap.compiled.nuspec\n#>\n\n# Create NuGet package for Release\n$versionStr = \"{0}.{1}.{2}\" -f ($version.Major, $version.Minor, $version.Build)\n\nWrite-Host \"Setting .nuspec version tag to $versionStr\"\n\n$content = (Get-Content $root\\src\\MeasureMap.nuspec) \n$content = $content -replace '\\$version\\$',$versionStr\n\n$content | Out-File $root\\src\\MeasureMap.compiled.nuspec\n\n& $root\\build\\NuGet.exe pack $root\\src\\MeasureMap.compiled.nuspec" } ]
powershell
chosen
[ { "from": "system", "value": "Correct .NET Core 3.0.100 version number.\n" }, { "from": "human", "value": "trap {\n Write-Error $_\n Write-Host $_.ScriptStackTrace\n Exit 1\n}\nfunction CheckLastExitCode() {\n if ($LASTEXITCODE) {\n Write-Host (Get-PSCallStack)\n Exit $LASTEXITCODE\n }\n}\n\n# Assumes $PWD is the repo root\nif ($IsLinux) {\n sudo apt install dotnet-sdk-2.1.202 dotnet-sdk-3.0\n CheckLastExitCode\n Write-Host \"Installed .NET Core SDKs:\"\n dotnet --list-sdks\n CheckLastExitCode\n} elseif ($IsWindows) {\n Invoke-WebRequest 'https://dot.net/v1/dotnet-install.ps1' -OutFile 'DotNet-Install.ps1'\n ./DotNet-Install.ps1 -Version 2.1.202\n ./DotNet-Install.ps1 -Version 3.0\n Write-Host \"Installed .NET Core SDKs:\"\n dotnet --list-sdks\n CheckLastExitCode\n} else {\n Write-Error \"Invalid Environment.\"\n}\n" }, { "from": "gpt", "value": "trap {\n Write-Error $_\n Write-Host $_.ScriptStackTrace\n Exit 1\n}\nfunction CheckLastExitCode() {\n if ($LASTEXITCODE) {\n Write-Host (Get-PSCallStack)\n Exit $LASTEXITCODE\n }\n}\n\n# Assumes $PWD is the repo root\nif ($IsLinux) {\n sudo apt install dotnet-sdk-2.1.202 dotnet-sdk-3.0\n CheckLastExitCode\n Write-Host \"Installed .NET Core SDKs:\"\n dotnet --list-sdks\n CheckLastExitCode\n} elseif ($IsWindows) {\n Invoke-WebRequest 'https://dot.net/v1/dotnet-install.ps1' -OutFile 'DotNet-Install.ps1'\n ./DotNet-Install.ps1 -Version 2.1.202\n ./DotNet-Install.ps1 -Version 3.0.100\n Write-Host \"Installed .NET Core SDKs:\"\n dotnet --list-sdks\n CheckLastExitCode\n} else {\n Write-Error \"Invalid Environment.\"\n}\n" } ]
powershell
chosen
[ { "from": "system", "value": "Update tab support to handle task calling without the -task switch\n" }, { "from": "human", "value": "$global:psakeSwitches = '-docs', '-task', '-properties', '-parameters'\r\n\r\nfunction script:psakeSwitches($filter) {\r\n $psakeSwitches | where { $_ -like \"$filter*\" }\r\n}\r\n\r\nfunction script:psakeDocs($filter) {\r\n psake -docs | out-string -Stream |% { if ($_ -match \"^[^ ]*\") { $matches[0]} } |? { $_ -ne \"Name\" -and $_ -ne \"----\" -and $_ -like \"$filter*\" }\r\n}\r\n\r\nfunction PsakeTabExpansion($lastBlock) {\r\n switch -regex ($lastBlock) {\r\n '(invoke-psake|psake) .* ?\\-t[^ ]* (\\S*)$' {\r\n psakeDocs $matches[2]\r\n }\r\n '(invoke-psake|psake) .* ?(\\-\\S*)$' {\r\n psakeSwitches $matches[2]\r\n }\r\n '(invoke-psake|psake) (\\S*)$' {\r\n ls $matches[2]*.ps1 |% { \"./$_\" }\r\n }\r\n }\r\n}\r\n" }, { "from": "gpt", "value": "$global:psakeSwitches = @('-docs', '-task', '-properties', '-parameters')\r\n\r\nfunction script:psakeSwitches($filter) { \r\n $psakeSwitches | where { $_ -like \"$filter*\" }\r\n}\r\n\r\nfunction script:psakeDocs($filter, $file) {\r\n if ($file -eq $null -or $file -eq '') { $file = 'default.ps1' }\r\n psake $file -docs | out-string -Stream |% { if ($_ -match \"^[^ ]*\") { $matches[0]} } |? { $_ -ne \"Name\" -and $_ -ne \"----\" -and $_ -like \"$filter*\" }\r\n}\r\n\r\nfunction script:psakeFiles($filter) {\r\n ls \"$filter*.ps1\" |% { $_.Name }\r\n}\r\n\r\nfunction PsakeTabExpansion($lastBlock) {\r\n switch -regex ($lastBlock) {\r\n '(invoke-psake|psake) ([^\\.]*\\.ps1)? ?.* ?\\-ta?s?k? (\\S*)$' { # tasks only\r\n psakeDocs $matches[3] $matches[2] | sort\r\n } \r\n '(invoke-psake|psake) ([^\\.]*\\.ps1)? ?.* ?(\\-\\S*)$' { # switches only\r\n psakeSwitches $matches[3] | sort\r\n } \r\n '(invoke-psake|psake) ([^\\.]*\\.ps1) ?.* ?(\\S*)$' { # switches or tasks\r\n @(psakeDocs $matches[3] $matches[2]) + @(psakeSwitches $matches[3]) | sort\r\n }\r\n '(invoke-psake|psake) (\\S*)$' {\r\n @(psakeFiles $matches[2]) + @(psakeDocs $matches[2] 'default.ps1') + @(psakeSwitches $matches[2]) | sort\r\n }\r\n }\r\n}\r\n" } ]
powershell
chosen
[ { "from": "human", "value": "Create PowerShell Script for Windows users" }, { "from": "gpt", "value": "$VERSION=\"0.4.2\"\n$AMMONIUM_VERSION=\"0.8.3-1\"\n$SCALA_VERSION=\"2.11.11\" # Set to 2.12.2 for Scala 2.12\n\n$TYPELEVEL_SCALA=$false # If true, set SCALA_VERSION above to a both ammonium + TLS available version (e.g. 2.11.8)\n\n$EXTRA_OPTS=@()\n\nfunction Make-Temp\n{\n $find_temp=$false\n $random=Get-Random\n $result=\"$env:TEMP\\$random\"\n while(!($find_temp)) {\n $result=\"$env:TEMP\\$random\"\n if(Test-Path $result) {\n $random=Get-Random\n } else {\n $find_temp=$true\n }\n }\n $result\n}\n\n$COURSIER_JAR=Make-Temp\n\necho \"Getting coursier launcher...\"\n(New-Object Net.WebClient).DownloadFile('https://git.io/vgvpD', $COURSIER_JAR)\necho \"Done\"\n\nif($TYPELEVEL_SCALA) {\n $EXTRA_OPTS += @(\n \"-E\", \"org.scala-lang:scala-compiler\",\n \"-E\", \"org.scala-lang:scala-library\",\n \"-E\", \"org.scala-lang:scala-reflect\",\n \"-I\", \"ammonite:org.typelevel:scala-compiler:$SCALA_VERSION\",\n \"-I\", \"ammonite:org.typelevel:scala-library:$SCALA_VERSION\",\n \"-I\", \"ammonite:org.typelevel:scala-reflect:$SCALA_VERSION\"\n )\n}\n\n& \"java\" -noverify -jar $COURSIER_JAR launch `\n -r sonatype:releases -r sonatype:snapshots `\n -i ammonite `\n -I \"ammonite:org.jupyter-scala:ammonite-runtime_$SCALA_VERSION`:$AMMONIUM_VERSION\" `\n -I \"ammonite:org.jupyter-scala:scala-api_$SCALA_VERSION`:$VERSION\" `\n $EXTRA_OPTS `\n \"org.jupyter-scala:scala-cli_$SCALA_VERSION`:$VERSION\" `\n -- `\n --id scala `\n --name \"Scala\" `\n $args\n\nrm $COURSIER_JAR\n" } ]
powershell
chosen
[ { "from": "system", "value": "Make sure deployment script halts on errors" }, { "from": "human", "value": "$ProgressPreference=\"SilentlyContinue\"\n\n$destinationUri = \"https://$($Env:STORAGE_HOSTNAME)/www\"\n$destinationKey = $Env:STORAGE_KEY\n.\\deployment\\AzCopy\\AzCopy.exe /Source:.\\ToDoFunctions\\www /Dest:$destinationUri /DestKey:$destinationKey /SetContentType /S /Y\n\n$storageContext = New-AzureStorageContext -ConnectionString $Env:STORAGE_CONNECTION\nSet-AzureStorageContainerAcl -Container \"www\" -Permission Container -Context $storageContext\n\n" }, { "from": "gpt", "value": "$ProgressPreference=\"SilentlyContinue\"\n\n$destinationUri = \"https://$($Env:STORAGE_HOSTNAME)/www\"\n$destinationKey = $Env:STORAGE_KEY\n.\\deployment\\AzCopy\\AzCopy.exe /Source:.\\ToDoFunctions\\www /Dest:$destinationUri /DestKey:$destinationKey /SetContentType /S /Y\nif ($LastExitCode -ne 0) { throw \"azcopy returned code $($LastExitCode)\" }\n\n$storageContext = New-AzureStorageContext -ConnectionString $Env:STORAGE_CONNECTION -ErrorAction Stop\nSet-AzureStorageContainerAcl -Container \"www\" -Permission Container -Context $storageContext -ErrorAction Stop\n" } ]
powershell
chosen
[ { "from": "system", "value": "Fix the set version script\n" }, { "from": "human", "value": "$ReleaseVersionNumber = $env:APPVEYOR_BUILD_VERSION\n$PreReleaseName = ''\n\nIf($env:APPVEYOR_PULL_REQUEST_NUMBER -ne $null) {\n $PreReleaseName = '-PR-' + $env:APPVEYOR_PULL_REQUEST_NUMBER\n} ElseIf($env:APPVEYOR_REPO_BRANCH -ne 'master') {\n $PreReleaseName = '-' + $env:APPVEYOR_REPO_BRANCH\n} Else {\n $PreReleaseName = '-CI'\n}\n\n$PSScriptFilePath = (Get-Item $MyInvocation.MyCommand.Path).FullName\n$ScriptDir = Split-Path -Path $PSScriptFilePath -Parent\n$SolutionRoot = Split-Path -Path $ScriptDir -Parent\n\n $ProjectJsonPath = Join-Path -Path $SolutionRoot -ChildPath \"src\\dotnet-test-nunit\\project.json\"\n (gc -Path $ProjectJsonPath) `\n \t-replace \"(?<=`\"version`\":\\s`\")[.\\w-]*(?=`\",)\", \"$ReleaseVersionNumber$PreReleaseName\" |\n \tsc -Path $ProjectJsonPath -Encoding UTF8" }, { "from": "gpt", "value": "$ReleaseVersionNumber = $env:APPVEYOR_BUILD_VERSION\n$PreReleaseName = ''\n\nIf($env:APPVEYOR_PULL_REQUEST_NUMBER -ne $null) {\n $PreReleaseName = '-PR-' + $env:APPVEYOR_PULL_REQUEST_NUMBER\n} ElseIf($env:APPVEYOR_REPO_BRANCH -ne 'master') {\n $PreReleaseName = '-' + $env:APPVEYOR_REPO_BRANCH\n} Else {\n $PreReleaseName = '-CI'\n}\n\n$PSScriptFilePath = (Get-Item $MyInvocation.MyCommand.Path).FullName\n$ScriptDir = Split-Path -Path $PSScriptFilePath -Parent\n$SolutionRoot = Split-Path -Path $ScriptDir -Parent\n\n $ProjectJsonPath = Join-Path -Path $SolutionRoot -ChildPath \"src\\NUnit.Agent.Portable\\project.json\"\n (gc -Path $ProjectJsonPath) `\n \t-replace \"(?<=`\"version`\":\\s`\")[.\\w-]*(?=`\",)\", \"$ReleaseVersionNumber$PreReleaseName\" |\n \tsc -Path $ProjectJsonPath -Encoding UTF8" } ]
powershell
chosen
[ { "from": "system", "value": "Tweak bulk load weapon script\n" }, { "from": "human", "value": "$Here = \"$(Split-Path -parent $MyInvocation.MyCommand.Definition)\"\n\nImport-Module \"$Here\\_Helpers\" -DisableNameChecking\n\n# Clear out existing -- this is not what we're looking for if we've got multiple units\n\n(BC-Get -Uri \"$URL/weapons\")\n\nforeach($Weapon in (BC-Get -Uri \"$URL/weapons\"))\n{\n\tWrite-Output \"Removing Weapon with ID $($Weapon.Id)\"\n\n\t#BC-Delete -Uri \"$URL/weapons/$($Weapon.Id)\"\n}\n\n# Get weapons from CSV file\n\nforeach($Weapon in (Import-Csv -Path $Here\\WEAPONS_ROSTER.csv))\n{\n\t# Create new weapon with info\n\n\t#Write-Output \"Create new MAL entry for $Weapon\"\n\n\t#BC-Post -Uri \"$URL/Weapons\" -Body @{ UnitId = 3; AdminNumber = $Weapon.NUM; Serial = $Weapon.SERIAL; OpticSerial = $Weapon.CCO }\n}\n\n" }, { "from": "gpt", "value": "$Here = \"$(Split-Path -parent $MyInvocation.MyCommand.Definition)\"\n\nImport-Module \"$Here\\_Helpers\" -DisableNameChecking\n\n# Clear out existing -- this is not what we're looking for if we've got multiple units\n\nforeach($Weapon in (BC-Get -Uri \"$URL/weapons\"))\n{\n\tWrite-Output \"Removing Weapon with ID $($Weapon.Id)\"\n\n\tBC-Delete -Uri \"$URL/weapons?id=$($Weapon.Id)\"\n}\n\n# Get weapons from CSV file\n\nforeach($Weapon in (Import-Csv -Path $Here\\WEAPONS_ROSTER.csv))\n{\n\t# Create new weapon with info\n\n\tWrite-Output \"Create new MAL entry for $Weapon\"\n\n\t#BC-Post -Uri \"$URL/Weapons\" -Body @{ UnitId = 3; AdminNumber = $Weapon.NUM; Serial = $Weapon.SERIAL; OpticSerial = $Weapon.CCO }\n}\n\n" } ]
powershell
chosen
[ { "from": "human", "value": "Add tool to create package.\n" }, { "from": "gpt", "value": "$msbuild = \"C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\MSBuild.exe\"\n\ncd ..\\KLibrary2_1\nInvoke-Expression ($msbuild + \" KLibrary2_1.sln /p:Configuration=Release /t:Clean\")\nInvoke-Expression ($msbuild + \" KLibrary2_1.sln /p:Configuration=Release /t:Rebuild\")\n\ncd .\\ComponentModel\n.\\NuGetPackup.exe\n\nmove *.nupkg ..\\..\\Published -Force\n" } ]
powershell
chosen
[ { "from": "system", "value": "Use blue colors for executables\n" }, { "from": "human", "value": "# Aliases\n# New-Alias -Name ll -Value ls\n\n# List all files and folders including hidden ones using \"ll\" function\nfunction ll {\n Get-ChildItem -Force @args\n}\n\n# Import modules\nImport-Module PSColor # https://github.com/Davlind/PSColor\nImport-Module posh-git # https://github.com/dahlbyk/posh-git\n\n# Update modules\n# Install-Module PSColor\n# Update-Module posh-git\n\n# Environment variables\n$CONDAENVS = \"C:\\Program Files\\Miniconda2\\envs\"\n" }, { "from": "gpt", "value": "# Aliases\n# New-Alias -Name ll -Value ls\n\n# List all files and folders including hidden ones using \"ll\" function\nfunction ll {\n Get-ChildItem -Force @args\n}\n\n# Import modules\nImport-Module PSColor # https://github.com/Davlind/PSColor\nImport-Module posh-git # https://github.com/dahlbyk/posh-git\n\n# Module settings\n$global:PSColor.File.Executable.Color = 'Blue' # Set blue color for executables (instead of red)\n\n# Update modules\n# Install-Module PSColor\n# Update-Module posh-git\n\n# Environment variables\n$CONDAENVS = \"C:\\Program Files\\Miniconda2\\envs\"\n" } ]
powershell
chosen
[ { "from": "human", "value": "Connect to SQL example for Azure Pipeline\n" }, { "from": "gpt", "value": "[CmdletBinding()]\nparam (\n [string] $TenantId = $env:AadTenantId,\n [string] $ClientId = $env:AadAppClientId,\n [string] $ClientSecret = $env:AadAppClientSecret,\n [string] $SqlServerFqn = $env:SqlServerFqn,\n [string] $SqlDb = $env:SqlDb\n)\n\n$resourceAppIdURI = 'https://database.windows.net/'\n\n$tokenResponse = Invoke-RestMethod -Method Post -UseBasicParsing `\n -Uri \"https://login.windows.net/$($TenantID)/oauth2/token\" `\n -Body @{\n resource=$resourceAppIdURI\n client_id=$ClientId\n grant_type='client_credentials'\n client_secret=$ClientSecret\n } -ContentType 'application/x-www-form-urlencoded'\n\nif ($tokenResponse) {\n Write-debug \"Access token type is $($tokenResponse.token_type), expires $($tokenResponse.expires_on)\"\n $Token = $tokenResponse.access_token\n}\n\n$conn = new-object System.Data.SqlClient.SqlConnection\n$conn.ConnectionString = \"Server=tcp:$($SqlServerFqn);Initial Catalog=$($SqlDb);Persist Security Info=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;\" \n$conn.AccessToken = $token\n$conn\nWrite-Verbose \"Connect to database and execute SQL script\"\n$conn.Open() \n$query = 'select @@version'\n$command = New-Object -TypeName System.Data.SqlClient.SqlCommand($query, $conn) \t\n$Result = $command.ExecuteScalar()\n$Result\n$conn.Close() \n" } ]
powershell
chosen
[ { "from": "system", "value": "Debug tests failures in Appveyor\n" }, { "from": "human", "value": "$ModuleName = 'PSCodeHealthMetrics'\nImport-Module \"$($PSScriptRoot)\\..\\..\\..\\$($ModuleName).psd1\" -Force\n\n$Mocks = ConvertFrom-Json (Get-Content -Path \"$($PSScriptRoot)\\..\\TestData\\MockObjects.json\" -Raw )\n\nDescribe 'Get-FunctionScriptAnalyzerViolation' {\n InModuleScope $ModuleName {\n\n $Files = (Get-ChildItem -Path \"$($PSScriptRoot)\\..\\TestData\\\" -Filter '*.psm1').FullName\n $FunctionDefinitions = Get-FunctionDefinition -Path $Files\n \n Context 'When the function contains no best practices violation' {\n\n Mock Invoke-ScriptAnalyzer { }\n\n It 'Should return 0' {\n Get-FunctionScriptAnalyzerViolation -FunctionDefinition $FunctionDefinitions[0] |\n Should Be 0\n }\n }\n Context 'When the function contains 1 best practices violation' {\n\n Mock Invoke-ScriptAnalyzer { $Mocks.'Invoke-ScriptAnalyzer'.'1ScriptAnalyzerViolation' | Where-Object { $_ } }\n\n It 'Should return 1' {\n Get-FunctionScriptAnalyzerViolation -FunctionDefinition $FunctionDefinitions[0] |\n Should Be 1\n }\n }\n Context 'When the function contains 3 best practices violations' {\n\n Mock Invoke-ScriptAnalyzer { $Mocks.'Invoke-ScriptAnalyzer'.'3ScriptAnalyzerViolations' | Where-Object { $_ } }\n\n It 'Should return 3' {\n Get-FunctionScriptAnalyzerViolation -FunctionDefinition $FunctionDefinitions[0] |\n Should Be 3\n }\n }\n }\n}" }, { "from": "gpt", "value": "$ModuleName = 'PSCodeHealthMetrics'\nImport-Module \"$($PSScriptRoot)\\..\\..\\..\\$($ModuleName).psd1\" -Force\n\nWrite-Host \"PSScriptRoot : $($PSScriptRoot)\"\n\n$Mocks = ConvertFrom-Json (Get-Content -Path \"$($PSScriptRoot)\\..\\TestData\\MockObjects.json\" -Raw )\nWrite-Host \"Mocks $($Mocks | Out-String)\"\nForeach ( $Mock in $Mocks.'Invoke-ScriptAnalyzer' ) { Write-Host \"Mock : $($Mock | Out-String)\" }\n\nDescribe 'Get-FunctionScriptAnalyzerViolation' {\n InModuleScope $ModuleName {\n\n $Files = (Get-ChildItem -Path \"$($PSScriptRoot)\\..\\TestData\\\" -Filter '*.psm1').FullName\n $FunctionDefinitions = Get-FunctionDefinition -Path $Files\n \n Context 'When the function contains no best practices violation' {\n\n Mock Invoke-ScriptAnalyzer { }\n\n It 'Should return 0' {\n Get-FunctionScriptAnalyzerViolation -FunctionDefinition $FunctionDefinitions[0] |\n Should Be 0\n }\n }\n Context 'When the function contains 1 best practices violation' {\n\n Mock Invoke-ScriptAnalyzer { $Mocks.'Invoke-ScriptAnalyzer'.'1ScriptAnalyzerViolation' | Where-Object { $_ } }\n\n It 'Should return 1' {\n Get-FunctionScriptAnalyzerViolation -FunctionDefinition $FunctionDefinitions[0] |\n Should Be 1\n }\n }\n Context 'When the function contains 3 best practices violations' {\n\n Mock Invoke-ScriptAnalyzer { $Mocks.'Invoke-ScriptAnalyzer'.'3ScriptAnalyzerViolations' | Where-Object { $_ } }\n\n It 'Should return 3' {\n Get-FunctionScriptAnalyzerViolation -FunctionDefinition $FunctionDefinitions[0] |\n Should Be 3\n }\n }\n }\n}" } ]
powershell
chosen
[ { "from": "system", "value": "Fix the arch name for Android\n" }, { "from": "human", "value": "$Archs = { \"Net45\",\"WP8\", \"WinRT45\", \"Mono\", \"Monodroid\", \"Monotouch\"}\n$Projects = {\"Akavache\", \"Akavache.Sqlite3\", \"Akavache.Mobile\"}\n\n$SlnFileExists = Test-Path \".\\Akavache.sln\"\nif ($SlnFileExists -eq $False) {\n echo \"*** ERROR: Run this in the project root ***\"\n exit -1\n}\n\n###\n### Build the Release directory\n###\n\nif (Test-Path .\\Release) {\n\trmdir -r -force .\\Release\n}\n\nforeach-object $Archs | %{mkdir -Path \".\\Release\\$_\"}\n\nforeach-object $Archs | %{\n $currentArch = $_\n \n foreach-object $Projects | %{cp -r -fo \".\\$_\\bin\\Release\\$currentArch\\*\" \".\\Release\\$currentArch\"}\n \n #ls -r | ?{$_.FullName.Contains(\"bin\\Release\\$currentArch\") -and $_.Length} | %{echo cp $_.FullName \".\\Release\\$currentArch\"}\n}\n\nls -r .\\Release | ?{$_.FullName.Contains(\"Clousot\")} | %{rm $_.FullName}\n\next\\tools\\xamarin-component.exe package component\n" }, { "from": "gpt", "value": "$Archs = { \"Net45\",\"WP8\", \"WinRT45\", \"Mono\", \"Monoandroid\", \"Monotouch\", \"Portable-Net45+WinRT45+WP8\"}\n$Projects = {\"Akavache\", \"Akavache.Sqlite3\", \"Akavache.Mobile\"}\n\n$SlnFileExists = Test-Path \".\\Akavache.sln\"\nif ($SlnFileExists -eq $False) {\n echo \"*** ERROR: Run this in the project root ***\"\n exit -1\n}\n\n###\n### Build the Release directory\n###\n\nif (Test-Path .\\Release) {\n\trmdir -r -force .\\Release\n}\n\nforeach-object $Archs | %{mkdir -Path \".\\Release\\$_\"}\n\nforeach-object $Archs | %{\n $currentArch = $_\n \n foreach-object $Projects | %{cp -r -fo \".\\$_\\bin\\Release\\$currentArch\\*\" \".\\Release\\$currentArch\"}\n \n #ls -r | ?{$_.FullName.Contains(\"bin\\Release\\$currentArch\") -and $_.Length} | %{echo cp $_.FullName \".\\Release\\$currentArch\"}\n}\n\nls -r .\\Release | ?{$_.FullName.Contains(\"Clousot\")} | %{rm $_.FullName}\n\next\\tools\\xamarin-component.exe package component\n" } ]
powershell
chosen
[ { "from": "system", "value": "Check that git can really be used as well as posh-git\n\nExplicitly call `import posh-git` because it doesn't have a module\nmanifest thus powershell can't autoload it when using a cmdlet.\n\nAt present the cmder repo doesn't try to download posh-git so it might be\nmissing from the users session.\n" }, { "from": "human", "value": "# Add Cmder modules directory to the autoload path.\n$CmderModulePath = Join-path $PSScriptRoot \"psmodules/\"\n\nif( -not $env:PSModulePath.Contains($CmderModulePath) ){\n $env:PSModulePath = $env:PSModulePath.Insert(0, \"$CmderModulePath;\")\n}\n\n# Set up a Cmder prompt, adding the git prompt parts inside git repos\nfunction global:prompt {\n $realLASTEXITCODE = $LASTEXITCODE\n $Host.UI.RawUI.ForegroundColor = \"White\"\n Write-Host $pwd.ProviderPath -NoNewLine -ForegroundColor Green\n if (Get-Module posh-git) {\n Write-VcsStatus\n }\n $global:LASTEXITCODE = $realLASTEXITCODE\n Write-Host \"`nλ\" -NoNewLine -ForegroundColor \"DarkGray\"\n return \" \"\n}\n\n# Load special features come from posh-git\nif (Get-Module posh-git) {\n Enable-GitColors\n Start-SshAgent -Quiet\n}\n\n# Move to the wanted location\nif (Test-Path Env:\\CMDER_START) {\n Set-Location -Path $Env:CMDER_START\n} elseif ($Env:CMDER_ROOT -and $Env:CMDER_ROOT.StartsWith($pwd)) {\n Set-Location -Path $Env:USERPROFILE\n}\n" }, { "from": "gpt", "value": "# Add Cmder modules directory to the autoload path.\n$CmderModulePath = Join-path $PSScriptRoot \"psmodules/\"\n\nif( -not $env:PSModulePath.Contains($CmderModulePath) ){\n $env:PSModulePath = $env:PSModulePath.Insert(0, \"$CmderModulePath;\")\n}\n\ntry {\n Get-command -Name \"git\" -ErrorAction Stop >$null\n Import-Module -Name \"posh-git\" -ErrorAction Stop >$null\n $gitStatus = $true\n} catch {\n Write-Warning \"Missing git support\"\n $gitStatus = $false\n}\n\n# Set up a Cmder prompt, adding the git prompt parts inside git repos\nfunction global:prompt {\n $realLASTEXITCODE = $LASTEXITCODE\n $Host.UI.RawUI.ForegroundColor = \"White\"\n Write-Host $pwd.ProviderPath -NoNewLine -ForegroundColor Green\n Write-VcsStatus\n if($gitStatus){\n }\n $global:LASTEXITCODE = $realLASTEXITCODE\n Write-Host \"`nλ\" -NoNewLine -ForegroundColor \"DarkGray\"\n return \" \"\n}\n\n# Load special features come from posh-git\nif ($gitStatus) {\n Enable-GitColors\n Start-SshAgent -Quiet\n}\n\n# Move to the wanted location\nif (Test-Path Env:\\CMDER_START) {\n Set-Location -Path $Env:CMDER_START\n} elseif ($Env:CMDER_ROOT -and $Env:CMDER_ROOT.StartsWith($pwd)) {\n Set-Location -Path $Env:USERPROFILE\n}\n" } ]
powershell
chosen
[ { "from": "system", "value": "Fix another typo in the deploy script.\n" }, { "from": "human", "value": "param(\r\n\t[switch] $X64\r\n)\r\n\r\n$deployPath = 'Deploy'\r\n\r\nif (Test-Path $deployPath) {\r\n Remove-Item -Recurse $deployPath\r\n}\r\n\r\nmkdir $deployPath\r\nmkdir $deployPath\\Plugins\r\nmkdir $deployPath\\Plugins\\Hell\r\n\r\n# Hell Adapter\r\n$adapterPath = if ($X64) { 'x64\\Debug' } else { 'Debug' }\r\nCopy-Item $adapterPath\\HellAdapter.dll $deployPath\\Plugins\r\nCopy-Item $adapterPath\\HellAdapter.pdb $deployPath\\Plugins\r\n\r\n# Hell API\r\n$bin = if ($X64) { 'x86' } else { 'x64' }\r\nCopy-Item HellAPI\\bin\\$bin\\Debug\\* $deployPath\r\n\r\n# Hell Manager\r\nCopy-Item HellManager\\bin\\$bin\\Debug\\* $deployPath\\Plugins\\Hell" }, { "from": "gpt", "value": "param(\r\n\t[switch] $X64\r\n)\r\n\r\n$deployPath = 'Deploy'\r\n\r\nif (Test-Path $deployPath) {\r\n Remove-Item -Recurse $deployPath\r\n}\r\n\r\nmkdir $deployPath\r\nmkdir $deployPath\\Plugins\r\nmkdir $deployPath\\Plugins\\Hell\r\n\r\n# Hell Adapter\r\n$adapterPath = if ($X64) { 'x64\\Debug' } else { 'Debug' }\r\nCopy-Item $adapterPath\\HellAdapter.dll $deployPath\\Plugins\r\nCopy-Item $adapterPath\\HellAdapter.pdb $deployPath\\Plugins\r\n\r\n# Hell API\r\n$bin = if ($X64) { 'x64' } else { 'x86' }\r\nCopy-Item HellAPI\\bin\\$bin\\Debug\\* $deployPath\r\n\r\n# Hell Manager\r\nCopy-Item HellManager\\bin\\$bin\\Debug\\* $deployPath\\Plugins\\Hell" } ]
powershell
chosen
[ { "from": "system", "value": "Update to make more valid tests\n" }, { "from": "human", "value": "Select-LocalDevWorkspace SCOrchDev\n\nDescribe \"Invoke-GitRepositorySync\" {\n It \"does something useful\" {\n $true | Should Be $true\n }\n}\n" }, { "from": "gpt", "value": "$here = Split-Path -Parent $MyInvocation.MyCommand.Path\n\nSelect-LocalDevWorkspace SCOrchDev\n\nDescribe \"Invoke-GitRepositorySync\" {\n Mock Get-AutomationPSCredential {\n return new-object -TypeName System.Management.Automation.PSCredential -ArgumentList 'user\\a', ('asdf'|ConvertTo-SecureString -AsPlainText -Force)\n }\n Mock Connect-AzureRmAccount { \n }\n \n Mock Set-AutomationVariable {\n Return $Value\n }\n Mock Sync-GitRepositoryToAzureAutomation {\n '123'\n }\n\n $Output = & \"$Here\\../Runbooks/GitRepositorySync/Invoke-GitRepositorySync.ps1\"\n It 'Should establish a connection to azure' {\n Assert-MockCalled -CommandName Connect-AzureRmAccount -Times 1\n }\n\n It 'Should call Sync Git Repository' {\n Assert-MockCalled -CommandName Sync-GitRepositoryToAzureAutomation -Times 1\n }\n}\n" } ]
powershell
chosen
[ { "from": "system", "value": "Install remote desktop connection manager as part of the dev pkg\n" }, { "from": "human", "value": "$ScriptPath = Split-Path -Parent $MyInvocation.MyCommand.Definition\n\n& \"$ScriptPath\\PowerShellProfile\\Microsoft.PowerShell_profile.ps1\"\n\n## Common Developer Tools\n\nchoco install baretail\nchoco install smtp4dev\nchoco install f.lux\n\n# Do we want btsync on all of the machines?\n# choco install btsync\n\n## choco install redis-64\n## choco install redis-desktop-manager\n\n## choco install virtualbox\n## choco install vagrant\n\n## choco install freeSSHD\n## choco install Tunnelier\n\n## choco install jenkins\n\n## choco install rabbitmq\n\n## choco install nginx\n\n## choco install sqlite\n\n## choco install mysql\n## choco install postgresql\n\n## choco install grails\n## choco install scala\n\n## choco install mongodb\n## choco install mongovue" }, { "from": "gpt", "value": "$ScriptPath = Split-Path -Parent $MyInvocation.MyCommand.Definition\n\n& \"$ScriptPath\\PowerShellProfile\\Microsoft.PowerShell_profile.ps1\"\n\n## Common Developer Tools\n\nchoco install baretail\nchoco install smtp4dev\nchoco install f.lux\n\nchoco install rdcman\n\n# Do we want btsync on all of the machines?\n# choco install btsync\n\n## choco install redis-64\n## choco install redis-desktop-manager\n\n## choco install virtualbox\n## choco install vagrant\n\n## choco install freeSSHD\n## choco install Tunnelier\n\n## choco install jenkins\n\n## choco install rabbitmq\n\n## choco install nginx\n\n## choco install sqlite\n\n## choco install mysql\n## choco install postgresql\n\n## choco install grails\n## choco install scala\n\n## choco install mongodb\n## choco install mongovue" } ]
powershell
chosen
[ { "from": "system", "value": "Use shared folder outside of the VM to store registry-v2 data\n" }, { "from": "human", "value": "mkdir -p C:\\registry-v2\ndocker run --restart=always -d -p 5000:5000 -v \"C:\\registry-v2:C:\\data\" sixeyed/registry:nanoserver\n" }, { "from": "gpt", "value": "if (!(Test-Path C:\\vagrant\\registry-v2)) {\n mkdir -p C:\\vagrant\\registry-v2\n}\ndocker run --restart=always -d -p 5000:5000 -v \"C:\\vagrant\\registry-v2:C:\\data\" sixeyed/registry:nanoserver\n" } ]
powershell
chosen
[ { "from": "human", "value": "Add a simple script to add content at the start of each line of a file\n\n" }, { "from": "gpt", "value": "param (\n [string]$file = $(throw \"-file is required.\"),\n [string]$text = $(throw \"-text is required.\")\n)\n\n$InputFile = Get-Content $file\nForEach($Obj in $InputFile)\n{\n\t$start = $text\n\t$combine = $start + $Obj\n\tAdd-Content -path \"$file-output\" -value $combine\n}" } ]
powershell
chosen
[ { "from": "system", "value": "Add correct path for package\n" }, { "from": "human", "value": "Install-ChocolateyPackage 'deskdrive' 'exe' '/SILENT' 'http://mike-ward.net/content/downloads/deskdrivesetup.exe'\r\n" }, { "from": "gpt", "value": "Install-ChocolateyPackage 'deskdrive' 'exe' '/SILENT' 'https://github.com/mike-ward/DeskDrive/releases/download/v2.1.1/DeskDriveSetup.exe'\r\n" } ]
powershell
chosen
[ { "from": "system", "value": "Fix link to preseason README.md\n" }, { "from": "human", "value": "param($installPath, $toolsPath, $package, $project)\n\n$project.DTE.ItemOperations.Navigate('https://github.com/bitstadium/HockeySDK-Windows-Private/blob/master/README.md')\n" }, { "from": "gpt", "value": "param($installPath, $toolsPath, $package, $project)\n\n$project.DTE.ItemOperations.Navigate('https://github.com/bitstadium/HockeySDK-Windows/blob/preseason/README.md')\n" } ]
powershell
chosen