Skip to content

Instantly share code, notes, and snippets.

View vpol's full-sized avatar
🎯
Focusing

Viktor Poluksht vpol

🎯
Focusing
View GitHub Profile
//go:generate go run go.uber.org/mock/mockgen@v0.2.0 -source=source.go -destination=destination.go -package=package_name
@vpol
vpol / gist:d72840301b424970cfce774425b2eb36
Created January 10, 2023 12:24
debezium config with three tables and rerouting with exception of one table
debezium.source.connector.class=io.debezium.connector.postgresql.PostgresConnector
debezium.source.snapshot.mode=never
debezium.source.offset.storage.file.filename=data/offsets.dat
debezium.source.offset.flush.interval.ms=0
debezium.source.topic.prefix=mytopicprefix
debezium.source.database.hostname=%hostname%
debezium.source.database.port=5432
debezium.source.database.user=%database_user%
debezium.source.database.password=%database_pass%
debezium.source.database.dbname=%database_dbname%
@vpol
vpol / docker-compose.yml
Created August 3, 2022 06:15
docker compose example with healthchecks
version: '3.8'
x-common-variables: &common-variables
LOGLEVEL: ${LOGLEVEL:-trace}
TRACING: ${TRACING:-0}
METRICS: ${METRICS:-0}
GODEBUG: ${GODEBUG}
GOGC: ${GOGC}
GIN_MODE: ${GIN_MODE:-debug}
GCLOUD_PROJECT: ${GCLOUD_PROJECT:-local-docker}
@vpol
vpol / estimate.sql
Created July 14, 2022 12:51
Function to estimate BTREE index size based on the table and column(s)
CREATE OR REPLACE FUNCTION f_index_minimum_size(_tbl regclass, _cols VARIADIC text[], OUT estimated_minimum_size bigint)
LANGUAGE plpgsql AS
$func$
DECLARE
_missing_column text;
BEGIN
-- assert
SELECT i.attname
FROM unnest(_cols) AS i(attname)
@vpol
vpol / guide.md
Created June 17, 2022 06:33
Alfred Confluence Integration

Download alfred-confluence.alfredworkflow from https://github.com/mcouthon/alfred-confluence/releases/tag/1.1.0

Double click and install it.

Open alfred search bar and configure:

  1. type confluence, select Set Confluence Base URL and after space paste https://<companyname>.atlassian.net/wiki
  2. type confluence, select Set Confluence Username and after space paste your email in that company
  3. type confluence, select Set Confluence Password and after space paste your API token you generated here
redis-cli --scan --pattern "user:*" | xargs redis-cli del
@vpol
vpol / util.go
Created April 17, 2022 21:45
Generic function with test
package util
import (
"fmt"
"os"
"strconv"
)
func EnvGet[T string | int | int64 | bool](key string, fallback ...T) (result T, err error) {
@vpol
vpol / README.md
Last active July 22, 2022 03:56 — forked from etiennetremel/README.md
Simple Wireguard setup as VPN server and multiple clients

Simple WireGuard configuration

  1. Install Wireguard on all machines.
# apt install wireguard qrencode net-tools
  1. Save postup.sh, postdown.sh, genclient.sh into /etc/wireguard
package main
import (
"fmt"
"regexp"
)
var emailRegex = regexp.MustCompile(`(?m)^(((((((((\s? +)?(\(((\s? +)?(([!-'*-[\]-~]*)|(\\([ -~]|\s))))*(\s? +)?\)))(\s? +)?)|(\s? +))?([A-Za-z0-9!#-'*+\/=?^_\x60{|}~-])+((((\s? +)?(\(((\s? +)?(([!-'*-[\]-~]*)|(\\([ -~]|\s))))*(\s? +)?\)))(\s? +)?)|(\s? +))?)|(((((\s? +)?(\(((\s? +)?(([!-'*-[\]-~]*)|(\\([ -~]|\s))))*(\s? +)?\)))(\s? +)?)|(\s? +))?"((\s? +)?(([!#-[\]-~])|(\\([ -~]|\s))))*(\s? +)?"))?)?(((((\s? +)?(\(((\s? +)?(([!-'*-[\]-~]*)|(\\([ -~]|\s))))*(\s? +)?\)))(\s? +)?)|(\s? +))?<(((((((\s? +)?(\(((\s? +)?(([!-'*-[\]-~]*)|(\\([ -~]|\s))))*(\s? +)?\)))(\s? +)?)|(\s? +))?(([A-Za-z0-9!#-'*+\/=?^_\x60{|}~-])+(\.([A-Za-z0-9!#-'*+\/=?^_\x60{|}~-])+)*)((((\s? +)?(\(((\s? +)?(([!-'*-[\]-~]*)|(\\([ -~]|\s))))*(\s? +)?\)))(\s? +)?)|(\s? +))?)|(((((\s? +)?(\(((\s? +)?(([!-'*-[\]-~]*)|(\\([ -~]|\s))))*(\s? +)?\)))(\s? +)?)|(\s? +))?"((\s? +)?(([!#-[\]-~])|(\\([ -~]|\s))))*(\s? +)?"))@((((((\s? +)?(\(((\s? +)?(([!-'*-[\]-~]*)|(\\([ -~]|\s))))*(\s? +)?\)))(\s? +)?)|(\s? +
- Dad, is it hard to be a software developer?
- Not really Son, it's like riding a bicicle that is burning, and you are burning and everything around is burning and you are in hell.
- Dad, is it hard to ba a project manager?
- Not really Son, it's like sitting in a barell full of shit, and there is a lot of software developers riding a bicecles around, shouting they burn and they are in hell. They burn, you are in a barell full of shit and everyone points a finger at you shouting that you is the one responsible that everything is terrible.
- Dad, os ot hard to be a CTO?
- Yes kid, very hard. You have to constantly add shit to PM's barell and keep the level of shit right at their neck. Set developer's bicicles on fire and keep the developers cycling very hard. And you have to remain clean and good-looking, writing plans to buy new bicecles and fix some barells into your daily planner.