Skip to content

Instantly share code, notes, and snippets.

View kolosovpetro's full-sized avatar

Petro Kolosov kolosovpetro

View GitHub Profile
@kolosovpetro
kolosovpetro / win_restore.ps1
Last active October 11, 2023 16:35
To restore windows
sfc /scannow
chkdsk C: /f /r /x
chkdsk D: /f /r /x
DISM /Online /Cleanup-Image /CheckHealth
DISM /Online /Cleanup-Image /ScanHealth
DISM /Online /Cleanup-Image /RestoreHealth
DISM /Online /Cleanup-Image /RestoreHealth /Source:F:\Sources\install.wim
@1eedaegon
1eedaegon / install-vmware-player-with-vagrant.ps1
Last active May 20, 2024 04:02
Install vagrant with vmware for windows 11
# 1. Download and install go
https://golang.org/doc/install
# 2. Download and install VMware workstation player
https://www.vmware.com/products/workstation-player.html
# 3. Download and install vagrant
https://www.vagrantup.com/downloads
# 4. Download vagrant vmware utility
@artyomsveshnikov
artyomsveshnikov / server.js
Created August 22, 2021 09:22
Simple server.js for Angular static site
//Install express server
const express = require('express');
const path = require('path');
const app = express();
// Serve only the static files form the dist directory
app.use(express.static(__dirname + '/dist/<appName>'));
app.get('/*', function(req,res) {
@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",
@mauron85
mauron85 / README.md
Last active May 24, 2024 13:46 — 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.
<#
.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
@mosquito
mosquito / README.md
Last active June 17, 2024 20:26
Add doker-compose as a systemd unit

Docker compose as a systemd unit

Create file /etc/systemd/system/docker-compose@.service. 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
@zmts
zmts / tokens.md
Last active June 27, 2024 15:13
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

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

Last major update: 25.08.2020

  • Что такое авторизация/аутентификация
  • Где хранить токены
  • Как ставить куки ?
  • Процесс логина
  • Процесс рефреш токенов
  • Кража токенов/Механизм контроля токенов
@fntlnz
fntlnz / self-signed-certificate-with-custom-ca.md
Last active June 25, 2024 12:19
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

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 genrsa -des3 -out rootCA.key 4096
@dreikanter
dreikanter / encrypt_openssl.md
Last active June 20, 2024 10:15 — 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: