Skip to content

Instantly share code, notes, and snippets.

View AlexeySetevoi's full-sized avatar

AlexeySetevoi

  • Cyprus, Limassol
View GitHub Profile
@AlexeySetevoi
AlexeySetevoi / rancher_desktop_wsl.md
Created February 24, 2026 11:46 — forked from fike/rancher_desktop_wsl.md
Issues to run Rancher Desktop on WSL2

Debian and derivates on WSL2 (Windows 11) can have issues running docker distributed by Rancher Desktop. If you have error messages like the below, install dependencies to fix that.

"docker-credential-secretservice: error while loading shared libraries: libsecret-1.so.0" or "error getting credentials - err: exit status 1, out: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.secrets was not provided by any .service files"

or that

"error getting credentials - err: exit status 1, out: `Failed to execute child process "dbus-launch"

@AlexeySetevoi
AlexeySetevoi / git-clean-local-branches.sh
Created July 23, 2025 14:12
Removes local branches that no longer exist on origin
#!/bin/bash
echo "Fetching latest information from origin..."
git fetch origin --prune
echo ""
echo "Identifying local branches that no longer exist on origin..."
# Get a list of local branches
LOCAL_BRANCHES=$(git branch --list | sed 's/\* //g' | sed 's/ //g')
@AlexeySetevoi
AlexeySetevoi / daemon.json
Created June 20, 2025 14:20 — forked from b4tman/daemon.json
docker registry mirrors (/etc/docker/daemon.json) + podman (/etc/containers/registries.conf)
{
"registry-mirrors" : [
"https://cr.yandex/mirror",
"https://dockerhub.timeweb.cloud",
"https://huecker.io",
"https://noohub.ru",
"https://dcr-px.ru",
"https://mirror.gcr.io",
"https://quay.io",
"https://registry.access.redhat.com",
@AlexeySetevoi
AlexeySetevoi / alertmanager.yml
Last active October 16, 2022 21:39
Alertmanager 0.24.0 telegram receiver send example
route:
group_by: [ 'job', 'alertname', 'priority' ]
group_wait: 30s
group_interval: 5m
repeat_interval: 12h
receiver: 'telegram'
routes:
- receiver: 'null'
matchers:
- alertname =~ "InfoInhibitor|Watchdog"
@AlexeySetevoi
AlexeySetevoi / answers.yml
Last active February 5, 2022 02:08
Running gitlab runner in own-hosted kubernetes via official chart, with separate dind deployment and transparent injection DOCKER_HOST in runner pod. Require to enable podpreset alpha api.
## GitLab Runner Image
##
## By default it's using gitlab/gitlab-runner:alpine-v{VERSION}
## where {VERSION} is taken from Chart.yaml from appVersion field
##
## ref: https://hub.docker.com/r/gitlab/gitlab-runner/tags/
##
# image: gitlab/gitlab-runner:alpine-v12.1.0
## Specify a imagePullPolicy
openssl pkcs12 -export -out domain.p12 -inkey privkey.pem -in cert.pem -certfile chain.pem
openssl pkcs12 -export -out domain.p12 -inkey privkey.pem -in fullchain.pem
awk -vDate=`date -d'now-24 hours' +[%d/%b/%Y:%H:%M:%S` ' { if ($4 > Date) print Date FS $4,$7}' access.log |grep aaa > similar24.txt
https://stackoverflow.com/questions/7706095/filter-log-file-entries-based-on-date-range
@AlexeySetevoi
AlexeySetevoi / statistics.sql
Created March 8, 2018 14:33 — forked from ruckus/statistics.sql
Postgres statistics queries
** Find commmonly accessed tables and their use of indexes:
SELECT relname,seq_tup_read,idx_tup_fetch,cast(idx_tup_fetch AS numeric) / (idx_tup_fetch + seq_tup_read) AS idx_tup_pct FROM pg_stat_user_tables WHERE (idx_tup_fetch + seq_tup_read)>0 ORDER BY idx_tup_pct;
Returns output like:
relname | seq_tup_read | idx_tup_fetch | idx_tup_pct
----------------------+--------------+---------------+------------------------
schema_migrations | 817 | 0 | 0.00000000000000000000
user_device_photos | 349 | 0 | 0.00000000000000000000
@AlexeySetevoi
AlexeySetevoi / build-nginx-geoip2-deb.sh
Last active April 17, 2020 11:33
nginx geoip2 debian
#!/bin/bash
nginxver=`apt show nginx-full |grep Version | awk '{print $2}' |awk -F '-' '{print $1}'`
nginxname=nginx-$nginxver.tar.gz
nginxdir=nginx-$nginxver
#apt -y install libmaxminddb0 libmaxminddb-dev mmdb-bin
if [ -f "$nginxname" ]
@AlexeySetevoi
AlexeySetevoi / attr.sql
Last active April 17, 2017 14:02
mysql pivot attr reverse(also now as pivot-table) as view
SET @sql = NULL;
SET @sourcetable = 'Table';
set @viewname = CONCAT(@sourcetable,'F');
SET @@group_concat_max_len = 10000;
SELECT GROUP_CONCAT(DISTINCT
CONCAT(
'MAX(IF(name = ''',
name,
''', data, NULL)) AS ',
'''',