Skip to content

Instantly share code, notes, and snippets.

View kolosovpetro's full-sized avatar

Petro Kolosov kolosovpetro

View GitHub Profile
@johnallers
johnallers / gist:1674845
Created January 25, 2012 05:06
Demonstration of the C# compiler using duck typing for the foreach keyword.
namespace Samples
{
using System;
using System.Collections.Generic;
public class CustomEnumerableDemoConsole
{
public static void Main(params string[] args)
{
CustomEnumerable enumerable = new CustomEnumerable("One", "Two", "Three");
@dreikanter
dreikanter / encrypt_openssl.md
Last active August 9, 2025 14:38 — forked from crazybyte/encrypt_openssl.txt
File encryption using OpenSSL

Symmetic encryption

For symmetic encryption, you can use the following:

To encrypt:

openssl aes-256-cbc -salt -a -e -in plaintext.txt -out encrypted.txt

To decrypt:

@fntlnz
fntlnz / self-signed-certificate-with-custom-ca.md
Last active November 18, 2025 16:04
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Last update: Nov 2025.

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl ecparam -genkey -name secp384r1 | openssl ec -aes256 -out rootCA.key
@zmts
zmts / tokens.md
Last active November 25, 2025 17:18
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

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

Last major update: 25.08.2020

  • Что такое авторизация/аутентификация
  • Где хранить токены
  • Как ставить куки ?
  • Процесс логина
  • Процесс рефреш токенов
  • Кража токенов/Механизм контроля токенов
@mosquito
mosquito / README.md
Last active November 11, 2025 15:34
Add doker-compose as a systemd unit

Docker compose as a systemd unit

Create file /etc/systemd/system/[email protected]. SystemD calling binaries using an absolute path. In my case is prefixed by /usr/local/bin, you should use paths specific for your environment.

[Unit]
Description=%i service with docker compose
PartOf=docker.service
After=docker.service
<#
.SYNOPSIS
Uses Win32_Fan class to return information about fans in a system.
.DESCRIPTION
This script first defines some functions to decode various
WMI attributed from binary to text. Then the script calls
Get-WmiObject to retrieve fan details, then formats that
information (using the functions defined at the top of the script.
.NOTES
@marcostolosa
marcostolosa / CloudFlare-API.md
Last active September 29, 2025 13:34
Cloudflare API - Using Cloudflare’s API, you can do just about anything you can do on cloudflare.com via the customer dashboard.

Cloudflare's API Cheat-Sheet

VARIABLE VALUE
EMAIL The email address associated with your Cloudflare account.
KEY The global API key associated with your Cloudflare account.
DOMAIN The name of the domain to create a zone record for.
JUMP_START If true, automatically attempts to fetch existing DNS records when creating a domain’s zone record
ZONE_ID The unique ID of the domain’s zone record. Assigned by Cloudflare. Required when managing an existing zone record and its DNS records.
@joatmon08
joatmon08 / app.tf
Last active November 23, 2024 21:40
Terraform Example for Azure App Gateway & App Service
locals {
app_services = [
{
kind = "Linux"
sku = {
tier = "Standard"
size = "S1"
}
},
{
@mauron85
mauron85 / README.md
Last active July 6, 2024 02:49 — forked from maxfierke/README.md
PM2 as a Windows Service under Local Service

PM2 as a Windows Service under Local Service

This is a PoC for running PM2 as a Windows Service under the Local Service account instead of the Local System account.

Prerequsites

  • Neither pm2 or pm2-windows-service installed yet. (The Powershell script will run npm i)
    • At the very least, you should run pm2-service-uninstall before running this script
  • npm and npm-cache global folders should be somewhere accessible to NT AUTHORITY\LocalService.
@zubair1024
zubair1024 / ecosystem.json
Created December 8, 2019 14:06
Running PM2 as a window service
{
"apps": [
{
"name": "web",
"script": "C:\\ws\\engineer\\titan-web\\app.js",
"args": [],
"cwd": "C:\\ws\\engineer\\titan-web",
"merge_logs": true,
"instances": 1,
"exec_mode": "cluster_mode",