Skip to content

Instantly share code, notes, and snippets.

View shirmanov's full-sized avatar
💭
open to new opportunities

Leonid Shirmanov shirmanov

💭
open to new opportunities
  • RBI Group
  • SPb, Russia
  • 23:16 (UTC +03:00)
View GitHub Profile
@darktempla
darktempla / Vagrantfile
Last active December 23, 2023 21:44
Example of running k0s using vagrant and the k0sctl binary to install on the 2 nodes.
# Defines our Vagrant environment
#
# -*- mode: ruby -*-
# vi: set ft=ruby :
nodeCount = 2
image = "debian/buster64"
ipRangeStart = 40
Vagrant.configure("2") do |config|
@AlexeyRaga
AlexeyRaga / shell.nix
Created June 21, 2021 12:54
Postgres in Nix shell
with import <nixpkgs> {};
let
pg_root = builtins.toString ./. + "/.postgres";
pg_user = "postgres";
pg_db = "service";
pg_bind = "127.0.0.1";
svc_pg_user = "dev";
svc_pg_password = "changeme";
@allanger
allanger / Add Kubernetes roles.md
Last active November 15, 2023 11:39
Add Kubernetes users with Ansible

Add Kubernetes users with Ansible

Hi! In the previous article, I've told how to deploy k8s cluster with ansible. Now I'm going to tell, how to add users to your cluster to be able to control your k8s remotely.

My Github: https://github.com/allanger/kubernetes-rbac-ansible-role

Let's imagine you've deployed a bare-metal cluster and you ssh to the master node every time you wanna do something with it. It's not cool, right? So you need to add a user to your cluster.

You can do it manually but, I think, after the first time you perform it, you'd like to do it automatically. That's why I've created this Ansible role.

@allanger
allanger / Deploy_Kubernetes.md
Last active July 2, 2024 06:58
Deploy Kubernetes with Ansible

Deploy Kubernetes with Ansible

Requirements

We will need at least two nodes, Ansible, and a kubectl. That's enough to begin.

My ansible role: https://github.com/allanger/kubeadm-ansible-role

I am using Ubuntu 21.04 on all my servers so my Ansible role is written for Debian-based distros. (I will be happy if anybody adds support for other distros)

Preparing system

@AlexeyRaga
AlexeyRaga / 1 - MessageCodec.cs
Last active March 8, 2021 14:33
Serialisation stuff
// A Codec interface. Specific _CODECS_ (and not messages)
// should be implementing this interface.
public interface IMessageCodec<T>
{
string Encode(T value);
T Decode(string value);
}
@igiagante-zz
igiagante-zz / .yml
Created February 25, 2021 15:05
Deploy to lightsail from gitlab
deploy_to_lightsail:
stage: deploy
services:
- name: docker:dind
entrypoint: ['env', '-u', 'DOCKER_HOST']
command: ['dockerd-entrypoint.sh']
before_script:
# 1. Install AWSCLIv2 (https://stackoverflow.com/questions/60298619/awscli-version-2-on-alpine-linux#answer-61268529)
@PascalSenn
PascalSenn / MultipartRequestMiddleware
Last active April 7, 2024 20:27
MultiPartRquestMiddlware made with ❤️ by https://github.com/acelot
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Text;
using System.Text.Json;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Newtonsoft.Json;
public Option<ReservationViewModel> AddItemToReservation(string id, string itemId)
{
var reservationOptinal = _restaurant.GetReservation(id);
var itemOptional = _inventory.GetItem(itemId);
return reservationOptinal.Intersect(itemOptional)
.Select(AddItemFunc)
.Select(reservation => (reservation, _ClientsManger.GetUser(reservation.UserId)))
.Select(MapToViewModel);
@Zibri
Zibri / KMS_office.cmd
Created January 18, 2020 15:59 — forked from CHEF-KOCH/KMS_office.cmd
KMS server Windows
@echo off
title Microsoft Office 2019 versions are supported!&cls&echo
============================================================================&echo
#Project: Activating Microsoft software products for FREE without software&echo
============================================================================&echo.&echo
#Supported products:&echo - Microsoft Office Standard 2019&echo - Microsoft Office Professional Plus 2019&echo.&echo.&(if exist
"%ProgramFiles%\Microsoft Office\Office16\ospp.vbs" cd /d "%ProgramFiles%\Microsoft Office\Office16")&(if exist
"%ProgramFiles(x86)%\Microsoft Office\Office16\ospp.vbs" cd /d "%ProgramFiles(x86)%\Microsoft Office\Office16")&(for /f %%x in ('dir /b
..\root\Licenses16\ProPlus2019VL*.xrm-ms') do cscript ospp.vbs /inslic:"..\root\Licenses16\%%x" >nul)&(for /f %%x in ('dir /b
..\root\Licenses16\ProPlus2019VL*.xrm-ms') do cscript ospp.vbs /inslic:"..\root\Licenses16\%%x" >nul)&echo.&echo
@sebmarkbage
sebmarkbage / WhyReact.md
Created September 4, 2019 20:33
Why is React doing this?

I heard some points of criticism to how React deals with reactivity and it's focus on "purity". It's interesting because there are really two approaches evolving. There's a mutable + change tracking approach and there's an immutability + referential equality testing approach. It's difficult to mix and match them when you build new features on top. So that's why React has been pushing a bit harder on immutability lately to be able to build on top of it. Both have various tradeoffs but others are doing good research in other areas, so we've decided to focus on this direction and see where it leads us.

I did want to address a few points that I didn't see get enough consideration around the tradeoffs. So here's a small brain dump.

"Compiled output results in smaller apps" - E.g. Svelte apps start smaller but the compiler output is 3-4x larger per component than the equivalent VDOM approach. This is mostly due to the code that is usually shared in the VDOM "VM" needs to be inlined into each component. The tr