This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Задание 1 | |
Получить данные о текущем потреблении воды, электричества и газа. | |
GET /current_device_data | |
{ | |
"water": { | |
"current": 4526, | |
"average_consumption": 5000, # захардкоженное значение |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import io | |
from PyPDF2 import PdfReader, PdfWriter | |
from reportlab.lib.pagesizes import A4 | |
from reportlab.pdfbase import pdfmetrics | |
from reportlab.pdfbase.ttfonts import TTFont | |
from reportlab.pdfgen.canvas import Canvas | |
from server.models.contract import Contract | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ast | |
import constants | |
from database import SQLite | |
from amocrm.v2.entity.contact import Contact as _Contact | |
import re | |
from amocrm.v2.entity.lead import Lead as _Lead | |
from amocrm.v2.entity.task import Task |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
heroku login | |
heroku restart # restarts the Heroku dyno | |
heroku create <your_app_name> | |
heroku open # opens up your heroku app | |
heroku open -a <your_app_name> # when you are working outside your git repo | |
heroku logs # opens up server logs, very useful for debugging | |
heroku addons:create <package_name> | |
heroku pg:info # postgres database info | |
heroku run bash # opens a bash shell to Heroku machine | |
heroku run <your command> # e.g. heroku run python manage.py migrate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
adduser sammy | |
usermod -aG sudo sammy | |
ufw app list | |
ufw allow OpenSSH | |
ufw enable | |
ufw status | |
rsync --archive --chown=sammy:sammy ~/.ssh /home/sammy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# install venv for specific version and activate | |
sudo apt install python3.8-venv | |
python3 -m venv venv | |
. venv/bin/activate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker run --name pgacid -d -e POSTGRES_PASSWORD=postgres postgres:13 | |
docker run -e POSTGRES_PASSWORD=postgres --name pg1 postgres. # -e for env variable. --name for container name. postgres is image. | |
docker exec -it pgacid psql -U postgres # -it interactive container. pgacid - name of container. postgres - user name. "docker exec" executes a command in a running container | |
docker start pgacid | |
docker run -it ubuntu # The combination of the -i and -t switches gives you interactive shell access into the container | |
docker images # To see the images that have been downloaded to your computer, type. | |
docker run hello-world | |
docker search ubuntu | |
docker pull ubuntu # command to download the official ubuntu image to your computer. | |
docker build . # build image from Dockerfile in current directory |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
server_name akv.kz www.akv.kz; | |
return 301 https://$server_name$request_uri; | |
} | |
server{ | |
keepalive_timeout 5; | |
client_max_body_size 126m; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get update # update all repositories | |
# git setup | |
sudo apt-get install git | |
sudo apt-get install gitk # for GUI representation of git history | |
sudo apt-get install xclip # xclip is for saving shell output in clipboard | |
git config --global color.ui true # for colourful output in terminal | |
# update git per-user configuration file | |
git config --global user.name "Zhunisali" # write here your name and email | |
git config --global user.email "[email protected]" |