Gopher Academy
3.34K subscribers
920 photos
40 videos
280 files
2.02K links
🕸 Gopher Academy

🔷interview golang
https://github.com/mrbardia72/Go-Interview-Questions-And-Answers

حمایت مالی:
https://www.coffeete.ir/mrbardia72

ادمین:
@mrbardia72
Download Telegram
چرا نبود مهندسین بیشتر در تلگرام موجب مشکلات امنیتی می‌شود؟

پاول دورف در مصاحبه‌ای که چندی پیش انجام داده‌بود، اشاره کرد که پیام‌رسان تلگرام تنها از ۳۰ مهندس بهره می‌گیرد و خود وی شخصاً به‌عنوان مدیر محصول روی عملکرد آن نظارت دارد. اکنون کارشناسان امنیتی هشدار داده‌اند که تعداد پایین کارمندان تلگرام نه‌تنها به‌معنی بهینه‌بودن آن نیست، بلکه می‌تواند مشکلات امنیتی را در پی داشته‌باشد.

https://digiato.com/security/telegrams-30-engineers-team-is-a-security-red-flag


👑 @gopher_academy | 💸 Donate | 💋 Boost
👍5🍓2💅2🎃1
✍️استراتژی های اسکیل کردن در کوبر


1️⃣. Horizontal Pod Autoscaling (HPA):
Automatically scales the number of pods in a deployment or replica set based on observed CPU utilization or other select metrics.

2️⃣. Vertical Pod Autoscaling (VPA):
Automatically adjusts the CPU and memory resources allocated to pods in a deployment or replica set.

3️⃣. Cluster Autoscaling:
Dynamically adjusts the number of nodes in a Kubernetes cluster based on the demands of the workloads and resource availability.

4️⃣. Manual Scaling:
Involves manually setting the number of replicas in a deployment or replica set, using a command like
kubectl scale --replicas=desired_replica_count object_type/object_name


5️⃣. Predictive Scaling:
Uses advanced algorithms and AI, like in PredictKube, to forecast future demand and proactively scale resources before they are needed.



👑 @gopher_academy | 💸 Donate | 💋 Boost
👍3
💜بن بست چیه اصلن توی این قسمت در مورد انواع حالت بن بست صحبت میشه
.
.
A deadlock occurs when two or more transactions are waiting for each other to release locks on resources they need to continue processing. This results in a situation where neither transaction can proceed, and they end up waiting indefinitely.

🔹 Coffman Conditions
The Coffman conditions, named after Edward G. Coffman, Jr., who first outlined them in 1971, describe four necessary conditions that must be present simultaneously for a deadlock to occur:

- Mutual Exclusion
- Hold and Wait
- No Preemption
- Circular Wait

🔹 Deadlock Prevention
- Resource ordering: impose a total ordering of all resource types, and require that each process requests resources in a strictly increasing order.

- Timeouts: A process that holds resources for too long can be rolled back.

- Banker’s Algorithm: A deadlock avoidance algorithm that simulates the allocation of resources to processes and helps in deciding whether it is safe to grant a resource request based on the future availability of resources, thus avoiding unsafe states.

🔹 Deadlock Recovery
- Selecting a victim: Most modern Database Management Systems (DBMS) and Operating Systems implement sophisticated algorithms for detecting deadlocks and selecting victims, often allowing customization of the victim selection criteria via configuration settings. The selection can be based on resource utilization, transaction priority, cost of rollback etc.

- Rollback: The database may roll back the entire transaction or just enough of it to break the deadlock. Rolled-back transactions can be restarted automatically by the database management system.


👑 @gopher_academy | 💸 Donate | 💋 Boost
1👍1🕊1
با افتخار ما ایرانی‌ها در رده بندی آی‌کیو در جهان سومیم، امیدوارم یه روزی بیاد که لااقل حس کنیم ما از این پتانسیل استفاده کردیم برای ایران
حیف این هوش که هدر بره. این بزرگترین سرمایه‌ی ماست

👑 @gopher_academy
🔥15🎃144💊2
✍️یه سری نمونه سوال مصاحبه ای در لینوکس

𝟏. 𝐈𝐟 𝐲𝐨𝐮 𝐰𝐚𝐧𝐭 𝐭𝐨 𝐫𝐮𝐧 𝐚 𝐭𝐚𝐬𝐤/𝐬𝐜𝐫𝐢𝐩𝐭 𝐢𝐧 𝐛𝐚𝐜𝐤𝐠𝐫𝐨𝐮𝐧𝐝 𝐞𝐯𝐞𝐧 𝐢𝐟 𝐲𝐨𝐮 𝐜𝐥𝐨𝐬𝐞 𝐲𝐨𝐮𝐫 𝐭𝐞𝐫𝐦𝐢𝐧𝐚𝐥, 𝐰𝐡𝐚𝐭 𝐢𝐬 𝐭𝐡𝐞 𝐰𝐚𝐲?
Ans: Using nohup command

𝟐. 𝐖𝐡𝐢𝐜𝐡 𝐜𝐨𝐦𝐦𝐚𝐧𝐝 𝐝𝐢𝐬𝐩𝐥𝐚𝐲𝐬 𝐢𝐧𝐟𝐨𝐫𝐦𝐚𝐭𝐢𝐨𝐧 𝐚𝐛𝐨𝐮𝐭 𝐤𝐞𝐫𝐧𝐞𝐥-𝐫𝐞𝐥𝐚𝐭𝐞𝐝 𝐦𝐞𝐬𝐬𝐚𝐠𝐞𝐬 𝐚𝐥𝐨𝐧𝐠 𝐰𝐢𝐭𝐡 𝐡𝐚𝐫𝐝𝐰𝐚𝐫𝐞 𝐚𝐧𝐝 𝐬𝐲𝐬𝐭𝐞𝐦 𝐬𝐭𝐚𝐫𝐭𝐮𝐩 𝐦𝐞𝐬𝐬𝐚𝐠𝐞𝐬 𝐬𝐭𝐨𝐫𝐞𝐝 𝐢𝐧 𝐤𝐞𝐫𝐧𝐞𝐥 𝐫𝐢𝐧𝐠 𝐛𝐮𝐟𝐟𝐞𝐫?
Ans: dmesg command

𝟑. 𝐖𝐡𝐢𝐜𝐡 𝐜𝐨𝐦𝐦𝐚𝐧𝐝 𝐜𝐚𝐧 𝐲𝐨𝐮 𝐮𝐬𝐞 𝐭𝐨 𝐝𝐢𝐬𝐩𝐥𝐚𝐲 𝐚 𝐥𝐢𝐬𝐭 𝐨𝐟 𝐜𝐮𝐫𝐫𝐞𝐧𝐭𝐥𝐲 𝐜𝐨𝐧𝐟𝐢𝐠𝐮𝐫𝐞𝐝 𝐏𝐡𝐲𝐬𝐢𝐜𝐚𝐥 𝐕𝐨𝐥𝐮𝐦𝐞𝐬?
Ans: lvs command

𝟒. 𝐖𝐡𝐢𝐜𝐡 𝐜𝐨𝐦𝐦𝐚𝐧𝐝 𝐝𝐢𝐬𝐩𝐥𝐚𝐲𝐬 𝐦𝐞𝐦𝐨𝐫𝐲 𝐮𝐬𝐚𝐠𝐞, 𝐢𝐧𝐜𝐥𝐮𝐝𝐢𝐧𝐠 𝐭𝐡𝐞 𝐚𝐦𝐨𝐮𝐧𝐭
𝐨𝐟 𝐬𝐰𝐚𝐩 𝐬𝐩𝐚𝐜𝐞 𝐛𝐞𝐢𝐧𝐠 𝐮𝐬𝐞𝐝?
Ans: free command

𝟓. 𝐓𝐡𝐞 /𝐡𝐨𝐦𝐞 𝐩𝐚𝐫𝐭𝐢𝐭𝐢𝐨𝐧 𝐢𝐬 𝐫𝐮𝐧𝐧𝐢𝐧𝐠 𝐨𝐮𝐭 𝐨𝐟 𝐝𝐢𝐬𝐤 𝐬𝐩𝐚𝐜𝐞. 𝐖𝐡𝐢𝐜𝐡 𝐜𝐨𝐦𝐦𝐚𝐧𝐝 𝐜𝐚𝐧 𝐲𝐨𝐮 𝐮𝐬𝐞 𝐭𝐨 𝐝𝐞𝐭𝐞𝐫𝐦𝐢𝐧𝐞 𝐰𝐡𝐢𝐜𝐡 𝐮𝐬𝐞𝐫'𝐬 𝐡𝐨𝐦𝐞 𝐝𝐢𝐫𝐞𝐜𝐭𝐨𝐫𝐲 𝐢𝐬 𝐮𝐬𝐢𝐧𝐠 𝐭𝐡𝐞 𝐦𝐨𝐬𝐭 𝐬𝐩𝐚𝐜𝐞?
Ans: we can use du command

𝟔. 𝐇𝐨𝐰 𝐭𝐨 𝐜𝐡𝐞𝐜𝐤 𝐲𝐨𝐮𝐫 𝐋𝐢𝐧𝐮𝐱 𝐅𝐢𝐥𝐞𝐒𝐲𝐬𝐭𝐞𝐦?
Ans: lsblk -f

𝟕. 𝐇𝐨𝐰 𝐭𝐨 𝐒𝐎𝐑𝐓 𝐭𝐡𝐞 𝐜𝐨𝐧𝐭𝐞𝐧𝐭 𝐟𝐫𝐨𝐦 𝐚 𝐟𝐢𝐥𝐞 𝐢𝐧 𝐋𝐢𝐧𝐮𝐱?
Ans: sort -r file

𝟖. 𝐇𝐨𝐰 𝐭𝐨 𝐝𝐢𝐬𝐩𝐥𝐚𝐲 𝐔𝐍𝐈𝐐𝐔𝐄 𝐜𝐨𝐧𝐭𝐞𝐧𝐭 𝐟𝐫𝐨𝐦 𝐚 𝐟𝐢𝐥𝐞 𝐢𝐧 𝐋𝐢𝐧𝐮𝐱?
Ans: sort file | uniq

𝟗. 𝐇𝐨𝐰 𝐭𝐨 𝐬𝐞𝐚𝐫𝐜𝐡 𝐦𝐮𝐥𝐭𝐢𝐩𝐥𝐞 𝐰𝐨𝐫𝐝𝐬 𝐚𝐧𝐝 𝐝𝐢𝐬𝐩𝐥𝐚𝐲 𝐦𝐚𝐭𝐜𝐡𝐢𝐧𝐠 𝐜𝐨𝐧𝐭𝐞𝐧𝐭 𝐟𝐫𝐨𝐦 𝐚 𝐟𝐢𝐥𝐞 𝐢𝐧 𝐋𝐢𝐧𝐮𝐱?
Ans: egrep "word1|word2" file

𝟏𝟎. 𝐇𝐨𝐰 𝐭𝐨 𝐂𝐎𝐔𝐍𝐓 𝐧𝐨. 𝐨𝐟 𝐥𝐢𝐧𝐞𝐬 𝐢𝐧 𝐚 𝐟𝐢𝐥𝐞 𝐢𝐧 𝐋𝐢𝐧𝐮𝐱?
Ans: wc -l file

𝟏𝟏. 𝐇𝐨𝐰 𝐭𝐨 𝐜𝐡𝐞𝐜𝐤 𝐢𝐟 𝐭𝐰𝐨 𝐟𝐢𝐥𝐞𝐬 𝐚𝐫𝐞 𝐢𝐝𝐞𝐧𝐭𝐢𝐜𝐚𝐥 𝐨𝐫 𝐧𝐨𝐭 𝐢𝐧 𝐋𝐢𝐧𝐮𝐱?
Ans: cmp fileA fileB

𝟏𝟐. 𝐇𝐨𝐰 𝐭𝐨 𝐜𝐨𝐦𝐩𝐚𝐫𝐞 𝐚𝐧𝐝 𝐝𝐢𝐬𝐩𝐥𝐚𝐲 𝐝𝐢𝐟𝐟𝐞𝐫𝐞𝐧𝐜𝐞 𝐛𝐞𝐭𝐰𝐞𝐞𝐧 𝐟𝐢𝐥𝐞𝐬 𝐢𝐧 𝐋𝐢𝐧𝐮𝐱?
Ans: diff -u fileA fileB

𝟏𝟑. 𝐇𝐨𝐰 𝐭𝐨 𝐫𝐞𝐜𝐨𝐫𝐝 𝐲𝐨𝐮𝐫 𝐚𝐜𝐭𝐢𝐯𝐢𝐭𝐲 𝐨𝐧 𝐭𝐞𝐫𝐦𝐢𝐧𝐚𝐥 𝐢𝐧 𝐚 𝐟𝐢𝐥𝐞?
Ans: script

𝟏𝟒. 𝐇𝐨𝐰 𝐭𝐨 𝐝𝐢𝐬𝐩𝐥𝐚𝐲 𝐬𝐭𝐚𝐫𝐭𝐢𝐧𝐠 𝐭𝐰𝐨 𝐜𝐡𝐚𝐫𝐚𝐜𝐭𝐞𝐫𝐬 𝐨𝐟 𝐚𝐥𝐥 𝐥𝐢𝐧𝐞?
Ans: cut -c1-2 file.txt

𝟏𝟓. 𝐇𝐨𝐰 𝐭𝐨 𝐝𝐢𝐬𝐩𝐥𝐚𝐲 𝐚 𝐬𝐩𝐞𝐜𝐢𝐟𝐢𝐜 𝐥𝐢𝐧𝐞 𝐟𝐫𝐨𝐦 𝐚 𝐟𝐢𝐥𝐞?
Ans: sed -n '5p' file.txt

𝟏𝟔. 𝐇𝐨𝐰 𝐭𝐨 𝐫𝐞𝐩𝐥𝐚𝐜𝐞 𝐚 𝐬𝐩𝐞𝐜𝐢𝐟𝐢𝐜 𝐰𝐨𝐫𝐝 𝐰𝐢𝐭𝐡𝐢𝐧 𝐚 𝐟𝐢𝐥𝐞?
Ans: sed -n 's/from/to/g' file.txt

𝟏𝟕. 𝐇𝐨𝐰 𝐭𝐨 𝐞𝐱𝐭𝐞𝐧𝐝 𝐬𝐢𝐳𝐞 𝐨𝐟 𝐚 𝐟𝐢𝐥𝐞 𝐰𝐢𝐭𝐡𝐨𝐮𝐭 𝐚𝐝𝐝𝐢𝐧𝐠 𝐚𝐧𝐲 𝐝𝐚𝐭𝐚?
Ans: truncate -s 100M file.txt

𝟏𝟖. 𝐇𝐨𝐰 𝐭𝐨 𝐜𝐡𝐞𝐜𝐤 𝐜𝐩𝐮/𝐜𝐨𝐫𝐞/𝐭𝐡𝐫𝐞𝐚𝐝 𝐢𝐧𝐟𝐨 𝐨𝐟 𝐲𝐨𝐮𝐫 𝐥𝐢𝐧𝐮𝐱 𝐬𝐞𝐫𝐯𝐞𝐫?
Ans: lscpu



👑 @gopher_academy | 💸 Donate | 💋 Boost
👍8💋1
سلسله مراتب رفتار برنامه نویس ها براساس سطح
🍻A beginner developer:
- Writes simple code
- Works slowly
- Makes mistakes in their code

🍻An experienced developer:
- Writes complex code
- Works quickly
- Makes fewer mistakes in their code

🚬A senior developer:
- Writes simple code
- Thinks fast and moves slowly
- Makes mistakes in their head and corrects them before writing code.


👑 @gopher_academy | 💸 Donate | 💋 Boost
👍43💋2🕊1🍾1💊1
🚀 فرق بین 𝐃𝐨𝐜𝐤𝐞𝐫 𝐯𝐬. 𝐏𝐨𝐝𝐦𝐚𝐧 𝐯𝐬. 𝐂𝐨𝐧𝐭𝐚𝐢𝐧𝐞𝐫𝐝 𝐯𝐬. 𝐂𝐑𝐈-𝐎 🌟


🐳 𝑫𝒐𝒄𝒌𝒆𝒓 : A robust platform empowering developers to build, share, and run containers effortlessly. With its intuitive CLI and daemon-based architecture, Docker remains a top choice for containerization.

🔹 𝑷𝒐𝒅𝒎𝒂𝒏: A daemonless container engine offering similar functionalities to Docker but without the need for a central daemon. Perfect for developing and managing OCI containers directly on your Linux system.

🚀 𝑪𝒐𝒏𝒕𝒂𝒊𝒏𝒆𝒓𝒅 : This industry-standard core container runtime focuses on simplicity and reliability. It provides essential functionalities to run containers and manage images efficiently on any system.

⚙️ 𝑪𝑹𝑰-𝑶 : Tailored specifically for Kubernetes, CRI-O is a lightweight container runtime implementing the Kubernetes Container Runtime Interface (CRI). It seamlessly integrates OCI-compatible runtimes into Kubernetes clusters.

Whether you're a developer, DevOps enthusiast, or Kubernetes aficionado, understanding these container runtimes can streamline your deployment workflows.


👑 @gopher_academy | 💸 Donate | 💋 Boost
👍7🕊1
6 مورد از استفاده الستیک سرچ

👑 @gopher_academy | 💸 Donate | 💋 Boost
👍131
🔔 100خطای رایج در کوبر به همراه راه حل


𝑓𝑜𝑟 𝑚𝑜𝑟𝑒 𝑖𝑛𝑓𝑜, 𝑦𝑜𝑢 𝑐𝑎𝑛 𝑐ℎ𝑒𝑐𝑘 𝑡ℎ𝑖𝑠 𝑙𝑖𝑛𝑘:

https://prodevopsguy.site/100-Kubernetes-Errors-With-Solution

#DevOps #Cloud #Kubernetes #Troubleshooting


👑 @gopher_academy | 💸 Donate | 💋 Boost
🔥6🍾1💋1
یک توسعه‌دهنده خوب قابل جایگزینی است.

- you don’t need them to explain their code.
- their code can be easily modified.
- their work is documented.
- their code is validated with good tests.

یک توسعه‌دهنده بد غیرقابل جایگزینی است.

- only they can understand their code.
- you can’t change their code in fear of breaking something random somewhere else.
- the documentation is in their head.
- they don’t bother to write tests.

A good dev leaves, you should be fine.
A bad dev leaves, you’re in trouble.


👑 @gopher_academy | 💸 Donate | 💋 Boost
👍10💯2🍓2🍾1💊1
✍️اگر به devops علاقه داری یه سری نمونه سوال مصاحبه ای اینجاست

🖥 https://blog.prodevopsguy.xyz/top-100-devops-interview-questions-and-answers


👑 @gopher_academy | 💸 Donate | 💋 Boost
🍾3🕊2💋1💅1
🎯نه دلیل اصلی استفاده ۱۰۰٪ از CPU
۱. حلقه‌های بی‌پایان:
کدهایی که بدون توقف در حال اجرا هستند و هیچ وقفه‌ای نمی‌دهند، می‌توانند موجب استفاده ۱۰۰٪ از CPU شوند.

۲. پردازش‌های سنگین محاسباتی:
الگوریتم‌ها و پردازش‌هایی که نیاز به محاسبات پیچیده و سنگین دارند، می‌توانند تمام توان CPU را مصرف کنند.

۳. نشت حافظه:
برنامه‌هایی که به درستی حافظه را آزاد نمی‌کنند، می‌توانند باعث افزایش بی‌رویه مصرف حافظه و در نتیجه بارگذاری CPU شوند.

۴. اختلال در I/O:
انتظار طولانی برای ورودی/خروجی‌ها می‌تواند موجب شود که فرآیندها CPU را در حالت انتظار نگه دارند و به تدریج تمام منابع را مصرف کنند.

۵. کد بهینه‌نشده:
کدهایی که بهینه‌سازی نشده‌اند و عملیات غیرضروری زیادی انجام می‌دهند، می‌توانند باعث استفاده بالا از CPU شوند.

۶. پردازش‌های پس‌زمینه زیاد:
اجرای همزمان تعداد زیادی از پردازش‌های پس‌زمینه می‌تواند به‌طور قابل توجهی بار CPU را افزایش دهد.

۷. بدافزارها و ویروس‌ها:
بدافزارها می‌توانند برنامه‌های پنهانی را اجرا کرده و از منابع CPU استفاده کنند.

۸. به‌روزرسانی‌های نرم‌افزاری:
برخی از به‌روزرسانی‌های نرم‌افزاری ممکن است به‌طور موقت باعث استفاده بالای CPU شوند.

۹. درایورهای مشکل‌دار:
درایورها یا سخت‌افزارهای ناسازگار یا مشکل‌دار می‌توانند باعث افزایش غیرمنتظره استفاده از CPU شوند.

👑 @gopher_academy | 💸 Donate | 💋 Boost
👍5🔥1🍾1💋1
برای بهبود کیفیت ترجمه از انگلیسی به فارسی با استفاده از مدل‌های GPT-4، می‌توانید از پرامپت‌هایی استفاده کنید که به وضوح هدف و زمینه ترجمه را مشخص کنند. این کار به مدل کمک می‌کند تا دقیق‌تر و متناسب‌تر ترجمه کند. در زیر چند مثال از پرامپت‌های مناسب برای ترجمه ارائه شده است:

### مثال‌های پرامپت

1. ترجمه ساده:

Translate the following text from English to Persian:
"Hello, how are you?"


2. ترجمه با توضیحات اضافی:

Please translate the following text from English to Persian. Make sure the translation is accurate and maintains the original meaning:
"Hello, how are you?"


3. ترجمه متنی با زمینه خاص:

Translate the following business email from English to Persian, ensuring the tone remains professional and polite:
"Dear Mr. Smith, I hope this email finds you well. I am writing to inquire about the status of our project proposal."


4. ترجمه با تاکید بر حفظ سبک ادبی:

Translate the following literary text from English to Persian, keeping the poetic and literary style intact:
"The sun sets over the tranquil sea, casting hues of gold and crimson across the sky."


5. ترجمه همراه با راهنمایی‌های اضافی:

Translate the following technical document from English to Persian, ensuring that technical terms are accurately translated:
"The system architecture consists of several interconnected modules that communicate via APIs."


### استفاده از پرامپت‌ها در کد
شما می‌توانید این پرامپت‌ها را به صورت مستقیم در کد خود استفاده کنید. مثال زیر نشان می‌دهد که چگونه این کار را انجام دهید:

