Skip to content

Instantly share code, notes, and snippets.

@barseghyanartur
barseghyanartur / open_sublime_text_from_terminal.rst
Last active February 7, 2024 08:55
Open SublimeText from macOs terminal the same way you would do it on Linux

Open SublimeText from macOs terminal the same way you would do it on Linux

  1. Create a sym-link:

    ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /Users/me/.local/bin/subl
@barseghyanartur
barseghyanartur / docker_macos.rst
Last active February 12, 2024 08:37
Docker on macOs

Install Docker and Docker-Compose on macOs

@barseghyanartur
barseghyanartur / middleware.py
Created December 21, 2023 11:34 — forked from SehgalDivij/middleware.py
Middleware in django to log all requests and responses(Inspired by another Github gist I cannot find the link to, now)
"""
Middleware to log all requests and responses.
Uses a logger configured by the name of django.request
to log all requests and responses according to configuration
specified for django.request.
"""
# import json
import logging
from django.utils.deprecation import MiddlewareMixin
@barseghyanartur
barseghyanartur / platform_generate.py
Created December 12, 2023 13:27 — forked from cheind/platform_generate.py
cross platform pip-compile helper
import argparse
import platform
import sys
import subprocess
from pathlib import Path
def describe() -> dict:
meta = {
"python": "py" + ".".join(platform.python_version_tuple()[:2]),
@barseghyanartur
barseghyanartur / caddy.rst
Last active November 13, 2023 09:06
Caddy proxy

Caddy

Installation

sudo snap install caddy --edge
@barseghyanartur
barseghyanartur / create_pdf.py
Last active June 22, 2023 07:47
Create a PDF with 500 pages using `faker-file`
from faker import Faker
from faker_file.base import DynamicTemplate
from faker_file.providers.pdf_file import PdfFileProvider
from faker_file.providers.pdf_file.generators import reportlab_generator
from reportlab.lib.styles import getSampleStyleSheet
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttfonts import TTFont
from reportlab.platypus import PageBreak, Paragraph
FAKER = Faker()
@barseghyanartur
barseghyanartur / rock_paper_scissors.py
Created February 22, 2023 07:54
Rock, paper, scissors game in Python
"""
Usage:
python rock_paper_scissors.py
"""
import random
__title__ = "rock_paper_scissors"
__version__ = "0.1"
@barseghyanartur
barseghyanartur / install_vera_font_on_linux.md
Last active February 16, 2023 08:06
Install Vera font on Linux
@barseghyanartur
barseghyanartur / project_structure_in_rust.md
Created February 15, 2023 09:48
Project structure in Rust

Project structure in Rust

Tree

├── Cargo.toml
└── src
    ├── lib.rs
    ├── main.rs
    └── traits.rs
@barseghyanartur
barseghyanartur / how_to_debug_python_applications.md
Last active February 16, 2023 10:27
How to debug Python applications

How to debug Python applications

rp-L4mz-N2-ZJ0-Pnopju2da-1-kguub.jpg

Introduction

In software development, testing is an essential part of ensuring that code works as intended. One critical aspect of testing is debugging, which involves finding and fixing errors or bugs in a program. In this article, we'll explore how to debug Python applications and highlight some of the most commonly used methods for debugging Python code.

Debugging options