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 / gitlab-reset-pass.sh
Created November 13, 2019 11:35
gitlab-reset-pass.sh
#!/usr/bin/env bash
echo -n "Email: "; read MAIL
echo -n "Password: "; read -s PASS
echo # Ensure a new line
docker exec gitlab10 gitlab-rails runner -e production " \
user = User.find_by(email: '$MAIL'); \
user.passw
@avkosme
avkosme / git fork update origin
Created November 16, 2019 07:52
git fork update origin
# Add the remote, call it "upstream":
git remote add upstream https://github.com/whoever/whatever.git
# Fetch all the branches of that remote into remote-tracking branches,
# such as upstream/master:
git fetch upstream
# Make sure that you're on your master branch:
awk '{print $1}' /var/log/nginx/access.log | sort | uniq -c | sort -nr
sh -c "openssl passwd -apr1 >> /etc/nginx/.htpasswd"
atop -PCPU,NET,DSK,MEM -r /var/log/atop/atop_20191217 | sed -n -e '/SEP/,$p'
@avkosme
avkosme / answer_exercise_gotour.go
Created January 5, 2020 03:13 — forked from tetsuok/answer_exercise_gotour.go
An answer of the exercise: Loops and Functions on a tour of Go
package main
import (
"fmt"
"math"
)
const Delta = 0.0001
func isConverged(d float64) bool {
@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); ; {
@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 / 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 / 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