TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #183 · 23 ное.

Python + bash Если вам часто требуется запускать shell команды из Python-кода, какой способ вы используете? Самый низкоуровневый это функция os.system(), либо os.popen(). Рекомендованный способ это subprocess.call(). Но это всё еще достаточно неудобно. Советую обратить своё внимание на очень крутую библиотеку sh. Что она умеет? 🔸 удобный синтаксис вызова команд как функций # os import os os.system("tar cvf demo.tar ~/") # subprocess import subprocess subprocess.call(['tar', 'cvf', 'demo.tar', '~/']) # sh import sh sh.tar('cvf', 'demo.tar', "~/") 🔸 простое создание функции-алиаса для длинной команды fn = sh.lsof.bake('-i', '-P', '-n') output = sh.grep(fn(), 'LISTEN') в этом примере также задействован пайпинг 🔸 удобный вызов команд от sudo with sh.contrib.sudo: print(ls("/root")) Такой запрос спросит пароль. Чтобы это работало нужно соответствующим способом настроить юзера. А вот вариант с вводом пароля через код. password = "secret" sudo = sh.sudo.bake("-S", _in=password+"\n") print(sudo.ls("/root")) Это не все фишки. Больше интересных примеров смотрите в документации. Специально для Windows💀 юзеров #libs#linux

Hashtags

Резултати

Пронајдени 3 слични објави

Пребарај: #middleware

当前筛选 #middleware清除筛选
djangoproject

@djangoproject · Post #518 · 10.12.2017 г., 10:01

The library allows us to store user-specific data into a #session object. The session object has a dict-like interface (operations like session[key] = value, value = session[key] etc. are present). Before processing the session in a web-handler, you have to register the session #middleware in #aiohttp.web.Application. https://github.com/aio-libs/aiohttp-session

GitHub Trends

@githubtrending · Post #15043 · 09.08.2025 г., 12:30

#go#2fa#authentication#caddy#golang#middleware#nginx#selfhosted#sso#totp#traefik_middleware#typescipt Tinyauth is a simple tool that adds a login screen or OAuth login (Google, Github, etc.) to your Docker apps, making them secure easily. It works with popular reverse proxies like Traefik, Nginx, and Caddy. You can quickly set it up using their documentation and demo, and it supports basic authentication and API access. This helps protect your apps from unauthorized access without complex setup. It’s open source, actively developed, and has a helpful community on Discord for support. Using Tinyauth improves your app security with minimal effort and flexible login options. https://github.com/steveiliop56/tinyauth

GitHub Trends

@githubtrending · Post #15204 · 08.10.2025 г., 11:30

#java#cloud#coap#dashboard#iot#iot_analytics#iot_platform#iot_solutions#java#kafka#lwm2m#microservices#middleware#mqtt#netty#platform#snmp#thingsboard#visualization#websockets#widgets ThingsBoard is an open-source IoT platform that helps manage and analyze data from connected devices. It allows users to collect data, create real-time dashboards, and automate tasks using a powerful rule engine. This platform supports various protocols like MQTT and HTTP, making it easy to connect devices. Users can also define relationships between devices and assets, and trigger alarms based on specific conditions. The benefit is that it simplifies IoT project development, making it scalable and efficient for applications like smart farming, smart offices, and more. https://github.com/thingsboard/thingsboard