Skip to content

Instantly share code, notes, and snippets.

View rdeak's full-sized avatar

Robert Deak rdeak

  • Zagreb, Croatia
  • 07:05 (UTC +02:00)
View GitHub Profile
@rdeak
rdeak / nvm.md
Created May 19, 2025 13:56
How to upgrade node version and install pnpm

How to install latest node version with NVM

nvm install 24
nvm alias default 24
node -v
corepack enable
npm install -g corepack
pnpm -v
@rdeak
rdeak / ec2-docker-swarm.sh
Last active July 24, 2024 21:20
Docker swarm on EC2
#!/bin/sh
set -e
sudo dnf install -y docker
sudo usermod -a -G docker ec2-user
newgrp docker
sudo systemctl start docker
sudo systemctl enable docker
@rdeak
rdeak / css_snippets.css
Last active February 9, 2024 13:44
CSS snippets
/* Backgrounds */
.full-background-whithout-wrapper {
border-image: conic-gradient(pink 0 0) fill 0//0 100vw;
}
/* Overlay */
.overlay {
border-image: fill 0 linear-gradient(#0003,#000);
}
@rdeak
rdeak / workbook.sql
Created January 26, 2024 15:07
Find Postgres locks
-- inspect locks
WITH sos AS (
SELECT array_cat(array_agg(pid),
array_agg((pg_blocking_pids(pid))[array_length(pg_blocking_pids(pid),1)])) pids
FROM pg_locks
WHERE NOT granted
)
SELECT a.pid, a.usename, a.datname, a.state,
a.wait_event_type || ': ' || a.wait_event AS wait_event,
current_timestamp-a.state_change time_in_state,
@rdeak
rdeak / bash-best-pracitces.sh
Last active November 8, 2022 10:30
Best practices for writing bash scripts
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
if [[ "${TRACE-0}" == "1" ]]; then
set -o xtrace
fi
if [[ "${1-}" =~ ^-*h(elp)?$ ]]; then
@rdeak
rdeak / commit-message.md
Created April 22, 2021 07:47
Rules for structuring commit messages

Rules for comit message

Format

<type> [scope]: "Message"

Type

Type must be one of the following mentioned below :

@rdeak
rdeak / docker-compose.yml
Created February 19, 2021 20:21
List of popular server images
version: '2.4'
volumes:
esdata:
driver: local
networks:
backend:
driver: bridge

How to find listening port

sudo lsof -i -P -n | grep LISTEN

How to find process by name

pidof node

Encode string to base64 in Node.js

Buffer.from('ta-da').toString('base64')
\set COMP_KEYWORD_CASE upper
\x auto
\pset null ¤