Skip to content

Instantly share code, notes, and snippets.

View centur's full-sized avatar

Alexey Shcherbak centur

View GitHub Profile
@centur
centur / InlineTask.msbuild.xml
Created September 14, 2012 19:16
Sample Msbuild Inline task
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<UsingTask TaskName="SomeFibbonaci" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<FibbonaciSeqLength Required="True" ParameterType="System.Int32"/>
<Result ParameterType="Microsoft.Build.Framework.ITaskItem[]" Output="True"/>
</ParameterGroup>
<Task>
<Reference Include="Microsoft.Build"/>
@centur
centur / msbuildTask.proj.xml
Created September 14, 2012 19:20
Msbuild Inline task usage
<Project ToolsVersion="4.0" DefaultTargets="SomeTarget" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="InlineTask.msbuild.xml" />
<Target Name="SomeTarget">
<SomeFibbonaci FibbonaciSeqLength="10">
<Output TaskParameter="Result" ItemName="Fibbies" />
</SomeFibbonaci>
<Message Text="===================="/>
@centur
centur / Batched.Builds.proj.xml
Created October 12, 2012 08:20
Msbuild batch projects example
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="BatchMyProjects" ToolsVersion="4.0">
<ItemGroup>
<BuildMyProjects Include="XXXX-Project-1" />
<BuildMyProjects Include="XXXX-Project-2" />
</ItemGroup>
<Target Name="BatchMyProjects" >
<ItemGroup>
<ProjectsToBuild Condition="Exists('SomeSourcePath\%(BuildMyProjects.Identity)/%(BuildMyProjects.Identity).csproj')">
@centur
centur / gist:3917864
Created October 19, 2012 11:57
How to build dbproj and sqlproj
<ItemGroup>
<DbProjectToBuild Include="$(CompanySourceFilesPath)\$(DeployDatabaseProjectName)\$(DeployDatabaseProjectName).sqlproj">
<AdditionalProperties>Configuration=$(CompanyBuildConfiguration)</AdditionalProperties>
<AdditionalProperties>OutputPath=$(CompanyBaseOutput)\$(DeployDatabaseProjectName)\</AdditionalProperties>
<AdditionalProperties>TargetDatabase=$(DeployDatabaseName)</AdditionalProperties>
<AdditionalProperties>TargetConnectionString="Data Source=$(DeployDatabaseServer);Integrated Security=True;Pooling=False"</AdditionalProperties>
</DbProjectToBuild>
</ItemGroup>
<MSBuild Projects="%(DbProjectToBuild.Identity)" Targets="Build;Deploy" />
@("marc@blah.com.au","marc2@blah.com.au","marc@kloud.com.au","marc@blah.com.au","marc2@kloud.com.au","marc3@blah.com.au") | `
% { Write-Host "PROCESSING $_" -ForegroundColor red ; $_ } | `
%{if ($_ -match "kloud.com.au") { $i=$true; "Outputting first match $_";continue } }
@centur
centur / SetRoleInstanceStatus.ps1
Created December 7, 2014 23:13
Setting Web\Worker role status to busy with workaround of version issues
# Source from http://itproctology.blogspot.com.au/2014/06/cannot-load-windows-powershell-snap-in.html
# with minor fixes
# Get the current execution path
$exPath = Split-Path -parent $MyInvocation.MyCommand.Definition
$exPath # Echo for logging
######################################################################################
### Before we can load the service runtime, we must fix the broken registry information for the DLL
### and the version must be right, or it will continue to be broken.
@centur
centur / GzipMiddleware.cs
Created September 21, 2015 05:55
Gzip Middleware to compress Swashbuckle SwaggerUI assets
/// <summary>
/// Gzip Middleware to compress Swashbuckle SwaggerUI assets
/// </summary>
public class GzipMiddleware
{
private readonly Func<IDictionary<string, object>, Task> _next;
/// <summary>
/// Ctor
/// </summary>

Just some notes and references for myself.

  • In bash, you can access your C:\ driver via /mnt/c/
  • ~ = C:\Users\MLM\AppData\Local\lxss\home\mlm and is different from your Windows user directory C:\Users\MLM

How to google things

@centur
centur / reclaimWindows10.ps1
Created January 8, 2017 22:32 — forked from alirobe/reclaimWindows10.ps1
"Reclaim Windows 10" turns off a bunch of unnecessary Windows 10 telemetery, removes bloatware, and privacy invasions. Review and tweak before running. Scripts for reversing are included and commented. Fork via https://github.com/Disassembler0 (different defaults)
##########
# Win10 Initial Setup Script
# Author: Disassembler <disassembler@dasm.cz>
# Version: 1.7, 2016-08-15
# dasm's script: https://github.com/Disassembler0/Win10-Initial-Setup-Script/
# THIS IS A PERSONALIZED VERSION
# This script leaves more MS defaults on, including MS security features.
# Tweaked based on personal preferences for @alirobe 2016-11-16 - v1.7.1
@centur
centur / gist:6d586252673a747ce5aade91f8b35731
Created March 20, 2017 23:34 — forked from siacomuzzi/gist:4fa48e32932473348fd2
[AUTH0] ASP.NET Web Api: accept a JWT signed with RS256 algorithm

With Auth0, you can specify the algorithm used to sign your JWT tokens:

So in scenarios when you are signing JWTs with RSRS256 algorithm, you need to perform some changes in your ASP.NET Web Api in order to validate them properly.

NOTE: You can download your .cer file from https://{YOU}.auth0.com/cer endpoint.

ASP.NET Web Api (OWIN)

From app.UseJwtBearerAuthentication method, just replace SymmetricKeyIssuerSecurityTokenProvider with X509CertificateSecurityTokenProvider specifying your public signing key: