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 / 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 {
atop -PCPU,NET,DSK,MEM -r /var/log/atop/atop_20191217 | sed -n -e '/SEP/,$p'
sh -c "openssl passwd -apr1 >> /etc/nginx/.htpasswd"
awk '{print $1}' /var/log/nginx/access.log | sort | uniq -c | sort -nr
@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:
@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
docker-compose -f docker-compose-test.yml run --rm --service-ports --use-aliases app
@avkosme
avkosme / ssh permissions key
Created September 25, 2019 07:52
ssh permissions key
chmod 700 ~/.ssh
chmod 600 ~/.ssh/*
# local_settings.py
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'file': {
'level': 'DEBUG',
'class': 'logging.FileHandler',
'filename': '/tmp/debug.log',
$ dig @resolver1.opendns.com ANY myip.opendns.com +short
curl -s http://whatismyip.akamai.com/