package main

import (
"context"
"fmt"
"log"

"github.com/sashabaranov/go-openai" // اطمینان حاصل کنید که این کتابخانه را نصب کرده‌اید
)

type ChatGPT struct {
ApiKey string
Model string
}

func NewChatGPT(api string, model string) *ChatGPT {
return &ChatGPT{
ApiKey: api,
Model: model,
}
}

func (c *ChatGPT) Trans(ctx context.Context, prompt string) {
client := openai.NewClient(c.ApiKey)

resp, err := client.CreateChatCompletion(ctx, openai.ChatCompletionRequest{
Model: c.Model,
Messages: []openai.ChatCompletionMessage{
{
Role: "user",
Content: prompt,
},
},
})

if err != nil {
log.Fatalf("Failed to get response from ChatGPT: %v", err)
}

// نمایش ترجمه به فارسی
fmt.Println("Translated Text:", resp.Choices[0].Message.Content)
}

func main() {
apiKey := "your-openai-api-key"
model := "gpt-4-turbo" // یا "gpt-4" یا هر مدل دیگری

chatGPT := NewChatGPT(apiKey, model)
ctx := context.Background()

// استفاده از یک پرامپت مناسب برای ترجمه
prompt := `Translate the following text from English to Persian, keeping the poetic and literary style intact:
"The sun sets over the tranquil sea, casting hues of gold and crimson across the sky."`

chatGPT.Trans(ctx, prompt)
}


در این کد، پرامپت مورد استفاده شامل توضیحاتی برای حفظ سبک ادبی متن است. با استفاده از پرامپت‌های مختلف و تنظیمات مناسب، می‌توانید کیفیت ترجمه را بهبود بخشید.

👑 @gopher_academy | 💸 Donate | 💋 Boost
👍61🔥1🕊1💋1
✍️نتورک ها در کوبر


🔴 Pod Networking:
- Pods share the same network namespace and can communicate via localhost.
- Kubernetes assigns each Pod a unique IP address for inter-node communication.

🔴 Service Networking:
- Services provide stable endpoints for accessing Pods.
- ClusterIP, NodePort, and LoadBalancer are common Service types for internal and external access.

🔴 Ingress Networking:
- Ingress manages external access to Services based on HTTP/HTTPS rules.
- Ingress controllers handle traffic routing to Services within the cluster.

🔴 Network Policies:
- This defines rules for Pod-to-Pod communication and access to external resources.
- It enables fine-grained control over network traffic within the cluster.

🔴 Container Network Interface (CNI):
- A standard for defining plugins that handle networking in container runtimes.
- Used by Kubernetes to manage network interfaces and IP addresses.

🔴 Networking Plugins:
- Kube-Proxy manages network rules for routing traffic to Services.
- CoreDNS resolves DNS queries for Kubernetes Services and Pods.


👑 @gopher_academy | 💸 Donate | 💋 Boost
👍2🍾21
✍️Rouzbeh SabzeheiRouzbeh Sabzehei


🌷فرق Cache Aware و Cache Oblivious چیه ؟

نوشتن نرم افزاری که نیاز داره مرزهای Performance رو رد کنه حتما باید با دید سخت افزاری نوشته بشه. یکی از این این موارد استفاده بهینه از CPU Cache هست. دلیلش اینه که سرعت خواندن دیتا از لایه های Cache به مراتب سریعتر از RAM هستش.

الگوریتم های Cache Aware به الگوریتم هایی گفته میشه که به طور خاص با آگاهی از مقدار Cache Size پردازنده ای که قراره روی اون اجرا بشه نوشته میشه. یکی از چالشا تو این نوع الگوریتم ها اینه که برای هر مدل پردازنده و بر اساس مقدار Cache Size اون پردازنده اون الگوریتم دوباره باید نوشته بشه. تو این نوع الگوریتم ها میشه به بهینه ترین نوع استفاده از Cache سیستم رسید.

در مقابل الگوریتم های Cache Oblivious نیاز ندارن تا براساس مقدار دقیق Cache Size نوشته بشن و میتونن با استفاده از پترن هایی مثل Recursive الگوریتم رو به دیتا های کوچکتری که در اکثر Cache Size ها جا میشن تقسیم کنن تا تقریبا بر روی هر پردازنده ای خوب و سریع عمل کنند.


👑 @gopher_academy | 💸 Donate | 💋 Boost
👍5🔥2💋2🍾1💅1
Junior engineer: Writes code

Mid-level engineer: Reviews code

Senior engineer: Deletes code

Staff engineer: Doesn't interact with the code at all but somehow has more impact than the junior, mid-level, and senior engineers combined


