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

TGINSIGHT SIMILAR POSTS

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

Изворен канал @pythonotes · Post #411 · 9 фев.

reload_flag="" if [[ -n "${DEBUG}" ]]; then reload_flag="--reload" fi if [[ -n "${WORKER_COUNT}" ]]; then workers=${WORKER_COUNT} else workers=2 fi gunicorn --workers ${workers} \ --bind 0.0.0.0:8000 \ ${reload_flag} main.wsgi Писали такие конструкции чтобы проверить наличие флага и сформировать команду правильно? На самом деле можно сделать тоже самое проще. Для этого используются операторы условной подстановки, доступные в оболочках семейства POSIX. :- для установки значений по умолчанию ${WORKER_COUNT:-2} Если переменная не объявлена, то будет дефолтное значение 2. :+ подставляет указанный текст, если переменная не пуста ${DEBUG:+--reload} Если что-то есть в переменной то распечатается текст после символа +, в противном случае - ничего. Удобно для опциональных флагов, как в нашем примере. Итого наш скрипт может выглядеть так: gunicorn --workers ${WORKER_COUNT:-2} \ --bind 0.0.0.0:8000 \ ${DEBUG:+--reload} main.wsgi Есть еще два оператора. := не только подставить дефолтное значение, но и присвоить его переменной, если она пуста # никаких переменных еще нет VAL1=${VAL2:=hello} # теперь доступны обе echo $VAL1 $VAL2 # hello hello :? остановить выполнение с ошибкой, если переменной нет. echo ${MISS:?is required} bash: MISS: is required Код выхода будет 1. #tricks#linux

Резултати

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

Пребарај: #rice

当前筛选 #rice清除筛选

📊Las clasificaciones de Ben Rice en 1B esta temporada: AVG: 1º (.330) HR: 2º (11) Carreras: T-1º (27) OBP: 1º (.444) SLG: 1º (.740) OPS: 1º (1.184) wRC+: 1º (216) fWAR: 1º (1.8) Rice está absolutamente arrasando 🍚 #Rice#Stats 🗞 | t.me/MLB_Daily

Hashtags

Amazing Geography 🌍

@amazingeo · Post #484 · 29.11.2025 г., 20:31

🌍 In China's southern hills, vast terraces transform mountains into rice fields. These hand-carved steps let farmers grow crops high above valleys, creating some of the world’s most scenic farmland. ✨ #agriculture⚡#landscapes⚡#rice⚡#geography⚡#nature⚡#earth 👉subscribe Amazing Geography 👉more Channels ​

Amazing Geography 🌍

@amazingeo · Post #116 · 25.08.2025 г., 20:12

🌍 The ancient rice terraces of Banaue in the Philippines were built over 2,000 years ago. These stepped fields help prevent soil erosion and create new habitats for plants and animals. ✨ #rice⚡#terraces⚡#agriculture⚡#Philippines⚡#geography⚡#nature⚡#earth 👉subscribe Amazing Geography🌍 ​

GitHub Trends

@githubtrending · Post #15286 · 10.11.2025 г., 14:00

#qml#dotfiles#hyprland#linux#material_design#quickshell#rice#ricing#unixporn#wayland This Hyprland dotfiles setup gives you a modern, easy-to-use Linux desktop with features like a live app overview, AI integration (Gemini and Ollama), and automatic, beautiful color themes that match your wallpaper. Installation is simple with a one-line command, and the default keybinds are familiar if you’ve used Windows or GNOME. The system uses Quickshell for widgets (not Waybar), shows every command during setup for transparency, and offers a friendly Discord community for help. You benefit from a polished, customizable environment that’s both visually appealing and practical, with support for new users and advanced customization options. https://github.com/end-4/dots-hyprland