Skip to content

Instantly share code, notes, and snippets.

View zshanabek's full-sized avatar
🍉
eating watermelon

Zhunisali Shanabek zshanabek

🍉
eating watermelon
View GitHub Profile
### Задание 1
Получить данные о текущем потреблении воды, электричества и газа.
GET /current_device_data
{
"water": {
"current": 4526,
"average_consumption": 5000, # захардкоженное значение
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
@zshanabek
zshanabek / ok.py
Created April 10, 2023 17:28
ok.py
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
@zshanabek
zshanabek / heroku.sh
Created May 30, 2022 11:54
Useful Heroku CLI Commands
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
@zshanabek
zshanabek / user.sh
Created March 23, 2022 10:39
Initial Server Setup with Ubuntu 20.04
adduser sammy
usermod -aG sudo sammy
ufw app list
ufw allow OpenSSH
ufw enable
ufw status
rsync --archive --chown=sammy:sammy ~/.ssh /home/sammy
@zshanabek
zshanabek / python.sh
Created December 27, 2021 18:09
python related commands
# install venv for specific version and activate
sudo apt install python3.8-venv
python3 -m venv venv
. venv/bin/activate
@zshanabek
zshanabek / docker.sh
Last active January 21, 2024 17:12
docker related commands
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
@zshanabek
zshanabek / server nginx config
Last active August 18, 2021 10:03
nginx config for vps
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;
@zshanabek
zshanabek / elementary-todo.sh
Last active May 30, 2022 12:04
things to do after installing elementary os or any debian based linux distribution (ubuntu, linux mint)
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 "zshanabek@gmail.com"