Skip to content

Instantly share code, notes, and snippets.

View patoi's full-sized avatar
👀
...

István Pató patoi

👀
...
View GitHub Profile
@patoi
patoi / list-cmd-name.sh
Created August 13, 2024 14:16
MacOS list command's name by port
sudo lsof -iTCP -sTCP:LISTEN -n -P | awk 'NR>1 {print $9, $1, $2}' | sed 's/.*://' | while read port process pid; do echo "Port $port: $(ps -p $pid -o command= | sed 's/^-//') (PID: $pid)"; done | sort -n
# by Laurie Voss
@patoi
patoi / gh-actions-with-docker-compose.yml
Last active August 9, 2024 15:07 — forked from cecilemuller/example.yml
Run Docker Compose + in Github Action
name: Test
on:
push:
branches:
- main
- features/**
- dependabot/**
pull_request:
branches:
@patoi
patoi / list-binary-git.sh
Created May 9, 2023 10:15
List binary git files for Markdown (or others)
git ls-files --eol | grep -E '^(i/-text)' | grep "\.md"

react+ts+vite+pnpm

pnpm init @vitejs/app app -- --template react-ts
cd app
pnpm install
git init && git add -A && git commit -m "initial commit"
#pnpm run build
pnpm run dev
@patoi
patoi / gist:79f35edc05e73f423db12fd8ef64158f
Last active January 21, 2020 15:22 — forked from yuezhu/gist:47b15b4b8e944221861ccf7d7f5868f5
Generate self-signed certificate for HAProxy
# Generate a unique private key (KEY)
sudo openssl genrsa -out mydomain.key 2048
# Generating a Certificate Signing Request (CSR)
sudo openssl req -new -key mydomain.key -out mydomain.csr
# Creating a Self-Signed Certificate (CRT)
openssl x509 -req -days 365 -in mydomain.csr -signkey mydomain.key -out mydomain.crt
# Append KEY and CRT to mydomain.pem
@patoi
patoi / haproxy.cfg
Created January 21, 2020 15:16
haproxy configuration: SSL termination of the local server – haproxy running in docker container
# If you already have an haproxy.cfg file, you can probably leave the
# global and defaults section as-is, but you might need to increase the
# timeouts so that long-running CLI commands will work.
global
ssl-default-bind-options ssl-min-ver TLSv1.2
ssl-default-bind-ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256
maxconn 4096
# log stdout local0 debug
defaults
@patoi
patoi / signing-commits.md
Last active December 28, 2019 13:23
Signing commits

Generating GPG key

gpg --full-generate-key

Choose default RSA, set to 4096.

Setting git local repo config

gpg --list-secret-keys --keyid-format LONG

@patoi
patoi / docserver.service
Last active August 20, 2024 01:19
Using systemd for nodejs process with nvm
[Unit]
Description=Document Server Daemon
[Service]
Type=forking
Environment=NODE_VERSION=12
WorkingDirectory=/home/your_user/your_node_app_dir
ExecStart=/home/your_user/.nvm/nvm-exec npm start
StandardOutput=
User=your_user
'use strict'
// this is run only on v12, because private field
const ITERATION = 1000
console.log(
process.version,
ITERATION,
'iteration',
'with Type and freeze – v2: v12 only, private field'
'use strict'
const ITERATION = 1000
console.log(
process.version,
ITERATION,
'iteration',
'with Type and freeze – v2: prototype based constructor function'
)