Skip to content

Instantly share code, notes, and snippets.

View zihotki's full-sized avatar

Vasili Puchko zihotki

  • Infront ASA
  • Amsterdam, Netherlands
View GitHub Profile
@zihotki
zihotki / gist:3881fe398f83dc2097c04f0233e56a9c
Created March 23, 2018 22:16
asp.net core reverse proxy
Install the Add the Microsoft.AspNet.HttpOverrides package
In your Configure() method add
app.UseOverrideHeaders(new OverrideHeaderMiddlewareOptions
{
ForwardedOptions = ForwardedHeaders.XForwardedFor |
ForwardedHeaders.XForwardedProto
});
@zihotki
zihotki / PerMinuteInExcessOf.cs
Created August 11, 2022 00:41 — forked from nblumhardt/PerMinuteInExcessOf.cs
Proof of concept rate limiting filter for Serilog
using System;
using Serilog;
using Serilog.Configuration;
namespace ConsoleApplication8
{
static class Program
{
static void Main()
{
import FileHound from "filehound";
import { promises as fs } from "fs";
import path from "path";
import { promisify } from "util";
//
// const packages = await FileHound.create()
// .paths(`packages`)
// .directory()
// .depth(1)
// .find();
@zihotki
zihotki / Angular 14+ async validator with de-bounce.ts
Created August 21, 2023 11:39
Angular 14+ async validator with de-bounce
employerCodeExists(): AsyncValidatorFn {
return (control: AbstractControl): Observable<ValidationErrors | null> => {
const hasEmployerCode = this.hasEmployerCodeFormControl.value;
const controlValue: string = control.value;
// Note: see https://stackoverflow.com/questions/36919011/how-to-add-debounce-time-to-an-async-validator-in-angular-2/62662296#62662296
// for explanation of why this is the most correct way to do async validation with debounce
if (hasEmployerCode && controlValue) {
return of(controlValue)
.pipe(
@zihotki
zihotki / export-multiple-parts.py
Created September 12, 2023 10:54
freecad export multiple parts
from PySide import QtGui
folder = str(QtGui.QFileDialog.getExistingDirectory(None, "Select Directory"))
a = Gui.Selection.getSelection()
count = 0
import ImportGui
options = None
if hasattr(ImportGui, "exportOptions"):
options = ImportGui.exportOptions(".step")
for b in a:
objs = []
@zihotki
zihotki / TFSBuildVarsDebug.ps1
Created October 9, 2023 00:09 — forked from heiswayi/TFSBuildVarsDebug.ps1
List all TFS built-in variables for Team Foundation Build (vNext) using PowerShell script
Write-Host "SYSTEM_TEAMPROJECT: $ENV:SYSTEM_TEAMPROJECT"
Write-Host "SYSTEM_TEAMFOUNDATIONSERVERURI: $ENV:SYSTEM_TEAMFOUNDATIONSERVERURI"
Write-Host "SYSTEM_TEAMFOUNDATIONCOLLECTIONURI: $ENV:SYSTEM_TEAMFOUNDATIONCOLLECTIONURI"
Write-Host "SYSTEM_COLLECTIONID: $ENV:SYSTEM_COLLECTIONID"
Write-Host "SYSTEM_DEFAULTWORKINGDIRECTORY: $ENV:SYSTEM_DEFAULTWORKINGDIRECTORY"
Write-Host "BUILD_DEFINITIONNAME: $ENV:BUILD_DEFINITIONNAME"
Write-Host "BUILD_DEFINITIONVERSION: $ENV:BUILD_DEFINITIONVERSION"
Write-Host "BUILD_BUILDNUMBER: $ENV:BUILD_BUILDNUMBER"
Write-Host "BUILD_BUILDURI: $ENV:BUILD_BUILDURI"
Write-Host "BUILD_BUILDID: $ENV:BUILD_BUILDID"