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

Резултати

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

Пребарај: #makeadifference

当前筛选 #makeadifference清除筛选
NewUU Student Council

@newuu_sc · Post #1460 · 08.02.2025 г., 07:37

🌍 SDG Week: The SDG Nexus – Connecting People and Purpose 🌱 Get ready for an inspiring journey towards a sustainable future! 🌏✨ Join us at Webster University in Tashkent for SDG Week, where you’ll engage with global experts, take part in interactive workshops, and explore how YOU can make a difference in achieving the Sustainable Development Goals. 📆Date: February 10-12 📍Location: Webster University in Tashkent 🕛Time: 12:00 p.m. What to Expect? 📅Day 1: Opening Conference & Networking 🎤 Kick off SDG Week with a powerful conference featuring 5 international universities, a United Nations representative, and leading experts in the field of SDGs. 🤝 Connect with like-minded individuals passionate about sustainability and change. 📅Day 2: Eco Health & Sport Day 🌱 Learn from eco-activist Urikguli (Mutabar Xushvaqtova) in an engaging workshop on environmental sustainability and its impact on our well-being. ⚽ The session will be followed by exciting sports matches to promote health and sustainability. 📅Day 3: Hands-On Workshops & Action Planning 💡 Dive deeper into real-world solutions through interactive workshops, where you’ll develop actionable strategies to contribute to sustainable development. 🍕Special snacks will be provided between networking sessions!🤫 🚀Want to actively contribute to the event? If you have an idea, project, or expertise related to the SDGs and would like to be a part of the program as a speaker, organizer, or contributor, fill out this form: 📢Contribute to SDG Week:https://forms.gle/ReaaTpPMP5W41KwW8 🔗Register as a participant:https://forms.office.com/r/QVFg4ZFZy8?origin=lprLink 📢Join the SDG Club:https://t.me/sdgclubwebster #SDGWeek#SustainableDevelopment#MakeADifference#PeopleAndPurpose

INHA University in Tashkent

@inha_uz · Post #8528 · 20.01.2025 г., 12:05

🌟 Join Us in Supporting the Children’s Hospice! 🌟 🗓Date: 25th of January 📍 Gathering Point: INHA University at 9:00 AM This event is dedicated to bringing love, care, and support to children in the hospice during their most challenging times. Let's come together to make a difference in their lives! ❤️ Your contributions and time as a volunteer can truly bring hope and smiles. 💬How to Help: ✅ Donate: Every little contribution matters 9860 3501 4923 6621(Aleksandra Kim) ✅ Volunteer: Be part of this meaningful event. For more details: @iut_charityy Let’s create a wave of kindness and show these children that they are not alone! 💕 #CharityEvent#ChildrenHospice#Volunteer#IUTCharity#MakeADifference

Real Eco Committee

@real_eco · Post #4 · 15.04.2026 г., 07:56

🌱 Join our Eco Committee! Want to make a real difference for the environment? 🌍💚 If you're interested in being part of our project, come to our Thursday school eco volunteering meeting! Let’s work together for a greener future 🌿✨ #EcoCommittee#EcoClub#GoGreen#Sustainability#SaveThePlanet#EcoFriendly#SchoolLife#Volunteer#ClimateAction#GreenFuture#EnvironmentalAwareness#ActNow#StudentsForChange#MakeADifference#EcoWarriors