Skip to content

Instantly share code, notes, and snippets.

View svoychik's full-sized avatar
:octocat:

Serhii Voichyk svoychik

:octocat:
View GitHub Profile
namespace ConsoleApp3;
public class GroupDistributor
{
record Person(string Name);
//(user1, user2) how many times user1 and user2 met before
Dictionary<(string, string), int> Intersections { get; set; } = new();
public (List<string> GroupA, List<string> GroupB) Divide(List<string> people, string lead1, string lead2)
{
"description": "Windows-like Home/End on Mac",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "home",
"modifiers": {
"optional": ["any"]
}
@svoychik
svoychik / battleship.cs
Last active December 8, 2022 17:44
Battleship game
var board = new Board(10, 10);
board.SetShip(new Point(5, 5), Positioning.Horizontal, 1);
board.SetShip(new Point(0, 1), Positioning.Horizontal, 1); //not valid
board.SetShip(new Point(5, 4), Positioning.Vertical, 4);// not valid because it's already busy
board.SetShip(new Point(9, 3), Positioning.Horizontal, 3);
board.Shoot(new Point(8, 3));
board.Shoot(new Point(9, 3));
board.Shoot(new Point(7, 3));
@svoychik
svoychik / grokking_to_leetcode.md
Created July 9, 2022 19:22 — forked from tykurtz/grokking_to_leetcode.md
Grokking the coding interview equivalent leetcode problems

GROKKING NOTES

I liked the way Grokking the coding interview organized problems into learnable patterns. However, the course is expensive and the majority of the time the problems are copy-pasted from leetcode. As the explanations on leetcode are usually just as good, the course really boils down to being a glorified curated list of leetcode problems.

So below I made a list of leetcode problems that are as close to grokking problems as possible.

Pattern: Sliding Window

Unhandled Exception: Interop+AppleCrypto+AppleCommonCryptoCryptographicException: Unknown format in import.
at Interop.AppleCrypto.X509ImportCertificate(Byte[] bytes, X509ContentType contentType, SafePasswordHandle importPassword, SafeKeychainHandle keychain, Boolean exportable, SafeSecIdentityHandle& identityHandle)
at Internal.Cryptography.Pal.CertificatePal.FromBlob(Byte[] rawData, SafePasswordHandle password, X509KeyStorageFlags keyStorageFlags)
at System.Security.Cryptography.X509Certificates.X509Certificate..ctor(String fileName, String password, X509KeyStorageFlags keyStorageFlags)
at System.Security.Cryptography.X509Certificates.X509Certificate2..ctor(String fileName, String password, X509KeyStorageFlags keyStorageFlags)
at Xero.Api.Infrastructure.Authenticators.PrivateAuthenticator..ctor(String certificatePath, String certificatePassword) in /Users/delored/Downloads/Xero-NetStandard-master/Xero.Api/Infrastructure/Authenticators/PrivateAuthenticator.cs:line 22
at Xero.Api.Infrastructure.Ap
public class ExceptionHandlingAttribute : ExceptionFilterAttribute
{
public override void OnException(HttpActionExecutedContext context)
{
var logger = context.Request.GetDependencyScope().GetService(typeof(ILogger)) as ILogger;
var errorManager = context.Request.GetDependencyScope().GetService(typeof(ErrorManager)) as ErrorManager;
if (context.Exception is ApiRestrictionException)
{
//....
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Runtime.Caching;
using System.Runtime.Caching.Configuration;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
using ProtoBuf;