Skip to content

Instantly share code, notes, and snippets.

View Gimly's full-sized avatar

Xavier Hahn Gimly

  • Rollomatic
  • Switzerland
View GitHub Profile
@Gimly
Gimly / azure-pipeline.yml
Last active March 21, 2024 14:50
A sample azure pipeline that creates a nuget package and publish it to Azure DevOps artifacts
trigger:
- master
pool: 'Hosted Windows 2019 with VS2019'
variables:
buildConfiguration: 'Release'
stages:
- stage: build_pack
@Gimly
Gimly / .block
Last active January 1, 2020 11:08
Graph showing links between languages using the expression equivalent to "Greek to me" in each language
license: mit
height: 600
@Gimly
Gimly / Startup.cs
Last active September 5, 2019 07:52
Add authentication with JwtBearer to a .Net Core 2.0 Web API
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.SpaServices.Webpack;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Authentication.JwtBearer;
@Gimly
Gimly / exportGitDiffFilesToZipArchive.ps1
Last active September 8, 2016 12:37
Exports the list of files modified between two commit ids (or tag ids) to a zip archive.
param(
# Git tag or commit has from which we want the patch to start
[String] $FromTag,
# Path of the patch file
[String] $PatchFilePath,
# Git tag or commit hash where to we want the patch to update to (default HEAD, current checkout)
[String] $ToTag = "HEAD"
)
function New-ZipFromFiles (
@Gimly
Gimly / exportDatabaseTableToCsv.psm1
Created April 15, 2016 07:05
PowerShell - Export a database table to a CSV file
<#
.SYNOPSIS
Runs a select with on the specified table with the specified columns
and writes the result to a CSV file.
.DESCRIPTION
This function calls the connection passed as a parameter and sends a
SELECT command to it. The table on which the SELECT is run as well as
the selected columns are passed as a parameter.
[CmdletBinding()]
param(
[Parameter(Mandatory=$True)]
[string]$packageFolder,
[Parameter(Mandatory=$True)]
[string]$releaseFolder,
[Parameter(Mandatory=$True)]
[string]$signCertPassword
)
@Gimly
Gimly / CopyFileAzureBlobStorage.ps1
Created November 13, 2015 15:25
Copy files from an Azure Blob storage container to a local folder
[CmdletBinding()]
param(
[Parameter(Mandatory=$True)]
[string]$ReleaseFolder,
[Parameter(Mandatory=$True)]
[string]$StorageAccountName,
[Parameter(Mandatory=$True)]
[string]$StorageAccountKey,
[Parameter(Mandatory=$True)]
[string]$Container
@Gimly
Gimly / squirrelPackage.nuspec
Created November 13, 2015 14:47
A nuspec file that can be used to generate nuget packages used for Squirrel.Windows
<?xml version="1.0"?>
<package >
<metadata>
<id>ApplicationId</id>
<version>$version$</version>
<authors>Your company name</authors>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Your application description.</description>
<copyright>Copyright 2015</copyright>
</metadata>
[CmdletBinding()]
param(
[Parameter(Mandatory=$True)]
[string]$PfxCertificateFilePath,
[Parameter(Mandatory=$True)]
[string]$SignCertPassword,
[Parameter(Mandatory=$True)]
[string]$ExeFilePath
)
Set-Alias signtool 'C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Bin\SignTool.exe'
# Use a regular expression to get "minor, major, fix, revision" from the BUILD_BUILDNUMBER environment variable
# the build process will automatically set the value of the environment variable to the correct build number
$VersionRegex = "\d+\.\d+\.\d+\.\d+"
$NewVersion = [regex]::matches($Env:BUILD_BUILDNUMBER,$VersionRegex)
Write-Host "Updating version of the application to the build version: " $NewVersion
$file = ".\SharedAssemblyInfo.cs"
$filecontent = Get-Content($file)
attrib $file -r