Skip to content

Instantly share code, notes, and snippets.

@sobolevn
sobolevn / rules.md
Created September 14, 2023 11:12
Правила MoscowPython Discord

Правила сообщества MoscowPython Discord

Адрес чата: https://discord.gg/tNxbPpDchQ

О чём можно

  • мероприятия и проекты сообщества
  • Python и сопутствующая экосистема
  • новости, которые хотя бы косвенно связаны с Python
  • мир разработки вокруг
import ast
import argparse
import os
import sys
import tokenize
from dataclasses import dataclass
from typing import Final, TypeAlias
_AnyFunction: TypeAlias = ast.FunctionDef | ast.AsyncFunctionDef
@sobolevn
sobolevn / setup.cfg
Created May 31, 2023 14:26
flake8 configuration example
[flake8]
# Base flake8 configuration:
# https://flake8.pycqa.org/en/latest/user/configuration.html
format = wemake
show-source = true
statistics = false
doctests = true
# darglint configuration:
# https://github.com/terrencepreilly/darglint

Правила сообщества PythoNN

Адрес чата: t.me/pytho_nn

О чём можно

  • мероприятия и проекты сообщества
  • Python и сопутствующая экосистема
  • новости, которые хотя бы косвенно связаны с Python
  • мир разработки вокруг
@sobolevn
sobolevn / iptables.sh
Created March 9, 2017 14:15 — forked from thomasfr/iptables.sh
iptable rules to allow outgoing DNS lookups, outgoing icmp (ping) requests, outgoing connections to configured package servers, outgoing connections to all ips on port 22, all incoming connections to port 22, 80 and 443 and everything on localhost
#!/bin/bash
IPT="/sbin/iptables"
# Server IP
SERVER_IP="$(ip addr show eth0 | grep 'inet ' | cut -f2 | awk '{ print $2}')"
# Your DNS servers you use: cat /etc/resolv.conf
DNS_SERVER="8.8.4.4 8.8.8.8"
# Allow connections to this package servers

Intro

Working with open-source software is now a regular part of our lives. We can now say that open-source software has major market shares in almost all fields.

Verifying what is going on inside an application by yourself is especially important in DeFi, where transparency and openness are key philosophical factors. For example, any third-party security researcher can audit and verify the state of security of any open-source project. This creates a lot of trust among end users and other developers.

Everyone can help to improve the software they use if needed, which creates a connection between developers and forms a community around a piece of software.

{
"env": {
"node": true,
"browser": true,
"es6": true
},
"globals": {
"document": false,
"navigator": false,
"window": false
#!/usr/bin/env python3.8
# @generated by pegen from python.gram
import ast
import sys
import tokenize
from typing import Any, Optional
from pegen.parser import memoize, memoize_left_rec, logger, Parser
@sobolevn
sobolevn / hkt_in_python.py
Last active May 30, 2022 20:04
Higher Kinded Types in Python
import abc
import dataclasses
from typing import Callable, Generic, TypeVar
# TODO: pip install returns
# TODO: add `returns.contrib.mypy.returns_plugin` to mypy plugins
# TODO: read the docs at https://github.com/dry-python/returns
from returns.primitives.hkt import Kind1, SupportsKind1, kinded
_ValueType = TypeVar('_ValueType')