👑 @gopher_academy | 💸 Donate | 💋 Boost
🔥9🎃4🍓3🏆1🍾1💅1💊1
🚬 how we retry on failures

🔹 Linear Backoff
Linear backoff involves waiting for a progressively increasing fixed interval between retry attempts.

Advantages: Simple to implement and understand.

Disadvantages: May not be ideal under high load or in high-concurrency environments as it could lead to resource contention or "retry storms".

🔹 Linear Jitter Backoff
Linear jitter backoff modifies the linear backoff strategy by introducing randomness to the retry intervals. This strategy still increases the delay linearly but adds a random "jitter" to each interval.

Advantages: The randomness helps spread out the retry attempts over time, reducing the chance of synchronized retries across instances.

Disadvantages: Although better than simple linear backoff, this strategy might still lead to potential issues with synchronized retries as the base interval increases only linearly.

🔹 Exponential Backoff
Exponential backoff involves increasing the delay between retries exponentially. The interval might start at 1 second, then increase to 2 seconds, 4 seconds, 8 seconds, and so on, typically up to a maximum delay. This approach is more aggressive in spacing out retries than linear backoff.

Advantages: Significantly reduces the load on the system and the likelihood of collision or overlap in retry attempts, making it suitable for high-load environments.

Disadvantages: In situations where a quick retry might resolve the issue, this approach can unnecessarily delay the resolution.

🔹 Exponential Jitter Backoff
Exponential jitter backoff combines exponential backoff with randomness. After each retry, the backoff interval is exponentially increased, and then a random jitter is applied. The jitter can be either additive (adding a random amount to the exponential delay) or multiplicative (multiplying the exponential delay by a random factor).


👑 @gopher_academy | 💸 Donate | 💋 Boost
👍41💋1
✍️ Massimo Dev

Image preview
توی #گیت دستور git stash چی می‌کنه؟

دستور git stash دستوری در گیت است که تغییراتی که در دایرکتوری کاریت انجام دادی رو به‌طور موقت کنار میذاره (یا "ذخیره" می کنه) تا بتونی بدون نیاز به کامیت کردن این تغییرات، به برنچ دیگه‌ای بری یا روی کار دیگه‌ای تمرکز کنی. وقتی آماده بودی دوباره روی تغییرات کار کنی، می‌تونی اونارو با استفاده از git stash apply یا git stash pop دوباره اعمال کنی.

یک مثال ساده:

1. تغییراتی در دایرکتوری کاریت داری:


$ git status
On branch master
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: file1.txt
modified: file2.txt


2. این تغییرات رو stash می‌کنی:


$ git stash
Saved working directory and index state WIP on master: 1234567 Update file1 and file2


3. حالا دایرکتوری کاریت تمیزه:


$ git status
On branch master
nothing to commit, working tree clean


4. می‌تونی به برنچ دیگه‌ای بری یا کار دیگه‌ای انجام بدی. بعداً، وقتی خواستی دوباره تغییرات رو اعمال کنی، می‌تونی از این دستور استفاده کنی:


$ git stash apply

یا برای اعمال تغییرات و حذف اونا از لیست stash:


$ git stash pop

5. تغییرات دوباره به دایرکتوری کاریت اعمال میشن:


$ git status
On branch master
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: file1.txt
modified: file2.txt


به‌طور خلاصه، git stash یک روش مفید برای ذخیره موقت کارهاست بدون نیاز به کامیت کردن، که بهت اجازه میده به‌راحتی کارهات رو تغییر بدی.


👑 @gopher_academy | 💸 Donate | 💋 Boost
👍11🕊1🍾1
😳 api pagination 101

🔹 Offset-based Pagination:
This technique uses an offset and a limit parameter to define the starting point and the number of records to return.
- Example: GET /orders?offset=0&limit=3
- Pros: Simple to implement and understand.
- Cons: Can become inefficient for large offsets, as it requires scanning and skipping rows.

🔹 Cursor-based Pagination:
This technique uses a cursor (a unique identifier) to mark the position in the dataset. Typically, the cursor is an encoded string that points to a specific record.
- Example: GET /orders?cursor=xxx
- Pros: More efficient for large datasets, as it doesn't require scanning skipped records.
- Cons: Slightly more complex to implement and understand.

🔹 Page-based Pagination:
This technique specifies the page number and the size of each page.
- Example: GET /items?page=2&size=3
- Pros: Easy to implement and use.
- Cons: Similar performance issues as offset-based pagination for large page numbers.

🔹 Keyset-based Pagination:
This technique uses a key to filter the dataset, often the primary key or another indexed column.
- Example: GET /items?after_id=102&limit=3
- Pros: Efficient for large datasets and avoids performance issues with large offsets.
- Cons: Requires a unique and indexed key, and can be complex to implement.

