Skip to content

Instantly share code, notes, and snippets.

@deploy595
deploy595 / colors.sh
Created July 11, 2025 03:44 — forked from DevGW/colors.sh
ANSI terminal color codes #ANSI
\033[XXm
30 black 90 gray
31 red 91 bright red
32 green 92 bright green
33 yellow 93 bright yellow
34 blue 94 bright blue
35 magenta 95 bright magenta
36 cyan 96 bright cyan
37 white 97 bright white
@deploy595
deploy595 / main.md
Last active June 8, 2025 06:53
Block all outgoing connections from inside a docker container except http(s) and smtp using firewalld (fixin' Hetzner netscan abuse)

Install, start and enable:

  apt install firewalld
  systemctl start firewalld 
  systemctl enable firewalld

Make sure the file /etc/docker/daemon.json does not contain this line. If it does, delete/comment it. If the file is missing, it is OK, you can skip the step:

{
@deploy595
deploy595 / Tickets.sql
Last active June 8, 2025 06:56
sql.sql
# Two SQL queries. One built using ActiveRecord, the other - manually assembled.
# Both return the same result.
# Each table has 500 thousand and a million records respectively (Ticket has many Messages).
# The first query works 10 times slower.
#
# 1) Active Record
# 130 rows retrieved starting from 1 in 645 ms (execution: 635 ms, fetching: 10 ms)
# 130 rows retrieved starting from 1 in 623 ms (execution: 611 ms, fetching: 12 ms)
# 130 rows retrieved starting from 1 in 640 ms (execution: 631 ms, fetching: 9 ms)