Блог*
Kanalga Telegram’da o‘tish
Блог со звёздочкой. Много репостов, немножко программирования. Небольшое прикольное комьюнити: @decltype_chat_ptr_t Автор: @insert_reference_here
Ko'proq ko'rsatish1 924
Obunachilar
-124 soatlar
-17 kunlar
-130 kunlar
Postlar arxiv
1 923
#prog #typescript #article
How types make hard problems easy (перевод)
Статья ценна тем, что демонстрирует выгоды на Typescript и относительно реалистичных примерах. Отправьте знакомому фронтендеру, может, научиться программировать наконец
1 923
#prog #article
Preemptive Pluralization is (Probably) Not Evil
Before you write any code — ask if you could ever possibly want multiple kinds of the thing you are coding. If yes, just do it. Now, not later.
<...>It is a LOT easier to scale code from a cardinality of 2 to 3 than it is to refactor from a cardinality of 1 to 2. This is a fundamentally under-appreciated nonlinearity. In other words, Preemptive Pluralization can make the difference between “sure, I’ll add that today” and “this is going to take us 2 months and we’ll introduce merge conflicts with every other in-progress feature.”
1 923
#ml #article
The Bitter Lesson
Прочитайте, если вы хоть немного заинтересованы в машинном обучении, это весьма короткий текст.
The biggest lesson that can be read from 70 years of AI research is that general methods that leverage computation are ultimately the most effective, and by a large margin.
<...>researchers always tried to make systems that worked the way the researchers thought their own minds worked---they tried to put that knowledge in their systems---but it proved ultimately counterproductive, and a colossal waste of researcher's time, when, through Moore's law, massive computation became available and a means was found to put it to good use.
1 923
#prog #ml #article
Reverse Engineering a Neural Network's Clever Solution to Binary Addition (перевод)
<...> So, I started trimming the network down - removing layers and reducing the number of neurons in each layer.
To my continued surprise, it kept working! At some point perfect solutions became less common as networks become dependent on the luck of their starting parameters, but I was able to get it to learn perfect solutions with as few as 3 layers with neuron counts of 12, 10, and 8 respectively. That's just 422 total parameters!
Автор ожидал, что нейросеть изобретёт что-то вроде двоичного сумматора. Он ошибся.
1 923
#prog #article #abnormalprogramming
Can you fit Minecraft in a QR code?
Answer: Yes! Here it is:
1 923
Repost from Install Wizard
Дегенеративное поделие Паши Дурова, в котором я сейчас посщу, настойчиво отказывает мне в загрузке видео с котами через Bot API, после того, как мне пришлось перелезть через три костыля, чтобы заставить инлайн-бот работать
Других новостей у меня для вас нету
1 923
Repost from N/a
Как же тяжело яндексу даётся иметь больше одного приложения. Вот, уведомление про кино зачем-то в приложении недвижимости завели
Ну ничего, объединят всё в яндекс гооол — заживут
1 923
Я плохо понимаю, как вообще создаются инди-видеоигры.
Почему? Потому что инди-игры делают в основном художники и программисты. При этом художники не умеют программировать, а а программисты не умеют делать собственно игру вместо игрового движка.
1 923
Repost from Находки в опенсорсе
Статический анализ GitHub Actions
Сразу после релиза новой версии линтера, я задался вопросом обновления своего шаблона для создания новых питоновских библиотек: https://github.com/wemake-services/wemake-python-package
И я понял, что я несколько отстал в вопросе стат анализа GitHub Actions и прочей инфраструктуры.
Расскажу о своих находках.
pre-commit ci
Все знают про пакет pre-commit? Несколько лет назад он получил еще и свой собственный CI, который умеет запускаться без дополнительного конфига. И автоматически пушить вам в ветку любые изменения. Что супер удобно для всяких
ruff / black / isort и прочего. У нас такое стоит в большом количестве проектов. Вот пример из typeshed. Вот что поменялось автоматически.
Строить CI на базе pre-commit очень удобно, потому что тебе просто нужно скопировать пару строк в конфиг. А плюсов много:
- Автоматически исправляются многие проблемы
- Автоматически запускается CI, 0 настроек
- Локально все тоже работает одной командой: pre-commit run TASK_ID -a
actionlint
Первый раз я увидел actionlint внутри CPython и затащил его в mypy. Actionlint на #go, он предлагает набор проверок для ваших GitHub Actions от безопасности до валидации спеки вашего yml. Довольно полезно, позволяет найти много мест для улучшений.
test.yaml:3:5: unexpected key "branch" for "push" section. expected one of "branches", ..., "workflows" [syntax-check]
|
3 | branch: main
| ^~~~~~~
test.yaml:10:28: label "linux-latest" is unknown. available labels are "macos-latest", ..., "windows". if it is a custom label for self-hosted runner, set list of labels in actionlint.yaml config file [runner-label]
|
10 | os: [macos-latest, linux-latest]
| ^~~~~~~~~~~~~
test.yaml:13:41: "github.event.head_commit.message" is potentially untrusted. avoid using it directly in inline scripts. instead, pass it through an environment variable. see https://docs.github.com/en/actions/security-for-github-actions/security-guides/security-hardening-for-github-actions for more details [expression]
|
13 | - run: echo "Checking commit '${{ github.event.head_commit.message }}'"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Даже умеет автоматом shellcheck запускать на ваши run: скрипты!
zizmor
Исходники. Уже на #rust, он более злой. Делает похожие вещи: находит проблемы безопасности. Находит много проблем.
Вот пример, сколько всего он нашел в mypy.
warning[artipacked]: credential persistence through GitHub Actions artifacts --> mypy/.github/workflows/mypy_primer.yml:37:9 | 37 | - uses: actions/checkout@v4 | _________- 38 | | with: 39 | | path: mypy_to_test 40 | | fetch-depth: 0 | |________________________- does not set persist-credentials: false | = note: audit confidence → Low error[dangerous-triggers]: use of fundamentally insecure workflow trigger --> mypy/.github/workflows/mypy_primer_comment.yml:3:1 | 3 | / on: 4 | | workflow_run: ... | 7 | | types: 8 | | - completed | |_________________^ workflow_run is almost always used insecurely | = note: audit confidence → Mediumcheck-jsonschema Еще есть вот такой проект, он в основном полезен за счет доп интеграций: можно проверять
dependabot.yml, renovate.yml, readthedocs.yml и многое другое.
Ставится просто как:
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.30.0
hooks:
- id: check-dependabot
- id: check-github-workflows
Выводы
Как всегда – статический анализ многому меня научил. Я узнал много нового про безопасность GitHub Actions, про вектора атаки, про лучшие практики. А сколько проблем в ваших actions?
Скоро ждите весь новый тулинг в python шаблоне v2025 😎
Endi mavjud! Telegram Tadqiqoti 2025 — yilning asosiy insaytlari 
