Skip to content

Instantly share code, notes, and snippets.

@gsoulavy
gsoulavy / docker-api-port.md
Created January 25, 2022 14:16 — forked from styblope/docker-api-port.md
Enable TCP port 2375 for external connection to Docker

Enable TCP port 2375 for external connection to Docker

See this issue.
Docker best practise to Control and configure Docker with systemd.

  1. Create daemon.json file in /etc/docker:

     {"hosts": ["tcp://0.0.0.0:2375", "unix:///var/run/docker.sock"]}
    
@gsoulavy
gsoulavy / .ideavimrc
Created November 25, 2021 11:51
.ideavimrc
set easymotion
set relativenumber
set number
set clipboard+=unnamedplus
set ignorecase
set surround
set ideajoin
sethandler <C-U> n-v:vim i:ide
sethandler <C-K> n:vim i-v:ide
sethandler <C-D> n:vim i-v:ide
[user]
name = Gab Soulavy
email = XXX-gsoulavy@users.noreply.github.com
signingKey = xxx
[core]
autocrlf = input
fileMode = false
[alias]
last = log -1 HEAD
alias = config --get-regexp ^alias\\.
@gsoulavy
gsoulavy / Mockogger.cs
Last active October 13, 2021 15:49
MockLogger for assertions of Microsoft.Extensions.Logger
public abstract class MockLogger<T> : ILogger<T>
{
void ILogger.Log<TState>(
LogLevel logLevel,
EventId eventId,
TState state,
Exception exception,
Func<TState, Exception, string> formatter)
=> Log(logLevel, formatter(state, exception));
@gsoulavy
gsoulavy / CompressUtil.cs
Last active July 10, 2020 13:22
SharpZipLib
using ICSharpCode.SharpZipLib.Zip
using ICSharpCode.SharpZipLib.Zip.Compression
using ICSharpCode.SharpZipLib.Zip.Compression.Streams
using System.Threading.Tasks
public class CompressUtil
{
public static async Task<byte[]> DecompressData(byte[] bytes)
{
using var stream = new InflaterInputStream(new MemoryStream(bytes));
@gsoulavy
gsoulavy / lz77.cs
Created June 8, 2020 14:53 — forked from mjs3339/lz77.cs
C# Implementation LZ77 Compression Algorithm
public static class Lz77
{
private const int RingBufferSize = 4096;
private const int UpperMatchLength = 18;
private const int LowerMatchLength = 2;
private const int None = RingBufferSize;
private static readonly int[] Parent = new int[RingBufferSize + 1];
private static readonly int[] LeftChild = new int[RingBufferSize + 1];
private static readonly int[] RightChild = new int[RingBufferSize + 257];
private static readonly ushort[] Buffer = new ushort[RingBufferSize + UpperMatchLength - 1];
@gsoulavy
gsoulavy / launch.json
Created May 12, 2020 13:39 — forked from drejohnson/launch.json
webpack-dev-server integration with vscode and typescript for react
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Debug",
@gsoulavy
gsoulavy / Program.cs
Last active March 14, 2024 03:02
INotifyPropertyChanged implemented via Castle DynamicProxy
public class Program
{
private string lastPropertyToChange;
void Main()
{
var model = new AutoNotifyPropertyChangedProxyCreator().Create<Person>();
model.PropertyChanged += (o, e) => lastPropertyToChange = e.PropertyName;
model.Name = "Harold";
model.Name = "James";