Skip to content

Instantly share code, notes, and snippets.

View centur's full-sized avatar

Alexey Shcherbak centur

View GitHub Profile
@centur
centur / gist:4aa7becf9e6eb37f6eb96252d27f87c3
Created December 6, 2017 22:07
Visual Studio and R# versions and details as per 7/12/2017
========================================= VS info
Microsoft Visual Studio Community 2017
Version 15.5.0
VisualStudio.15.Release/15.5.0+27130.0
Microsoft .NET Framework
Version 4.7.02556
Installed Version: Community
@centur
centur / HardenSSL.ps1
Created August 7, 2017 06:12 — forked from SidShetye/HardenSSL.ps1
Script to harden SSL/TLS on Azure Cloud Service
# Call this from inside a startup task/batch file as shown in the next two lines (minus the '# ')
# PowerShell -ExecutionPolicy Unrestricted .\DisableSslV3.ps1 >> log-DisableSslV3.txt 2>&1
# EXIT /B 0
# Credits:
# http://azure.microsoft.com/blog/2014/10/19/how-to-disable-ssl-3-0-in-azure-websites-roles-and-virtual-machines/
# http://lukieb.blogspot.com/2014/11/tightening-up-your-azure-cloud-service.html
$nl = [Environment]::NewLine
$regkeys = @(
@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:

@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

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 / 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>
@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.
@("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 / 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" />
@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')">