Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
🏳️‍🌈

Ivan Kropotkin yelizariev

💭
🏳️‍🌈
View GitHub Profile
@yelizariev
yelizariev / mappings.txt
Last active Feb 27, 2020 — forked from dmgerman/vimium-emacs.md
Emacs-Style Key Bindings for Vimium
View mappings.txt
#########################################
unmapAll # Use Emacs-style bindings only.
#########################################
# Modifier Keys w/ Emacs Terminology:
# `<c-*>` = ⌃ Control Key; i.e. `C-*`.
# `<a-*>` = ⌥ Meta Key (Alt/Option); i.e. `M-*`.
@yelizariev
yelizariev / 00-install-odoo-translation.sh
Last active Aug 17, 2020
Automatic translation of odoo files by using existing translation (e.g. from Ukrainian to Russian, English to Russian, Russian to Russian)
View 00-install-odoo-translation.sh
# install dependencies
sudo pip install polib
sudo pip install google-cloud-translate==2.0.0
# https://docs.transifex.com/client/installing-the-client
sudo pip install transifex-client
# prepare and export your google cloud credentials
# See https://cloud.google.com/translate/docs/basic/setup-basic
# and https://cloud.google.com/docs/authentication/getting-started
@yelizariev
yelizariev / rotate.sh
Created Feb 18, 2019
Simple file rotating (e.g. for backups)
View rotate.sh
# based on https://serverfault.com/a/196847
# It will keep only latest 12 files
ls -1t /path/to/dir/* | tail -n +13 | xargs rm > /dev/null 2>&1
@yelizariev
yelizariev / monotoring.sh
Last active Feb 16, 2019
monitoring tools
View monotoring.sh
sudo apt install lolcat cowsay
while true; do export PINGHOST=8.8.8.8 && RESULT=$(ping -q -n -c 4 $PINGHOST | awk '/packet loss/ {if ($6 != "0%") print $6, "packet loss"}') && echo "Done:" && if [[ -z $RESULT ]]; then cowsay "No package lost!" | lolcat --seed=45; else cowsay $RESULT | lolcat --seed=17; fi; date; echo -n "sleeping... "; sleep 5; echo -n "pinging... "; done
View disk-arhive.sh
# https://help.ubuntu.com/community/BackupYourSystem/TAR
# Archive
tar -cvpzf backup.tar.gz --one-file-system /
# Restore
sudo tar -xvpzf /path/to/backup.tar.gz -C /media/whatever --numeric-owner
View Letsencrypt Wildcard DNS manual.rst
@yelizariev
yelizariev / 000-aws-lambda-todo-bot.md
Last active Nov 10, 2021
TODO-list bot for Telegram. OBSOLETE: latest version is here https://itpp.dev/chat/todo-bot/index.html
View 000-aws-lambda-todo-bot.md

Allows to create TODOs for a small group of users.

Tasks can have on of the following states:

  • TODO -- to be done
  • DONE -- done
  • CANCELED -- nothing was done and not going to be done
  • WAITING -- cannot be started and waits for something

Technical specification

@yelizariev
yelizariev / 000-aws-lambda-bot.md
Last active Aug 24, 2021
Telegram resending bot on AWS Lambda. OBSOLETE: the latest version is here https://chatops.readthedocs.io/en/latest/resend-bot/index.html
View 000-aws-lambda-bot.md

The general idea is to ask a group (let's call it target group) via bot and get answer. The group might be:

  • Support Team
  • IT Department of your company
  • etc.

TODO: text formatting is lost on resending. Use entities instead of text field

TODO: set debug level via Environment variables

@yelizariev
yelizariev / docker-cleanup-resources.md
Last active Feb 6, 2020 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks
View docker-cleanup-resources.md

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

docker volume rm $(docker volume ls -qf dangling=true)

docker volume ls -qf dangling=true | xargs -r docker volume rm