Skip to content

Instantly share code, notes, and snippets.

View lankaapura's full-sized avatar
👨‍💻
_

Priyantha Lankapura lankaapura

👨‍💻
_
View GitHub Profile
@lankaapura
lankaapura / Replace-InvalidFileNameChars.ps1
Last active March 7, 2018 07:43
This will replace invalid characters in filename with a placeholder string. This will help to generate unique filenames.
# based on https://stackoverflow.com/a/15121461
Function Replace-InvalidFileNameChars {
param(
[Parameter(Mandatory=$true,
Position=0,
ValueFromPipeline=$true,
ValueFromPipelineByPropertyName=$true)]
[String]$Name
)
@lankaapura
lankaapura / download_github_release.ps1
Created May 11, 2018 09:15
Download github release artifacts
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Add-Type -AssemblyName System.IO.Compression.FileSystem
$token = Read-Host -Prompt 'Github PAT'
if(!$token) {$token = ""}
$org = Read-Host -Prompt 'Org or User'
if(!$org) {$org = ""}
$repo = Read-Host -Prompt 'Repo'
@lankaapura
lankaapura / package-json-build-number.ps1
Created May 3, 2019 07:28 — forked from ediblecode/package-json-build-number.ps1
Powershell script to parse a package.json version and use as the build number in TeamCity
$version = (Get-Content package.json) -join "`n" | ConvertFrom-Json | Select -ExpandProperty "version"
$buildCounter = "%build.counter%"
$buildNumber = "$version.$buildCounter"
Write-Host "##teamcity[buildNumber '$buildNumber']"
[cmdletbinding()]
param(
[string]$Channel="LTS",
[string]$Version="Latest",
[string]$JSonFile,
[string]$InstallDir="<auto>",
[string]$Architecture="<auto>",
[ValidateSet("dotnet", "aspnetcore", "windowsdesktop", IgnoreCase = $false)]
[string]$Runtime,
[Obsolete("This parameter may be removed in a future version of this script. The recommended alternative is '-Runtime dotnet'.")]