Skip to content

Instantly share code, notes, and snippets.

View Kyborg2011's full-sized avatar
🏠
Working from home

Anton Babinin Kyborg2011

🏠
Working from home
View GitHub Profile
@Kyborg2011
Kyborg2011 / kill-all-processes-from-ps.sh
Created August 6, 2019 10:23
Kill all processes, fended by 'ps' command with some search string (grep)
kill $(ps aux | grep 'telegramapi.py' | awk '{print $2}')
@Kyborg2011
Kyborg2011 / .zshrc
Last active December 26, 2024 08:13
My '.bash_profile/.zshrc' settings file on MacOS:
# There was a warning about LANG, when used 'pipenv', so I have added it to conf:
export LANG="en_US.UTF-8"
export LC_ALL="en_US.UTF-8"
export LC_CTYPE="en_US.UTF-8"
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
@Kyborg2011
Kyborg2011 / mongodb-experience.sh
Created July 15, 2019 21:10
Some experience with installation and deploying of MongoDB
# All commands below is concern to CentOS 6/7 or other RedHat-based Linux distro:
# MongoDB installation:
sudo vim /etc/yum.repos.d/mongodb-org.repo # Content for 'mongodb-org.repo' in another gist!
yum repolist
sudo yum -y install mongodb-org # Installation with yum
# MongoDB starting (as daemon):
mongod --fork --logpath /var/log/mongodb.log
# MongoDB startign with auth controll:
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
@Kyborg2011
Kyborg2011 / docker-gitlab-ce-backup.sh
Created July 10, 2017 10:08
Docker + Gitlab-CE backup
docker exec -t <your container name> gitlab-rake gitlab:backup:create
@Kyborg2011
Kyborg2011 / docker-gitlab-postgres-error-after-upgrade.sh
Created July 7, 2017 15:13
Docker + Gitlab-CE: migrations did not complete problem
# It seems the migrations did not complete. Did you run reconfigure again to see if this gets resolved?
# Also check gitlab-rake db:migrate:status. You can try to run the migrations manually with gitlab-rake db:migrate.
# Make sure postgres is running.
gitlab-rake db:migrate
sudo docker-compose up -d
# docs say we should run reconfigure at least once
sudo docker exec dockerinfrastructure_gitlab_1 gitlab-cal reconfigure
# lets check everything is working after first up
sudo docker exec dockerinfrastructure_gitlab_1 gitlab-rake gitlab:check SANITIZE=true
# restore backup now
sudo docker cp 1460934678_gitlab_backup.tar dockerinfrastructure_gitlab_1:/var/opt/gitlab/backups
sudo docker exec dockerinfrastructure_gitlab_1 gitlab-ctl stop unicorn
sudo docker exec dockerinfrastructure_gitlab_1 gitlab-ctl stop sidekiq
sudo docker exec dockerinfrastructure_gitlab_1 chmod -R 775 /var/opt/gitlab/backups
@Kyborg2011
Kyborg2011 / bash-wait-function.sh
Created July 6, 2017 09:16
Some experiments on Bash
#!/bin/bash
first=25601
step=100
while [ $first -lt 130900 ]
do
./app/console app:patients:load --default_pathname="$first" --default_filename="$step" & wait $!
first=$(($first+$step))
done
@Kyborg2011
Kyborg2011 / docker-startup.sh
Last active July 29, 2019 01:38
Docker + GitLab - startup
#!/bin/bash
# Run docker nginx-proxy container
docker run -d -p 80:80 -p 443:443 \
-v /home/anton/ssl-keys:/etc/nginx/certs \
-v /etc/letsencrypt/archive:/etc/letsencrypt/archive:ro \
-v /etc/letsencrypt/live:/etc/letsencrypt/live:ro \
-v /var/run/docker.sock:/tmp/docker.sock:ro \
jwilder/nginx-proxy
@Kyborg2011
Kyborg2011 / docker-gitlab-ce-useful.sh
Last active July 6, 2017 14:12
Docker + GitLab - useful commands
# recursively find the amount stored in directories (with depth 1)
sudo du -h / -d 1
# clearing of every unused Docker containers
# ( finded from: http://stackoverflow.com/questions/32723111/how-to-remove-old-and-unused-docker-images )
docker rm -v $(docker ps --filter status=exited -q 2>/dev/null) 2>/dev/null
docker rmi $(docker images --filter dangling=true -q 2>/dev/null) 2>/dev/null
# making backup of Docker (docker-ce deploying as Docker container)
docker exec -i gitlab-container-name /opt/gitlab/bin/gitlab-rake gitlab:backup:create