Skip to content

Instantly share code, notes, and snippets.

@jernejg
jernejg / pretxncommit.ps1
Last active December 26, 2015 14:29
Prevent large file commits with PowerShell and Mercurial hooks
function Get-HgAddedLargeFile
{
process
{
return ForEach-Object {$_.Insert(1,",").Remove(2,1)} `
| ConvertFrom-Csv -Header Status,Path `
| Where-Object {$_.Status -ieq "A"} `
| Get-Item `
| Where-Object {$_.Length -gt 1MB}
}
[system.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms");
function Get-HgAddedLargeFile
{
process
{
return ForEach-Object {$_.Insert(1,",").Remove(2,1)} `
| ConvertFrom-Csv -Header Status,Path `
| Where-Object {$_.Status -ieq "A"} `
| Get-Item `
@jernejg
jernejg / TeamCityPendingChanges.ps1
Created September 15, 2017 12:43
Powershell script that queries TeamCity for pending changes and generates a html release file with author, number of files changed, git comment and urls to matched Jira issues.
param(
[string]$TC, #%teamcity.serverUrl%
[string]$TC_build_Id, #system.teamcity.buildType.id
[string]$outputFileName) #Output file name
$TC += "/guestAuth" #TeamCity needs to be running with the guest account enabled.
$url = "$($TC)/app/rest/changes?locator=buildType:(id:$($TC_build_Id)),pending:true" #Get pending changes for a build configuration
$JiraUrl = "http://yourjiraurl.com/"
function GetChangeDetailsUrl($changesXml)

Keybase proof

I hereby claim:

  • I am jernejg on github.
  • I am jernejg (https://keybase.io/jernejg) on keybase.
  • I have a public key ASA-ZTwAvJZlLNM3Gsna_F3bS9CakHlNlIvaXsLhQMoA2go

To claim this, I am signing this object: