Skip to content

Instantly share code, notes, and snippets.

View husanpy's full-sized avatar

Khusan Turdiev husanpy

  • Tashkent, Uzbekistan
View GitHub Profile
@nngogol
nngogol / pdf_russian_reportlab.py
Created March 21, 2018 14:08
How to write russian text in reportlab in python. Also, download 'DejaVuSerif.ttf' from internet.
#!/usr/bin/env python
#-*- coding: UTF-8 -*-
from reportlab.lib import colors
from reportlab.platypus import Paragraph, SimpleDocTemplate, Table, TableStyle
from reportlab.lib.styles import getSampleStyleSheet
from reportlab.lib.pagesizes import A4
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttfonts import TTFont
@eoaliev
eoaliev / event_handler.php
Last active February 24, 2025 23:02
Регистрация обработчика события подключающего JS файл на определенных страницах
<?php
// Регистрируем обработчик события
\Bitrix\Main\EventManager::getInstance()->addEventHandler('main', 'onProlog', function () {
// Проверим является ли страница детальной карточкой CRM через функционал роутинга компонентов
$engine = new \CComponentEngine();
$page = $engine->guessComponentPath(
'/crm/',
['detail' => '#entity_type#/details/#entity_id#/'],
$variables
@ziritrion
ziritrion / vm_containers.md
Last active September 21, 2025 05:16
Docker, containers and VMs

Docker

Terminology

  • Container: environment that runs an applications that is not dependent on the OS. Kind of like a lightweight VM. Containers are stateless; if you need to update the components inside, create another container instead.
  • Image: template to create a container. Its components are defined by a Dockerfile.
  • Volume: storage area detached from the container for maintaining state. There are 4 types:
    • Volumes: managed by Docker itself, they're stored in a separate part of the host filesystem (on Linux by default this would be var/lib/docker/volumes). Useful for production deployments.
    • Bind mounts: mount a specific directory or file from the host to the container, such as a project folder. Useful for development.
  • Tmpfs mounts: mount a temporary file system in the container, which is stored in the host system's memory only, not on disk. Useful for sensitive information that should not be persisted between container restarts or for performance reaso
@ML-engineer
ML-engineer / duckdb_bq_storage_api.py
Created July 4, 2022 22:08
Read BQ table to DuckDB directly from storage read api
import duckdb
from google.cloud import bigquery
bqclient = bigquery.Client()
table = bigquery.TableReference.from_string(
"bigquery-public-data.utility_us.country_code_iso"
)
rows = bqclient.list_rows(table)
country_code_iso = rows.to_arrow(create_bqstorage_client=True)
cursor = duckdb.connect()