Skip to content

Instantly share code, notes, and snippets.

View bralbral's full-sized avatar
🌍
Working from home

Denis Kosyakov bralbral

🌍
Working from home
View GitHub Profile
@bralbral
bralbral / gist:8b7ca145d14b7fcd351d4542e9f11c5c
Created February 6, 2024 18:53
grab_kiwix_documentation.bash
#!/bin/bash
date=$(date '+%Y-%m-%d')
docker run -v ./output:/output --cap-add=SYS_ADMIN --cap-add=NET_ADMIN --shm-size=4gb dan83mail/zimit:latest zimit --url "https://clickhouse.com/docs/en/intro" --name clickhouse_$date --workers 16 --useSitemap "https://clickhouse.com/sitemap.xml" --timeout=120
docker run -v ./output:/output --cap-add=SYS_ADMIN --cap-add=NET_ADMIN --shm-size=4gb dan83mail/zimit:latest zimit --url "https://www.tinybird.co/clickhouse/knowledge-base" --name tinybird_$date --workers 16 --useSitemap "https://www.tinybird.co/sitemap.xml" --timeout=120
docker run -v ./output:/output --cap-add=SYS_ADMIN --cap-add=NET_ADMIN --shm-size=4gb dan83mail/zimit:latest zimit --url "https://kb.altinity.com/" --name altinity_$date --workers 16 --useSitemap "https://kb.altinity.com/sitemap.xml" --timeout=120
@bralbral
bralbral / gist:c28b0004e53e212ddc0a0e611df506f0
Created January 15, 2024 19:17
ElasticSearch painless; Ingest Pipeline; Working with arrays;
if (ctx.date_birthday != null) {
if (ctx.date_birthday instanceof String) {
def inputFormat = new SimpleDateFormat("yyyy-MM-dd");
def date = inputFormat.parse(ctx.date_birthday);
Calendar myCal = new GregorianCalendar();
myCal.setTime(date);
def year = myCal.get(Calendar.YEAR);
def month = myCal.get(Calendar.MONTH);
month = month + 1;
@bralbral
bralbral / README.md
Created April 18, 2023 18:01 — forked from nymous/README.md
Logging setup for FastAPI, Uvicorn and Structlog (with Datadog integration)

Logging setup for FastAPI

This logging setup configures Structlog to output pretty logs in development, and JSON log lines in production.

Then, you can use Structlog loggers or standard logging loggers, and they both will be processed by the Structlog pipeline (see the hello() endpoint for reference). That way any log generated by your dependencies will also be processed and enriched, even if they know nothing about Structlog!

Requests are assigned a correlation ID with the asgi-correlation-id middleware (either captured from incoming request or generated on the fly). All logs are linked to the correlation ID, and to the Datadog trace/span if instrumented. This data "global to the request" is stored in context vars, and automatically added to all logs produced during the request thanks to Structlog. You can add to these "global local variables" at any point in an endpoint with `structlog.contextvars.bind_contextvars(custom

@bralbral
bralbral / bucket-policies-primer.md
Created March 19, 2023 13:17 — forked from krishnasrinivas/bucket-policies-primer.md
Explanation of bucket polices by example

Bucket Policy

Bucket policy is an access policy available for you to grant anonymous permissions to your Minio resources. Bucket policy uses JSON-based access policy language.

This section presents a few examples of typical use cases for bucket policies. The policies use testbucket strings in the resource value. To test these policies, you need to replace these strings with your bucket name. For more information please read Amazon S3 access policy language

Granting Read-Only Permission to an Anonymous User

The following example policy grants the s3:GetObject permission to any public anonymous users. This permission allows anyone to read the object data under testbucket, which is useful for when you have publicly readable assets. A typical example is a website assets stored in testbucket.

@bralbral
bralbral / README.MD
Last active November 2, 2022 11:32
Tag your friends as clowns; #pyrogram #telegram #userbot
  1. Tested on python 3.9, OS Debian GNU/Linux 11 (bullseye)
  2. Install requirements: pip3 install pyrogram uvloop
  3. Fill "setup_section" in dry_run.py
  4. Generate session file: python3 dry_run.py
  5. Fill "setup_section" in mark_the_freaks.py
  6. Enjoy! python3 mark_the_freaks.py
  7. Optional: Clear your messages python3 delete_your_messages.py
@bralbral
bralbral / search_kibana_console.txt
Created May 22, 2022 07:12 — forked from dadoonet/search_kibana_console.txt
Demo script for "A NoSQL search engine to find..." talk
### REINIT
DELETE user
PUT user
{
"mappings": {
"properties": {
"name": {
"type": "text"
},
"comments": {
@bralbral
bralbral / solid_in_python.md
Created September 24, 2021 10:37 — forked from welel/solid_in_python.md
SOLID принципы с примерами на Python

S.O.L.I.D принципы с примерами на Python

Примечания
  • Под клиентами подразумеваются программные сущности, использующие другие программные сущности.

  • Этот файл является переводом статьи с сайта medium.com пользователя DeeKey, ссылка в завершении файла.