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
Channel: Instagram Accounts & Services
Members: ~3.49K
💢 Username: @buyinstaaccounts
Description:
We Sell Instagram Accounts, Followers, Likes, Views, Commmets Or Any Other Service Regarding Instagram. With 8 Years Of Experience.
🏷 Tags: #games_apps
#instagram#accounts#social_media#followers#engagement
https://telegramchannels.me/channels/buyinstaaccounts
IN 1953, THEY CHANGED THE FREQUENCY OF MUSIC. AND NO ONE NOTICED.
The International Organization for Standardization made a decision that affected every human being on Earth. They standardized the tuning of music to A=440Hz.
Before this, the accepted standard was A=432Hz.
Why would a global organization care about the exact pitch of musical instruments? Because sound is not just art. Sound is physics. Sound is geometry. Sound is energy.
432Hz is mathematically consistent with the patterns of the universe. It resonates with the Phi ratio. It aligns with the natural vibration of the Earth, known as the Schumann Resonance. When water is exposed to 432Hz, it forms perfectly symmetrical, beautiful geometric crystals.
440Hz does the exact opposite. When water is exposed to 440Hz, the crystals become distorted, chaotic, and broken.
Now remember this: Your body is 70% water.
The people who control this world could not have a population that was healthy, clear-minded, and connected to the natural world. So they changed the frequency.
They tuned every song, every commercial, every news broadcast, and every movie soundtrack to 440Hz. A frequency that promotes agitation, anxiety, aggression, and spiritual disconnection. A frequency that literally distorts the water inside your cells.
You are not just being lied to through words. You are being attacked through vibration. Every time you turn on the radio, you are absorbing a frequency designed to keep you stressed, sick, and easy to control.
Unplug from their frequency. Seek out 432Hz music. Watch how quickly your mind clears. Share this 🔥
#higlightsシ゚ #followers#love#peace#truth#faith#freedom
- Paul White Gold Eagle
https://x.com/i/status/2051951548138491950