Skip to content

Instantly share code, notes, and snippets.

View avkosme's full-sized avatar
👨‍💻
in k8s clouds

Andrei Kostiuchenko avkosme

👨‍💻
in k8s clouds
View GitHub Profile
@avkosme
avkosme / gist:d0087b16f7df9e8ababf26b5437636d8
Created December 15, 2020 23:10
How to check progress of running cp?
# watch lsof -p`pgrep -x cp`
@avkosme
avkosme / gist:70bad60e2991412fc7a833029c69ae1c
Last active November 22, 2020 18:53
nginx-selfsigned.crt
openssl req -x509 -days 365 -nodes -newkey rsa:2048 -keyout /etc/ssl/private/nginx-selfsigned.key -out /etc/ssl/certs/nginx-selfsigned.crt
arch
sudo trust anchor nginx-selfsigned.crt
git clone --mirror {old_repo_url}
git remote add origin-new {new_repo_url}
git push --mirror origin-new
# get total requests by status code
awk '{print $9}' /var/log/nginx/access.log | sort | uniq -c | sort -rn
# get requests by 502 code
awk '($9 ~ /502/)' /var/log/nginx/access.log | awk '{print $7}' | sort | uniq -c | sort -r
# get top requesters by IP
awk '{print $1}' /var/log/nginx/access.log | sort | uniq -c | sort -rn | head | awk -v OFS='\t' '{"host " $2 | getline ip; print $0, ip}'
# get top requesters IP by url
Arch issues relosolve
sudo pacman -Syu --dbonly vlc
Find broken lib - arch
sudo pacman -Qkk
# invalid or corrupted package (PGP signature)
sudo pacman -S archlinux-keyring
@avkosme
avkosme / gist:8f44830b5d12cfd0d705650b8bae05b2
Created July 15, 2020 06:49
фикс когда git не может переключиться
git update-ref -d refs/heads/fix-release/2020.04/3
@avkosme
avkosme / archlinux-virtualbox.sh
Created April 1, 2020 07:06 — forked from GabLeRoux/archlinux-virtualbox.sh
Virtualbox archlinux notes
# sudo /sbin/rcvboxdrv -h
# Unloading modules:
# Loading modules: modprobe: FATAL: Module vboxnetadp not found in directory /lib/modules/4.4.3-1-ARCH
# modprobe: FATAL: Module vboxnetflt not found in directory /lib/modules/4.4.3-1-ARCH
# modprobe: FATAL: Module vboxpci not found in directory /lib/modules/4.4.3-1-ARCH
# modprobe: FATAL: Module vboxdrv not found in directory /lib/modules/4.4.3-1-ARCH
# Solution
# from https://forum.antergos.com/topic/818/can-t-run-my-vitualbox/4
@avkosme
avkosme / gist:a7b06538982f3822d897cd112de5aaf4
Created March 27, 2020 02:21
Топ занимаемых данных в таблицах postgres
SELECT nspname || '.' || relname AS "relation",
pg_size_pretty(pg_total_relation_size(C.oid)) AS "total_size"
FROM pg_class C
LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace)
WHERE nspname NOT IN ('pg_catalog', 'information_schema')
AND C.relkind <> 'i'
AND nspname !~ '^pg_toast'
ORDER BY pg_total_relation_size(C.oid) DESC
LIMIT 5;
@avkosme
avkosme / gist:bf4d55cff3898923626b1a7bd68e3cb1
Last active October 19, 2022 18:31
The best command to copy large number of files from one directory to another.
find /path/to/source/ -name "*" -exec cp -ruf "{}" /path/to/destination/ \;
# Show files 50 old days long
find /path/to/source/ -type f -mtime +50 -name "*" -exec ls -ltr "{}" \;
@avkosme
avkosme / answer_exercise_gotour.go
Created January 5, 2020 03:15
answer_exercise_gotour.go
// Package main provides ...
package main
import (
"fmt"
)
func Sqrt(x float64) float64 {
for z := float64(1); ; {