Skip to main content

Msgspec fastapi integration

4 min read
Serhii Hrekov
software engineer, creator, artist, programmer, projects founder

msgspec is a Python library designed for high-performance serialization and validation, which makes it a powerful partner for FastAPI. It can be used as a drop-in replacement for FastAPI's default Pydantic models to handle data validation and schema generation, often leading to a significant speedup in API performance.

msgspec Struct

4 min read
Serhii Hrekov
software engineer, creator, artist, programmer, projects founder

msgspec.Struct is a powerful data class in the msgspec library that's used to define the schema of your data. It's similar to Python's built-in dataclasses or typing.NamedTuple, but it's specifically optimized for high-performance serialization and validation. When you use a Struct, msgspec can perform operations like JSON encoding and decoding significantly faster than standard Python methods because it has a predefined, static understanding of your data's layout.

How is GFM different from CommonMark?

3 min read
Serhii Hrekov
software engineer, creator, artist, programmer, projects founder

GitHub Flavored Markdown (GFM) is a strict superset of the CommonMark specification. This means that GFM includes all the features of CommonMark and adds several of its own, making it a more feature-rich dialect of Markdown.

The key differences between GFM and CommonMark lie in the extra features GFM provides to support the collaborative nature of a platform like GitHub.

Github flavored markdown syntax

3 min read
Serhii Hrekov
software engineer, creator, artist, programmer, projects founder

GitHub Flavored Markdown (GFM) is a superset of the CommonMark specification, which means it includes all the standard Markdown features plus several useful additions. It's the dialect of Markdown used on GitHub for things like issues, pull requests, wikis, and comments.

Git: Discard All Local Changes and Get a Fresh Copy from GitHub

5 min read
Serhii Hrekov
software engineer, creator, artist, programmer, projects founder

A common and reliable way to get a fresh copy from a GitHub repository, while preserving specific local files like .gitignore, is to use a combination of git reset and git clean. This approach ensures your local branch exactly mirrors the remote branch, without leaving behind any untracked or unwanted files.

Discard all local changes and pull the latest version from a GitHub

5 min read
Serhii Hrekov
software engineer, creator, artist, programmer, projects founder

To discard all your local changes and pull the latest version from a GitHub repository, you need to completely reset your local branch to match the remote's state. This process involves a few steps to ensure all uncommitted and committed local changes are removed.

This guide covers the most reliable methods, including situations where you've already made local commits.

VIM Commands Cheatsheet

3 min read
Serhii Hrekov
software engineer, creator, artist, programmer, projects founder

VIM Commands Cheatsheet no water, just straight to the point, such as - how to save and exit vim editor?!

ZSH: permission denied

3 min read
Serhii Hrekov
software engineer, creator, artist, programmer, projects founder

zsh: permission denied: /Users/username/.zshrc occurs because your user account doesn't have the necessary file permissions to write to or execute the .zshrc file. This is a common issue after certain system updates, migrations, or when a file is created with elevated privileges.

To solve this, you need to change the file's ownership or permissions.

Looking for more content?
Hrekov Blog contains 165 articles. Browse the blog archive or Explore the full timeline.