🔹 Time-based Pagination:
This technique uses a timestamp or date to paginate through records.
- Example: GET /items?start_time=xxx&end_time=yyy
- Pros: Useful for datasets ordered by time, ensures no records are missed if new ones are added.
- Cons: Requires a reliable and consistent timestamp.

🔹 Hybrid Pagination:
This technique combines multiple pagination techniques to leverage their strengths.
Example: Combining cursor and time-based pagination for efficient scrolling through time-ordered records.
- Example: GET /items?cursor=abc&start_time=xxx&end_time=yyy
- Pros: Can offer the best performance and flexibility for complex datasets.
- Cons: More complex to implement and requires careful design.


👑 @gopher_academy | 💸 Donate | 💋 Boost
👍5
🍾 BIOS Infection

‏BIOS Infection یکی از تکنیک‌های پیشرفته و خطرناک در حوزه بدافزارهاست که هدفش آلوده کردن فریمور سیستم، به‌ویژه BIOS یا UEFI کامپیوترها هستش. این نوع حمله به هکرها اجازه می‌ده تا کنترل کاملی روی سیستم قربانی به دست بیارن و حتی بعد از فرمت کردن هارد دیسک یا تعویض اون، همچنان در سیستم باقی بمونن.

مکانیزم کار BIOS Infection به این صورته که مهاجم با استفاده از آسیب‌پذیری‌های موجود در BIOS/UEFI یا از طریق دسترسی فیزیکی به سیستم، کد مخرب خودش رو مستقیماً به فریمور تزریق می‌کنه. این کد معمولاً در بخش‌هایی از حافظه فلش BIOS ذخیره می‌شه که کمتر مورد استفاده قرار می‌گیرن یا در قسمت‌هایی که برای کاستومایز کردن BIOS در نظر گرفته شدن.

یکی از معروف‌ترین نمونه‌های BIOS Infection، بدافزار EquationDrug هستش که توسط گروه Equation Group ساخته شده و قابلیت آلوده کردن فریمور هارد دیسک‌ها رو داره. این بدافزار می‌تونه خودش رو در سکتورهای مخفی هارد دیسک جاسازی کنه و حتی بعد از نصب مجدد سیستم‌عامل، فعال باقی بمونه.

تشخیص BIOS Infection کار بسیار دشواری هستش چون اکثر آنتی‌ویروس‌ها و ابزارهای امنیتی معمول، قادر به اسکن کردن و شناسایی تغییرات در سطح BIOS نیستن. برای مقابله با این تهدید، استفاده از ابزارهای تخصصی مثل Chipsec یا FIDO توصیه می‌شه که می‌تونن ناهنجاری‌های موجود در BIOS رو شناسایی کنن.

پیشگیری از BIOS Infection شامل اقداماتی مثل به‌روزرسانی منظم فریمور، فعال کردن Secure Boot، محدود کردن دسترسی فیزیکی به سیستم و استفاده از پسوردهای قوی برای BIOS می‌شه. همچنین، برخی از تولیدکنندگان سخت‌افزار، مکانیزم‌های امنیتی پیشرفته‌تری مثل Intel Boot Guard رو پیاده‌سازی کردن که از تغییرات غیرمجاز در BIOS جلوگیری می‌کنه.

در صورت آلوده شدن سیستم به BIOS Infection، فرآیند پاکسازی بسیار پیچیده و گاهی غیرممکن می‌شه. در بسیاری از موارد، تنها راه حل قطعی، تعویض کامل مادربورد یا چیپ BIOS هستش. این مسئله نشون می‌ده که چرا BIOS Infection یکی از جدی‌ترین تهدیدات امنیتی در دنیای کامپیوتر به حساب میاد و چرا سازمان‌های امنیتی و شرکت‌های بزرگ فناوری، سرمایه‌گذاری زیادی روی مقابله با این نوع حملات انجام دادن.


~> @PinkOrca

👑 @gopher_academy | 💸 Donate | 💋 Boost
👍72🔥1🕊1💋1
💢 یک کتاب عملی و ساده برای درک اینکه کامپیوترها چطور کار می‌کنن، از مدار‌های low-level تا کدهای high-level، با پروژه‌های عملی متنوع.

✍️ نویسنده: Matthew Justice
🔤 زبان: انگلیسی
📖 سال انتشار: 2020
📄 تعداد صفحات: 396
🔗 مشاهده کتاب در آمازون

👑 @gopher_academy | 💸 Donate | 💋 Boost
👍4🔥2🍾2