Skip to content

Instantly share code, notes, and snippets.

using System;
using System.Collections;
using System.Net;
using System.Net.Security;
using System.Net.Sockets;
using System.Security.Authentication;
using System.Security.Cryptography;
using System.Text;
using System.Security.Cryptography.X509Certificates;
using System.IO;
@yuriyostapenko
yuriyostapenko / Some.targets
Created October 30, 2018 09:21
Naive file length enforcement before build
<Project>
<Target Name="DubiksCube" BeforeTargets="Build">
<PropertyGroup>
<DubiksLimit>42</DubiksLimit>
</PropertyGroup>
<ItemGroup>
<FilesWithNames Include="@(Compile)" NameLength="$([System.String]::new('%(Identity)').Length)" />
<FilesWithTooLongNames Include="@(FilesWithNames)" Condition="%(NameLength) &gt; $(DubiksLimit)" />
</ItemGroup>
<Error Condition="'@(FilesWithTooLongNames->Count())' &gt; 0" Text="These file names are too long: @(FilesWithTooLongNames)" />
@yuriyostapenko
yuriyostapenko / ansible-dsc-website-binding.yml
Last active July 13, 2018 09:32
Create IIS Website with http/https bindings with xWebsite using Invoke-DscResource
---
- hosts: <tbd>
tasks:
- name: Configure https binding
win_dsc:
resource_name: xWebsite
Name: "ws2"
Ensure: Present
BindingInfo:
- Protocol: http
@yuriyostapenko
yuriyostapenko / Program.cs
Created June 21, 2017 13:42
Dapper TVP merge
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
using Dapper;
using Microsoft.SqlServer.Server;
namespace ConsoleApp1
{
/* this plugin fixes missing asset caching support in extract-text-webpack-plugin, preventing unnecessary rebuilds */
const { CachedSource, ConcatSource } = require('webpack-sources');
const loaderUtils = require('loader-utils');
module.exports = class {
apply(compiler) {
compiler.plugin("compilation", function (compilation) {
compilation.plugin("optimize-assets", function (assets, callback) {
if (!assets) {