Skip to content

Instantly share code, notes, and snippets.

@colindooley11
colindooley11 / armDeploy.ps1
Created April 7, 2022 15:27
#az cli #azure cmdlets #ARM deployment
az deployment group create --name "testfrauddeploy" --resource-group "Fraud" --template-file .\template.json --parameters .\parameters.componentTest.json
@colindooley11
colindooley11 / ConvertToBin
Created February 15, 2022 15:22
Convert to binary string hack #Codewars #interview
using System;
public static class Kata
{
public static string AddBinary(int a, int b) =>
Convert.ToString(a + b, 2);
}
@colindooley11
colindooley11 / UniqueInOrder.cs
Created February 8, 2022 21:37
#UniqueInOrder #codewars
// Mine
using System.Collections.Generic;
using System.Linq;
public static class Kata
{
public static IEnumerable<T> UniqueInOrder<T>(IEnumerable<T> iterable)
{
var output = new List<T>();
T newItem = default(T);
@colindooley11
colindooley11 / LevenshteinDistance.cs
Created February 3, 2022 22:55
#LevenshteinDistance #MatrixComparison #CodeWars
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
public class Kata
{
private IEnumerable<string> words;
public Kata(IEnumerable<string> words)
@colindooley11
colindooley11 / BitShiftIPAddress.cs
Last active February 3, 2022 22:56
#IPAddress different #octets #bitshifting #bitwiseor #codewars
using System;
using System.Linq;
public class CountIPAddresses
{
public static long IpsBetween(string s, string e)
{
var start = s.Split('.').Select(x=> Convert.ToInt32(x)).ToArray();
var end = e.Split('.').Select(x=> Convert.ToInt32(x)).ToArray();
var startAcc = start[0] << 24 | start[1] << 16 | start[2] << 8 | start[3];
@colindooley11
colindooley11 / git.config rebase etc VsCode
Created January 27, 2022 16:29
Git configuration (diff, merge and interactive rebase) #git #gitconfig #git.config
[user]
name = Colin Dooley
email = colind@asos.com
[alias]
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
[core]
# Make sure that interactive rebases open correctly with vs code
editor = code -w -n
ignorecase = false
[diff]
@colindooley11
colindooley11 / mongospecificpriority.js
Created September 15, 2020 15:54
Set priorites for Mongo Replica Set #mongo #replicaset
conf = rs.conf()
conf.members[4].priority = 15.0
rs.reconfig(conf)
//rs.stepdown() if needed
@colindooley11
colindooley11 / setandgetcompat.js
Created September 2, 2020 12:27
Mongo compatibility #mongo #mongo-upgrade
db.adminCommand( { setFeatureCompatibilityVersion: "3.4" } )
db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } )
@colindooley11
colindooley11 / getLogMongo.js
Created September 2, 2020 08:05
Mongo getgLogb #mongo
db.adminCommand( { getLog: "global" } )
namespace Asos.Finance.Payments.PayPal.EndToEndTests.Framework.MessageTesting
{
using System;
using System.Reactive.Linq;
using System.Reactive.Subjects;
using System.Threading.Tasks;
public class Observer
{
private static readonly ReplaySubject<object> MessageObservable = new ReplaySubject<object>();