Находки в опенсорсе
10.7K subscribers
11 photos
1 video
3 files
819 links
Привет!

Меня зовут Никита Соболев. Я занимаюсь опенсорс разработкой полный рабочий день.

Тут я рассказываю про #python, #c, опенсорс и тд.
Поддержать: https://boosty.to/sobolevn
РКН: https://vk.cc/cOzn36

Связь: @sobolev_nikita
Download Telegram
​​List of Microservice API Patterns.

Our Microservice API Patterns (MAP) capture proven solutions to design problems commonly encountered when specifying, implementing and maintaining message-based APIs.

MAP focusses on message representations – the payloads exchanged when APIs are called. These payloads vary in their structure as API endpoints and their operations have different architectural responsibilities. The chosen representation structures strongly influence the design time and runtime qualities of an API. The evolution of API specifications and their implementations has to be governed.

https://microservice-api-patterns.org/
​​Inertia.js: the modern monolith. Build single-page apps, without building an API.

Inertia.js lets you quickly build modern single-page React, Vue and Svelte apps using classic server-side routing and controllers.

Inertia is a new approach to building classic server-driven web apps. We call it the modern monolith.

Inertia allows you to create fully client-side rendered, single-page apps, without much of the complexity that comes with modern SPAs. It does this by leveraging existing server-side frameworks.

Inertia has no client-side routing, nor does it require an API. Simply build controllers and page views like you've always done!

