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
#tailwindCss#frontend
Tailwind bilan animatsiyalarni yanada chiroyli qiling!
CSS’da murakkab easing funksiyalarini yozib o‘tirish shart emas. Origin UI sizga 20+ tayyor animatsiya sinflarini taqdim etadi.
✅ Faqat kerakli klassni nusxalaysiz va loyihangizga qo‘shib qo‘yasiz — hammasi tayyor!
Frontend loyihalaringizni jonlantirish uchun juda qulay.
🔗 Ko‘rib chiqing: originui.com/easings
💻@dasturlash_hayoti— Dasturchilar uchun eng kerakli maslahatlar va foydali kontent
#typescript#svelte#sveltekit#tailwindcss#tauri
Epicenter is a free, open-source set of local-first apps that let you own and control your data by storing everything—notes, transcripts, chats—in one simple folder using plain text and SQLite. You can use any AI model you want, customize tools, and access your data anywhere without relying on cloud services. Key apps include Whispering, which transcribes your speech locally, and epicenter.sh, a personal assistant that helps you search and interact with your data. This setup gives you privacy, flexibility, and full control over your information, avoiding locked, siloed apps and data traps. It’s great for anyone who values data ownership and open software.
https://github.com/epicenter-so/epicenter