Skip to content

Instantly share code, notes, and snippets.

View dariusz-wozniak's full-sized avatar
🏀

Dariusz Woźniak dariusz-wozniak

🏀
View GitHub Profile
@OnorioCatenacci
OnorioCatenacci / ExecFsx.ps1
Created November 11, 2011 20:11
Quick Powershell Script For Running Fsharp Shell Scripts
#11 November 2011
#ExecFsx.ps1
#Onorio Catenacci
#Insure we get all the error checking from Powershell itself that we can
set-strictmode -version latest
#Set this to point at the location of fsi.exe on your machine.
set-variable -name fsi -value """$env:ProgramFiles\Microsoft F#\v4.0\fsi.exe""" -option constant
#This is where I put all of my .fsx files. Change this to your favorite location
@andrewabest
andrewabest / readme.md
Last active December 3, 2019 13:42
Setting up GitVersion in TeamCity

Project Stuff

Firstly - we will use the CommandLine utility to do our versioning - this lets us check the versioning behaviour locally before pushing, which can be super handy!

Install-Package GitVersion.CommandLine

Then, configure gitversion

.\packages\GitVersion.CommandLine.3.5.2\tools\GitVersion.exe init

@dariusz-wozniak
dariusz-wozniak / new-guid.ps1
Last active January 30, 2020 12:32
Create a new GUID and copy to clipboard with no newlines
[guid]::newguid().ToString() | scb
@andrewabest
andrewabest / ContinuousDeploymentWithGitVersionAndGitFlow.md
Last active October 28, 2020 10:21
How to use GitVersion for semantic versioning with TeamCity and Octopus Deploy

Setting up TeamCity and Octopus with GitVersion

Assumptions

  • You are using GitFlow
  • You want to deploy a new version of your software every time a commit is made to the develop branch
  • You are using Octopack to package your application for deployment

Instructions

using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JsonTest
{
@pmhsfelix
pmhsfelix / gist:4151369
Created November 26, 2012 23:33
Generating and validating JWT tokens using JWTSecurityTokenHandler
[Fact]
public void First()
{
var tokenHandler = new JWTSecurityTokenHandler();
var symmetricKey = GetRandomBytes(256/8);
var now = DateTime.UtcNow;
var tokenDescriptor = new SecurityTokenDescriptor
{
Subject = new ClaimsIdentity(new Claim[]
@dariusz-wozniak
dariusz-wozniak / ShouldAsync.cs
Last active April 5, 2022 10:33
FluentAssertions - Should async
Func<Task> act = async () => await sut.DoSth(null!);
await act.Should().ThrowExactlyAsync<ArgumentNullException>();
@regisdiogo
regisdiogo / Startup.cs
Last active June 13, 2022 11:17
ASP.NET Core - Json serializer settings Enum as string and ignore null values
public class Startup
{
public IServiceProvider ConfigureServices(IServiceCollection services)
{
services.AddMvc().AddJsonOptions(options =>
{
options.SerializerSettings.Converters.Add(new Newtonsoft.Json.Converters.StringEnumConverter());
options.SerializerSettings.NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore;
});
}
@dariusz-wozniak
dariusz-wozniak / search_all.sql
Created July 14, 2022 14:43
SQL: Search all tables and all columns for a specific value
DECLARE @SearchStr nvarchar(100)
SET @SearchStr = '## YOUR STRING HERE ##'
-- Copyright © 2002 Narayana Vyas Kondreddi. All rights reserved.
-- Purpose: To search all columns of all tables for a given search string
-- Written by: Narayana Vyas Kondreddi
-- Site: http://vyaskn.tripod.com
-- Updated and tested by Tim Gaunt
-- http://www.thesitedoctor.co.uk