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 слични објави

Пребарај: #summarize

当前筛选 #summarize清除筛选
GitHub Trends

@githubtrending · Post #15499 · 17.02.2026 г., 13:30

#typescript#ai#cli#summarize#typescript Summarize is a fast tool for summarizing URLs, PDFs, images, audio/video, YouTube, and podcasts via Chrome Side Panel (with chat and history), Firefox Sidebar, or CLI. Install the extension from Chrome Web Store, add the local daemon with `npm i -g @steipete/summarize` and `summarize daemon install --token <TOKEN>`, then get one-click summaries, YouTube slides with OCR/timestamps, streaming Markdown, and media transcription. It saves time by quickly digesting long content so you focus on key insights without reading everything. https://github.com/steipete/summarize

Graph Messenger

@graphmessenger · Post #488 · 03.06.2025 г., 08:15

✨AI Tools for Sending Message Unlock AI Power in Your Chat! Just type your message and use the AI tools directly within this chat. Get instant summaries, rewrites, and more! Let's get started! ✍️Summarize 📝Rewrite 😉Add Emoji to the Text 🔎Explaining Subject ❤️Graph Messenger 11.20.0 🗓Added from: June 2, 2025 #features#ai#ai_tools#chat #summarize#rewrite @GraphMessenger @GraphMessengerTips

Graph Messenger

@graphmessenger · Post #489 · 03.06.2025 г., 08:17

✨AI Tools Supercharge Your Conversations with AI! Want to summarize a message, obtain key points of the message, explain the subject of the message, or rewrite something for clarity? Use our AI tools right here in the chat! ✍️Summarize Message 🗂Obtain Key Points of the message 🔎Explanation of the message subject 📝Rewrite Message 😉Add Emoji to the Text ❤️Graph Messenger 11.20.0 🗓Added from: June 2, 2025 #features#ai#ai_tools#chat #summarize#key_points#explain @GraphMessenger @GraphMessengerTips