Snippet for printing a subclass tree

Sometimes I needed to figure out the class hierarchy. For this, I wrote a small piece of code to visualize the class tree. def format_output(class_name, prefix, is_last): left_simbol = "└" if is_last else "├" return prefix + left_simbol + "───" + class_name def print_subclass_tree(thisclass, prefix=""): for count, subclass in enumerate(thisclass.__subclasses__(), start=1): is_last = count == len(thisclass.__subclasses__()) print(format_output(subclass.__name__, prefix, is_last)) devide_simbol = "" if is_last else "│" print_subclass_tree(subclass, prefix + devide_simbol + "\t") print_subclass_tree(BaseException) # ============ OUTPUT ================== # >>> print_subclass_tree(BaseException) # ├───Exception # │ ├───TypeError # │ ├───StopAsyncIteration # │ ├───StopIteration # │ ├───ImportError # │ │ ├───ModuleNotFoundError # │ │ └───ZipImportError # ....

December 9, 2021

Starting a production Django server

I wrote ansible playbook for starting up a production Django server with PostgreSQL, Gunicorn and Nginx. When I tested the script, I used the Ubuntu Server image from this link. All I needed to install additionally was an ssh server for ansible to work. sudo apt update && sudo apt upgrade sudo apt install openssh-server I used a VirtualBox image and set the network settings to bridge mode. The IP address was obtained via the dhcp protocol....

October 15, 2021

Starting a Synapse/Matrix server on Raspberry Pi

Synapse is a reference “homeserver” implementation of Matrix. In this article, I will show step by step how to install a Matrix server on a Raspberry Pi model B (1 generation) with Raspbian Buster. In my setup, the username of the Raspberry Pi user is pi, and the home directory is /home/pi. For more information, see Matrix-Element : How to install the Synapse-Matrix - Raspberry PI - Rock 64 Server....

October 3, 2021

Starting a remote docker development server on DigitalOcean droplet

Thanks Fedor Borshev for awesome tutorial “Как писать код на МОЩНОЙ удалённой машине DigitalOcean”. I repeated Fedor’s experience with Windows + WSL2. Video: Link to ansible playbook for for deploying docker on DO droplet and empty django project for testing: github. Links: [1] Ansible playbook for for deploying docker on DO droplet [2] Youtube-канал “Почему не работает?”

August 15, 2021

How to push to GitHub via HTTPS if you have enabled two-factor authentication

If you enabled two-factor authentication in your Github account you won’t be able to push via HTTPS using your accounts password. Instead you need to generate a personal access token. This can be done in the application settings of your Github account. Using this token as your password should allow you to push to your remote repository via HTTPS. Use your username as usual. You may also need to update the origin for your repository if set to https:...

July 31, 2021

The first acquaintance with the Cisco DevNet Sandbox

Cisco allows you to perform laboratory work or test the APIs in sandbox. It is completely free. All the necessary devices are available in the sandbox permanently or by reservation. Here’s what Cisco writes about it: DevNet Sandbox makes Cisco’s free spread of technology available to developers and engineers by providing packaged labs we call Sandboxes. That’s right, totally free! There are two types of sandboxes, Always-On and Reservation. Each sandbox typically highlight one Cisco product (think, CallManager, APIC, etc)....

July 25, 2021

A dynamic GitHub profile with GitHub Actions

Thanks Yannick Chenot for the article How to Build a Dynamic GitHub Profile with GitHub Actions and PHP! It describes how to set up automatic updating of links to the latest blog posts in the GitHub profile using GitHub Actions. I will not retell the article, and you can read about the profile on GitHub here. Here is my python solution import requests from bs4 import BeautifulSoup url = "https://vostbur.github.io" main_page = BeautifulSoup(requests....

July 22, 2021

Deploying the django app on the DigitalOcean App Platform

For deploying Django apps, I tried PaaS such as Heroku and Pythonanywhere. It’s the turn of the DigitalOcean App Platform. And so far, this is the easiest and fastest way to deploy a Django app in production. There is awesome guide on how to do this on DigitalOcean’s tutorials. For testing, I wrote a small application that generates a configuration snippet for configuring ssh on cisco devices. For simplicity, I didn’t use a database and static content....

July 21, 2021

Запуск CSR1000v в VirtualBox и VMware

В прошлой статье я рассказал как подготовить и запустить любую версию виртуального маршрутизатора Cisco - Cloud Services Router (СSR1000v) в VirtualBox под Windows. С версии Cisco IOS XE 3.13S можно обойтись без настройки последовательного интерфейса. Запускать будем всё тот же релиз 3.15.0S. С официального сайта нужно скачать файлы csr1000v-universalk9.03.15.00.S.155-2.S-std.iso и csr1000v-universalk9.03.15.00.S.155-2.S-std.ova По-моему, сейчас это самая поздняя версия CSR, доступная с аккаунтом Cisco, версии новее требуют различные партнерские отношения с Cisco. Зарегистрироваться можно по адресу....

July 20, 2021

Запуск CSR1000v в VirtualBox (Windows) с эмуляцией serial port

Я расскажу как подготовить и запустить виртуальный маршрутизатор Cisco - Cloud Services Router (СSR1000v) в VirtualBox под Windows с эмуляцией serial port, настроить доступ по telnet, ssh и написать скрипт на python для автоматизации конфигурирования. Необходимый софт С официального сайта нужно скачать файлы csr1000v-universalk9.03.15.00.S.155-2.S-std.iso и csr1000v-universalk9.03.15.00.S.155-2.S-std.ova. По-моему, сейчас это самая поздняя версия CSR, доступная с аккаунтом Cisco, версии новее требуют различные партнерские отношения с Cisco. Зарегистрироваться можно по адресу. Если еще не установлен VirtualBox, скачайте и установите....

July 19, 2021