Skip to content

Instantly share code, notes, and snippets.

@gtitov
gtitov / vt.md
Last active October 25, 2024 11:50
# http://norbertrenner.de/osm/bbox.html
.\osmconvert64.exe .\central-fed-district-latest.osm.pbf -b="36.11,54.94,39.03,56.52" -o="moscow2.pbf"
java -Xmx8g -jar planetiler.jar --download --osm-path=./moscow2.pbf
python mb-util --image_format=pbf .\data\output.mbtiles ./tiles
gunzip -S .pbf -d -r tiles # bash
@gtitov
gtitov / systemd.md
Created September 25, 2024 09:07
How to create a systemd service
@gtitov
gtitov / link
Created November 15, 2023 16:05

Enable systemd in WSL 2

This guide will enable systemd to run as normal under WSL 2. This will enable services like microk8s, docker and many more to just work during a WSL session. Note: this was tested on Windows 10 Build 2004, running Ubuntu 20.04 LTS in WSL 2.

  • To enable systemd under WSL we require a tool called systemd-genie

  • Copy the contents of install-sg.sh to a new file /tmp/install-sg.sh:

    cd /tmp
@gtitov
gtitov / getaudio.sh
Created April 29, 2022 12:24
Extract audio from mkv file with ffmpeg
# ffmpeg -i sample.avi -q:a 0 -map a sample.mp3
# ./json2html.sh "Title"
for file in *.mkv; do
filename="${file%.*}"
audiofile="${filename}.mp3"
ffmpeg -i "$file" -q:a 0 -map a "$audiofile"
echo "$audiofile"
done
read -p "Press enter to continue"
@gtitov
gtitov / yt-dlp-audio.md
Created April 15, 2022 10:51
Загрузка аудиодорожки из ютюба

Загрузить аудио

yt-dlp.exe --extract-audio --audio-format mp3 -o "%(title)s.%(ext)s" https://www.youtube.com/watch?v=trzPYaIzmYM

Загрузить плейлист, только аудио

yt-dlp.exe --extract-audio --audio-format mp3 -o "%(title)s.%(ext)s" https://www.youtube.com/playlist?list=PL03_7ORpw4ixV7Yuv0785xZjq107jwxvK

Нормализация баз данных

Принципы нормализации описывают, как надо правильно проектировать таблицы для хранения данных. Если им не следовать, то потом с БД будет неудобно работать (а разработчики будут вспоминать проектировщика нехорошими словами). К сожалению, не везде эти принципы описаны понятным языком, потому я попытался найти доступные статьи, а также добавил пояснения своими словами.

Перед чтением этого урока полезно вспомнить, какие виды отношений между таблицами бывают в базе данных (один-к-одному, один-ко-многим, многие-ко-многим).

Ссылки по теме:

If you want to do some real estate analytics, the GeoPandas package offers an amazing way to manipulate geographic information. It extends the datatypes used by pandas to allow spatial operations on geometric types.

Examples of spatial operations are map overlay (combining two maps together), simple buffering but more popularly, GeoPandas can be used to do Geovisualization.

Installation

While GeoPandas is a powerful package for spatial manipulation, installation is a bit challenging for some. It requires dependencies that are difficult to harmonize.

I found one way to effectively install this on my laptop and reproducing the following steps may work for you as well.

По умолчанию pbf от tippecanoe в формате gzip (хотя и с расширением pbf) mapbox/tippecanoe#793

Figured out after much searching that this is probably indicating a zipped pbf file. That kind of should at least be mentioned somewhere.

Tippecanoe generates gzipped tiles by default because that is what Mapbox uploads and clients expect. You can use --no-tile-compression if you don't want compression.

Это приводит к ошибке mapbox/mapbox-gl-js#1567 (comment)

@mofoyoda the error generally fires when it sees something it doesn't expect when decoding tiles from protocol buffers. Can you send us a sample of a particular tile that doesn't work?

@gtitov
gtitov / https.md
Last active February 21, 2022 12:03
Настройка использования доменного имени и протокола HTTPS на nginx с использованием acme.sh

Использование доменного имени и протокола HTTPS

Предполагаем, что у нас есть доменное имя example.ru, наш email [email protected], имеющий права адиминистратора пользователь user. Сертификат может быть подключен только к доменному имени.

Подключение доменного имени

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

Про работу с доменным именем для nginx можно почитать тут