Skip to content

Instantly share code, notes, and snippets.

View ilyushchenko's full-sized avatar

Pavel Ilyushchenko ilyushchenko

  • Saint-Petersburg
View GitHub Profile
@ilyushchenko
ilyushchenko / Install-PowerShellService.ps1
Created July 11, 2022 15:34 — forked from fireflycons/Install-PowerShellService.ps1
Script to install a PowerShell script as a Windows Service using NSSM
<#
.SYNOPSIS
Installs PowerShell scripts as Windows Services.
.DESCRIPTION
Installs or removes PowerShell script services.
When installing, any additional command line arguments besides the mandatory ones are supplied as arguments to the script you are installing, and credentials for the service will be prompted for.
The service will be installed for automatic start, however the initial state is 'Stopped'
This tool will additionally pass the switch -Service to the target script which it should implement to know it is running as a service.
@ilyushchenko
ilyushchenko / README.md
Created January 17, 2021 00:03
How to Bootcamp / Dual Boot Windows 10 on a mid-2011 iMac using USB

How to Install / Bootcamp Windows 10 on a mid-2011 iMac using USB

Apple has released support for bootcamping Windows 10, but only on 2012 Macs and later. Despite not being supported. it is possible to install Windows 10 on earlier iMacs and it seems to run quite well.

IMPORTANT: Unplug all external and physical hard drives (where possible) that you won't be installing to to avoid accidentally erasing them. Also make note of which drives and partitions remain (e.g. System and Storage hard drives), and be super careful to not erase the wrong one.

RECOVERY: If you nuke your machine, restore your time machine backup. Instructions here.

Requirements

@ilyushchenko
ilyushchenko / nlog colored console files
Created January 4, 2021 18:51 — forked from clupasq/nlog colored console files
nlog configuration for colored console + info&error files
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<targets>
<target name="coloredConsole" xsi:type="ColoredConsole" useDefaultRowHighlightingRules="false"
layout="${longdate}|${pad:padding=5:inner=${level:uppercase=true}}|${message}" >
<highlight-row condition="level == LogLevel.Debug" foregroundColor="DarkGray" />
<highlight-row condition="level == LogLevel.Info" foregroundColor="Gray" />
<highlight-row condition="level == LogLevel.Warn" foregroundColor="Yellow" />
@ilyushchenko
ilyushchenko / deployProd.md
Created October 6, 2020 21:35 — forked from zmts/deployProd.md
Размещение Node.js приложения в продакшин среде (deploy)

Размещение Node.js приложения в продакшин среде

  • deploy-srv - Сервер автодеплоя
  • deploy-url - Домен/url рамещения сервера автодеплоя (deploy.super.com, super.com\api\deploy)
  • vcs - (github, gitlab, bitbucket ...)

Flow процесса деплоя

Предварительно регистрируем git webhook на deploy-url в вашем vcs

  1. Программист делает git push
  2. vcs дергает хук который в свою очередь обращается к POST deploy-url
@ilyushchenko
ilyushchenko / debian_do.md
Created October 6, 2020 21:28 — forked from zmts/debian_do.md
Первичная настойка Debian Linux/Разворачиваем серверную инфраструктуру на Digital ocean

Первичная настойка Debian Linux/Разворачиваем серверную инфраструктуру на Digital ocean

Для проектов среднего и небольшого размера не всегда оправданно использовать AWS/Kubernetes подобную технологию. Для проектов нуждающихся в нескольких серверах отлично подходит Digital ocean. Который к тому же предоставляет средства вертикального скейлинга(увеличение производительной мощности уже существующих серверов).

SSH cертификат

Создаем сертификат под которым будем логинится на сервера нашего проекта (на локальной машине)

ssh-keygen -t rsa -b 4096 -f /Users/alex/.ssh/myproject_test -C "myproject comment"

Не забываем сделать его бекап

@ilyushchenko
ilyushchenko / tokens.md
Created October 6, 2020 19:51 — forked from zmts/tokens.md
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Last major update: 25.08.2020

  • Что такое авторизация/аутентификация
  • Где хранить токены
  • Как ставить куки ?
  • Процесс логина
  • Процесс рефреш токенов
  • Кража токенов/Механизм контроля токенов
@ilyushchenko
ilyushchenko / SimpleHTTPServer.cs
Created July 30, 2019 19:56 — forked from aksakalli/SimpleHTTPServer.cs
SimpleHTTPServer in C#
// MIT License - Copyright (c) 2016 Can Güney Aksakalli
// https://aksakalli.github.io/2014/02/24/simple-http-server-with-csparp.html
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Sockets;
using System.Net;
using System.IO;
@ilyushchenko
ilyushchenko / simplex.cs
Created June 2, 2019 20:21 — forked from trevordixon/simplex.cs
Simplex maximization algorithm in C#
using System;
using System.Diagnostics;
using System.Collections.Generic;
namespace Simplex {
class Simplex {
private double[] c;
private double[,] A;
private double[] b;
private HashSet<int> N = new HashSet<int>();