Inertia isn't a framework, nor is it a replacement to your existing server-side or client-side frameworks. Rather, it's designed to work with them. Think of Inertia as glue that connects the two. Inertia does this via adapters. We currently have three official client-side adapters (#react, #vue, and #svelte) and two server-side adapters (Laravel and Rails).

https://inertiajs.com/

#js
​​Intuitive find & replace CLI (sed alternative) written in #rust

Why use it over any existing tools?

- Painless regular expressions. sd uses regex syntax that you already know from JavaScript and Python. Forget about dealing with quirks of sed or awk - get productive immediately.
- String-literal mode. Non-regex find & replace. No more backslashes or remembering which characters are special and need to be escaped.
- Easy to read, easy to write. Find & replace expressions are split up, which makes them easy to read and write. No more messing with unclosed and escaped slashes.
- Smart, common-sense defaults. Defaults follow common sense and are tailored for typical daily use.

Personal opinion: I had used sed a lot in the past. And I hate it. This looks like a good alternative.

https://github.com/chmln/sd
​​Flake8 plugin to find commented out or dead #python code

Part of our wemake-python-styleguide project. But, you can install it independently!

https://github.com/sobolevn/flake8-eradicate
​​A blazingly fast static web server in a single binary you can set up with zero code - written in #rust.

Features:
- Single binary with no dependencies and everything built-in.
- Blazingly fast! It's built on top of Actix, one of the fastest web frameworks in the world and of course, written in Rust.
- Everything in a single config file - everything you need to setup is in the binserve.json, just change it, run it!
- Epic Portability - just carry the binary around and all you have to change is the host and port in the binserve.json.
- Easiest Routing - you just have to enter the route and the static file to respond in the binserve.json to add a route entry!
- Handlebars template engine - renders every static file with Handlebars on the first run improving performance!
- Template Variables in one place - that too in the one and only config file!
- Secure by design - runs security validation checks on the first run and will only run the server once configuration is confirmed secure! (See Security)
- Config & Static File Assistance - just running it will create the configuration file and the static directory boilerplate for you!
- Supports Any Static Files - just give any static file of your choice to routes and response will match it's Content-Type.
- Straightforward Directory Structure - static files falls under the static directory, you can even change that! And images, css, and js falls under the assets directory which should all be created for you in the first run itself!
- Custom Error Page Support - you can design your own fancy error pages!
- Actix Logging Middleware - Logging is powered directly from Actix.

https://github.com/mufeedvh/binserve
​​A powerful little #go TUI framework

The fun, functional and stateful way to build terminal apps. A Go framework based on The #elm Architecture. Bubble Tea is well-suited for simple and complex terminal applications, either inline, full-window, or a mix of both.

Bubble Tea is in use in production and includes a number of features and performance optimizations we’ve added along the way. Among those is a standard framerate-based renderer, a renderer for high-performance scrollable regions which works alongside the main renderer, and mouse support.

https://github.com/charmbracelet/bubbletea
​​Boundary enables identity-based access management for dynamic infrastructure.

Boundary provides simple and secure access to hosts and services.

Traditional approaches like SSH bastion hosts or VPNs require distributing and managing credentials, configuring network controls like firewalls, and exposing the private network. Boundary provides a secure way to access hosts and critical systems without having to manage credentials or expose your network, and is entirely open source.

Boundary is designed to be straightforward to understand, highly scalable, and resilient. It can run in clouds, on-prem, secure enclaves and more, and does not require an agent to be installed on every end host.

Unlike firewalls, Boundary performs per-access authentication and authorization checks, allowing for much higher level mappings of users to services or hosts than at network layers. Although complementary to secrets managers (like HashiCorp's own Vault), Boundary fills a different niche, allowing the credential that is eventually used to be hidden entirely from the user.

- Authenticate with any trusted identity provider you are already using. No need to distribute new credentials and manage them.
- Authorize access based on logical roles and services, instead of physical IP addresses. Manage dynamic infrastructure and integrate service registries so hosts and service catalogs are kept up-to-date.
- Automate credential injection to securely access services and hosts with HashiCorp Vault. Reduce risk of leaking credentials with dynamic secrets and just-in-time credentials.

https://github.com/hashicorp/boundary

#go
​​Secure and fast microVMs for serverless computing.

Firecracker is an open source virtualization technology that is purpose-built for creating and managing secure, multi-tenant container and function-based services.

Firecracker enables you to deploy workloads in lightweight virtual machines, called microVMs, which provide enhanced security and workload isolation over traditional VMs, while enabling the speed and resource efficiency of containers. Firecracker was developed at Amazon Web Services to improve the customer experience of services like AWS Lambda and AWS Fargate .

Firecracker is a virtual machine monitor (VMM) that uses the Linux Kernel-based Virtual Machine (KVM) to create and manage microVMs. Firecracker has a minimalist design. It excludes unnecessary devices and guest functionality to reduce the memory footprint and attack surface area of each microVM. This improves security, decreases the startup time, and increases hardware utilization. Firecracker currently supports Intel CPUs, with AMD and Arm support in developer preview.

Firecracker is integrated with Kata Containers , Open Nebula , UniK , Weave FireKube (via Weave Ignite ), and containerd via firecracker-containerd It's also used by fly.io . Firecracker can run Linux and OSv guests.

https://github.com/firecracker-microvm/firecracker

#rust #devops
​​Monorepo vs. polyrepo: architecture for source code management (SCM) version control systems (VCS)

Monorepo means using one repository that contains many projects, and polyrepo means using a repository per project. This page discusses the similarities and differences, and has advice and opinions on both.

https://github.com/joelparkerhenderson/monorepo_vs_polyrepo

#devops
​​Gravity is not a force.

Under general relativity, gravity is not a force. Instead it is a distortion of spacetime. Objects in free-fall move along geodesics (straight lines) in spacetime, as seen in the inertial frame of reference on the right. When standing on Earth we experience a frame of reference that is accelerating upwards, causing objects in free-fall to move along parabolas, as seen on the left.

In this system there is only one space dimension, shown on the vertical axis and labeled in meters. The time dimension is the horizontal axis and labeled in seconds. The gravitational field is constant within the area of interest.

Use this demo to see and feel this!

https://timhutton.github.io/GravityIsNotAForce/

#js
> How to make CPython faster.

> We want to speed up CPython by a factor of 5 over the next four releases.
> See the plan for how this can be done.
> Making CPython faster by this amount will require funding. Relying on the goodwill and spare time of the core developers is not sufficient.

This includes JIT and other awesome features for #python

https://github.com/markshannon/faster-cpython

We need this!
​​Implementation of a simple programming language for beginners.

The primary goal of Neon is to find out whether a useful programming language can avoid some of the common pitfalls that beginners frequently encounter in other languages. Some of these common errors avoided by design are:

- Floating point errors due to binary floating point
- Writing if (x = 0) when if (x == 0) is intended
- Null pointer exceptions
- Unintended empty loop with while (condition);
- Forgetting to use the return value of a function

Personal opinion: very interesting take on this topic. I hope that we will have more beginner-friendly (or even beginner-only) languages in the future.

https://github.com/ghewgill/neon-lang

#cpp
> When learning Object Oriented Design in a school setting, the discussion usually goes something like this:

> “This is a picture of a dog. What things can a dog do? Bark, eat, run, walk, these are its methods. What are some things that describe a dog? It is soft, brown, has 4 legs. These are its properties”

> “Purely behavioural code should be kept at a minimum at the boundaries of your domain layer, mostly to interface with the richer world of Nouns.”

> I like to refer to this object modelling advice as “Find the Nouns”, and it is wrong

This article describes a very different approach to OOP.
I wrote a similar article not so long ago: https://sobolevn.me/2019/03/enforcing-srp
​​An event-driven, portable runtime for building microservices on cloud and edge. Any language, any framework, anywhere.

Dapr is a portable, serverless, event-driven runtime that makes it easy for developers to build resilient, stateless and stateful microservices that run on the cloud and edge and embraces the diversity of languages and developer frameworks.

Dapr codifies the best practices for building microservice applications into open, independent, building blocks that enable you to build portable applications with the language and framework of your choice. Each building block is independent and you can use one, some, or all of them in your application.

Dapr injects a side-car (container or process) to each compute unit. The side-car interacts with event triggers and communicates with the compute unit via standard HTTP or gRPC protocols. This enables Dapr to support all existing and future programming languages without requiring you to import frameworks or libraries.

Dapr offers built-in state management, reliable messaging (at least once delivery), triggers and bindings through standard HTTP verbs or gRPC interfaces. This allows you to write stateless, stateful and actor-like services following the same programming paradigm. You can freely choose consistency model, threading model and message delivery patterns.

Dapr runs natively on Kubernetes, as a self hosted binary on your machine, on an IoT device, or as a container that can be injected into any system, in the cloud or on-premises.

Dapr uses pluggable component state stores and message buses such as Redis as well as gRPC to offer a wide range of communication methods, including direct dapr-to-dapr using gRPC and async Pub-Sub with guaranteed delivery and at-least-once semantics.

Features:
- Event-driven Pub-Sub system with pluggable providers and at-least-once semantics
- Input and output bindings with pluggable providers
- State management with pluggable data stores
- Consistent service-to-service discovery and invocation
- Opt-in stateful models: Strong/Eventual consistency, First-write/Last-write wins
- Cross platform virtual actors
- Secrets management to retrieve secrets from secure key vaults
- Rate limiting
- Built-in Observability support
- Runs natively on Kubernetes using a dedicated Operator and CRDs
- Supports all programming languages via HTTP and gRPC
- Multi-Cloud, open components (bindings, pub-sub, state) from Azure, AWS, GCP
- Runs anywhere, as a process or containerized
- Lightweight (58MB binary, 4MB physical memory)
- Runs as a sidecar - removes the need for special SDKs or libraries
- Dedicated CLI - developer friendly experience with easy debugging
- Clients for Java, .NET Core, Go, Javascript, Python, Rust and C++

https://dapr.io/

#devops #go #k8s
​​ASCII art is also known as "computer text art". It involves the smart placement of typed special characters or letters to make a visual shape that is spread over multiple lines of text.

ART is a #python lib for text converting to ASCII art fancy. ;-)

https://github.com/sepandhaghighi/art
Put your Nginx inside a bunker! nginx Docker image secure by default.

Avoid the hassle of following security best practices each time you need a web server or reverse proxy. Bunkerized-nginx provides generic security configs, settings and tools so you don't need to do it yourself.

Non-exhaustive list of features :
- HTTPS support with transparent Let's Encrypt automation
- State-of-the-art web security : HTTP security headers, php.ini hardening, prevent leaks, ...
- Integrated ModSecurity WAF with the OWASP Core Rule Set
- Automatic ban of strange behaviors with fail2ban
- Antibot challenge through cookie, javascript, captcha or recaptcha v3
- Block TOR, proxies, bad user-agents, countries, ...
- Perform automatic DNSBL checks to block known bad IP
- Prevent bruteforce attacks with rate limiting
- Detect bad files with ClamAV
- Easy to configure with environment variables

https://github.com/bunkerity/bunkerized-nginx

#devops #docker
​​Validate, define, and use dynamic and text-based data.

CUE is an open source language, with a rich set of APIs and tooling, for defining, generating, and validating all kinds of data: configuration, APIs, database schemas, code, … you name it.

Features:
- Data Validation. Validate text-based data files or programmatic data such as incoming RPCs or database documents.
- Configuration. Just add validation to existing data (CUE, YAML, JSON), reduce boilerplate in large-scale configurations, or both.
- Schema Definition. Define schema to communicate an API or standard and validate backwards compatibility.
- Generate Code and Schema. Keep validation code in sync across code bases, Protobuf definitions, and OpenAPI definitions.
- Scripting. Automate the use of your data without writing yet another tool.
- Querying. Find the locations of instances of CUE types and values in data. Coming soon.

https://cuelang.org/

#devops #go #noyaml
​​Gitkube is a tool for building and deploying Docker images on Kubernetes using git push.

After a simple initial setup, users can simply keep git push-ing their repos to build and deploy to Kubernetes automatically.

Features:
- No dependencies except native tooling (git, kubectl)
- Plug and play installation
- Simple public key based authentication
- RBAC ready - Control access to git remotes using RBAC
- Support for namespace based multi-tenancy - Remotes can only deploy to their own namespace
- No assumptions about repository structure

https://github.com/hasura/gitkube

#go #devops #k8s
​​Compile #elixir applications into single, easily distributed executable binaries.

Bakeware extends Mix releases with the ability to turn Elixir projects into single binaries that can be copied and directly run. No need to install Erlang or untar files. The binaries look and feel like the build-products from other languages.

Here's a quick list of features:
- Simple - add the bakeware dependency and the Bakeware assembler to your Mix release settings
- Supports OSX and Linux (We wrote the code with Windows and the BSDs in mind, so support for those platforms may not be far off)
- Zstd compression for small binaries
- Optional support for automatic software updates
- Commandline argument passing conveniences
- Lots of examples

https://github.com/bake-bake-bake/bakeware
​​Instant GraphQL API for PostgreSQL written in #python.

Reflect a highly performant GraphQL API from an existing PostgreSQL database.

Nebulo is a python library for building GraphQL APIs on top of PostgreSQL. It has a command line interface for reflecting databases with 0 code or can be added to existing SQLAlchemy projects.

https://github.com/olirice/nebulo

Turn neb run -c postgresql://nebulo_user:password@localhost:4443/nebulo_db into:
​​Higher Kinded Types in #python!

I am happy to announce that the first version of Higher Kinded Types
emulation is released with full mypy support as a part of
dry-python/returns@0.15.

Source code and docs: https://github.com/dry-python/returns
Try it: https://gist.github.com/sobolevn/7f8ffd885aec70e55dd47928a1fb3e61

In the nearest future, we will share some practical libraries using HKTs in Python, including type-safe business-validation, smart and simple framework-agnostic REST framework, and so on! This is a big day for Python and its ecosystem.

In this article I am going to show how HKT works and why it is useful.