Skip to content

Instantly share code, notes, and snippets.

View george-polevoy's full-sized avatar

George Polevoy george-polevoy

View GitHub Profile
@george-polevoy
george-polevoy / Publishing a .NET project with Appveyor and NuGet. appveyor.yml
Last active October 19, 2016 12:10
Publishing a .NET project with Appveyor and NuGet. appveyor.yml
# Summary of settings for [Publishing a .NET project with Appveyor and NuGet](http://few-lines-of-code.blogspot.com/2016/03/publishing-net-project-with-appveyor.html) tutorial.
version: debug_01.{branch}_{build}
pull_requests:
do_not_increment_build_number: true
branches:
only:
- /release\/.*/
skip_tags: true
configuration: Release
platform: Any CPU
@george-polevoy
george-polevoy / gist:459530bbb4e6e8bd84fb273e6a4e07ae
Created April 15, 2016 18:05
Few Lines of Code - Appveyor init powershell script
$ErrorActionPreference='Stop';
$branch = $env:APPVEYOR_REPO_BRANCH;
$buildNumber = $env:APPVEYOR_BUILD_NUMBER;
$num = '(0|[1-9]{1}[0-9]{0,})';
$rx = "^[a-z\-]+/v(?'ver'$num\.$num\.$num)(-(?'preSpec'[a-zA-Z]{1,}[0-9]{0,})){0,1}$";
$match = [regex]::match($branch, $rx);
if (!$match.Success)
{
throw "Branch name is not correct semver (1.0.0): " + $branch;
@george-polevoy
george-polevoy / set-url-acl.ps1
Created May 31, 2016 13:57
Parses XML file with urls and sets acl for http bindings. Useful for Visual Studio to debug without admin permissions.
param (
[string]$user
)
# USAGE: & '.\set-url-acl.ps1' -user domain\user
$xmlPath = 'Settings\SomeSettings.xml'
[xml]$xml = Get-Content $xmlPath
$nodes = Select-Xml "//Services/HttpDispatcher" $xml
$nodes | ForEach-Object {
Write-Host "http:/*:$($_.Node.ListenAddress)"
@george-polevoy
george-polevoy / AssemblyInfoPatching.proj
Created May 31, 2016 14:01
Creates AssemblyInfo.cs by template patching for msbuild.
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--
============================================================
RegexTransform
Transforms the input Items parameter by evaluating the
regular expression in their Find metadata and
replacing with their ReplaceWith metadata. Optional, the
<Import Project="$(SolutionDir)\CustomBuildTargets.proj" />
<Import Project="$(SolutionDir)\FormattingInspections.proj" />
<Target Name="BeforeBuild" DependsOnTargets="RunSourceCodeInspections;PerformVersioning">
</Target>
@george-polevoy
george-polevoy / FormattingInspections.proj
Created May 31, 2016 14:05
Code formatting inspections for line endings and unicode local alphabet for msbuild.
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<TasksDllPath Condition="'$(MSBuildToolsVersion)' == '14'">$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll</TasksDllPath>
<TasksDllPath Condition="'$(MSBuildToolsVersion)' != '14'">$(MSBuildToolsPath)\Microsoft.Build.Tasks.v$(MSBuildToolsVersion).dll</TasksDllPath>
</PropertyGroup>
<UsingTask TaskName="InspectSourceCode"
TaskFactory="CodeTaskFactory"
AssemblyFile="$(TasksDllPath)">
<ParameterGroup>
@george-polevoy
george-polevoy / Fixed Thread Pool.cs
Last active June 3, 2016 18:13
Toy implementation of fixed thread pool
void Main()
{
long countDone = 0;
using (var pool = new FixedThreadPool(16))
{
pool.WaitForThreadInitialization();
var totalDepth = 9;
var total = (2L << totalDepth) - 1;
@george-polevoy
george-polevoy / Feed Forward basic routine
Created January 23, 2021 22:37
Simple Neural Network routine
public double[] FeedForward(double[] inputs)
{
for (int i = 0; i < inputs.Length; i++)
{
neurons[0][i] = inputs[i];
}
for (int i = 1; i < layers.Length; i++)
{
for (int j = 0; j < neurons[i].Length; j++)
@george-polevoy
george-polevoy / index.html
Created January 5, 2022 18:25
SVG Filters
<svg width="100%" height="100%"
xmlns="http://www.w3.org/2000/svg">
<filter id="reshape">
<feGaussianBlur stdDeviation="30"/>
<feComponentTransfer>
<feFuncA type="linear" slope="30.0" intercept="-10"/>
</feComponentTransfer>
</filter>
<g id="targetGroup" style="filter: url(#reshape);">
@george-polevoy
george-polevoy / FieldList.cs
Created September 7, 2022 17:00
SpanResultingFromStructRef
using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Explicit)]
struct FieldList
{
[FieldOffset(0)] private int _item0;
[FieldOffset(4)] private int _item1;
[FieldOffset(8)] private int _item2;
[FieldOffset(12)] private int _item3;