Durga
2.6K posts

Durga
@AI_with_Durga
Sharing the best AI tools, tips & trends | AI enthusiast on a mission to simplify tech | Follow for daily AI updates | ๐ Collabs: [email protected]

introducing screenpipe: it records and learns how you work and turns it into a searchable memory, SOPs, and AI agents open source, local-first, 20K+ GitHub stars, 1,900+ forks, and 130+ contributors
















๐ง Day 25/30 โ #Linux File permissions alone aren't enough to secure a modern Linux system. Linux includes advanced security frameworks that enforce access policies, isolate applications, and record system activity for auditing. Linux Security โ SELinux, AppArmor, and Auditing with auditd These security tools help protect servers against unauthorized access, privilege escalation, and configuration mistakes. SELinux (Security-Enhanced Linux) SELinux is a Mandatory Access Control (MAC) system that restricts what users, processes, and applications are allowed to accessโeven if traditional file permissions would permit it. Useful Commands: โ sestatus Displays the current SELinux status. โ getenforce Shows the current enforcement mode. SELinux Modes: โ Enforcing โ Security policies are actively enforced. โ Permissive โ Policy violations are logged but not blocked. โ Disabled โ SELinux is turned off. AppArmor AppArmor is another Mandatory Access Control framework used by several Linux distributions. Instead of labels, it secures applications using predefined security profiles. Useful Commands: โ aa-status Displays loaded AppArmor profiles. โ sudo aa-enforce profile_name Enforces a security profile. Benefits: โ Application isolation โ Reduced attack surface โ Easier profile management on supported distributions auditd โ Linux Auditing System auditd records security-related events and system activity, making it invaluable for monitoring and compliance. Examples of what it can log: โ File access โ User logins โ Command execution โ Permission changes โ Security policy violations Useful Commands: โ sudo systemctl status auditd Checks whether the auditing service is running. โ ausearch -k login Searches audit logs for specific events. โ aureport Generates audit reports from collected logs. Why Linux Security Tools Matter: โ Protect critical systems from unauthorized access โ Detect suspicious activity โ Support compliance and auditing requirements โ Strengthen server security โ Reduce the impact of security breaches Best Practices: โ Keep SELinux or AppArmor enabled whenever possible. โ Monitor audit logs regularly. โ Apply the principle of least privilege. โ Keep systems updated with the latest security patches. Mastering SELinux, AppArmor, and auditd is an important step toward becoming a skilled Linux administrator, DevOps engineer, or cybersecurity professional. ๐ง Grab Linux Ebook: codewithdhanian.gumroad.com/l/hqtbxt #Linux #LinuxTutorial #SELinux #AppArmor #auditd #CyberSecurity #LinuxCommands #DevOps #SystemAdministration #100DaysOfCode






Machine learning is easier to understand when algorithms are organized by purpose. From supervised and unsupervised learningensembles, reinforcement learning, and neural networks, each approach solves a different class of problems. #MachineLearning #AI #DataScience #DeepLearning





A free guide to the fundamentals of machine learning, v/@swapnakpanda: bit.ly/4pD0N9U




๐๐ฎ๐ ๐ฎ๐ณ/๐ฒ๐ฌ ๐ผ๐ณ ๐ฆ๐ค๐ ๐ฆ๐ฒ๐ฟ๐ถ๐ฒ๐ โ ๐ฆ๐๐ฏ๐พ๐๐ฒ๐ฟ๐ถ๐ฒ๐ ๐ถ๐ป ๐ฆ๐๐๐๐๐ง ๐ฎ๐ป๐ฑ ๐๐ฅ๐ข๐ โ ๐๐ฒ๐ฟ๐ถ๐๐ฒ๐ฑ ๐ง๐ฎ๐ฏ๐น๐ฒ๐ Subqueries aren't limited to the WHERE clause. You can also use them in the SELECT list to calculate values and in the FROM clause to create temporary result sets known as derived tables. These techniques make complex SQL queries cleaner, more modular, and easier to maintain. Todayโs lesson explores these advanced subquery patterns ๐ 1๏ธโฃ ๐ฆ๐๐ฏ๐พ๐๐ฒ๐ฟ๐ถ๐ฒ๐ ๐ถ๐ป ๐๐ต๐ฒ ๐ฆ๐๐๐๐๐ง ๐ฐ๐น๐ฎ๐๐๐ฒ A subquery in the SELECT clause returns a value for each row produced by the outer query. Example: SELECT name, ( SELECT COUNT(*) FROM orders WHERE orders.customer_id = customers.customer_id ) AS total_orders FROM customers; This displays each customer alongside the number of orders they have placed. 2๏ธโฃ ๐ฆ๐๐๐๐๐ง ๐๐๐ฏ๐พ๐๐ฒ๐ฟ๐ถ๐ฒ๐ ๐ฐ๐ฎ๐ป ๐ฏ๐ฒ ๐ฐ๐ผ๐ฟ๐ฟ๐ฒ๐น๐ฎ๐๐ฒ๐ฑ The inner query can reference values from the current row of the outer query. This allows SQL to calculate row-specific values dynamically. 3๏ธโฃ ๐ช๐ต๐ฎ๐ ๐ถ๐ ๐ฎ ๐๐ฒ๐ฟ๐ถ๐๐ฒ๐ฑ ๐ง๐ฎ๐ฏ๐น๐ฒ? A derived table is a subquery placed inside the FROM clause. Its result behaves like a temporary table that can be queried further. 4๏ธโฃ ๐๐ฒ๐ฟ๐ถ๐๐ฒ๐ฑ ๐ง๐ฎ๐ฏ๐น๐ฒ ๐๐ ๐ฎ๐บ๐ฝ๐น๐ฒ SELECT department, average_salary FROM ( SELECT department, AVG(salary) AS average_salary FROM employees GROUP BY department ) AS dept_stats; The outer query works with the aggregated results as though they came from a regular table. 5๏ธโฃ ๐๐ฒ๐ฟ๐ถ๐๐ฒ๐ฑ ๐ง๐ฎ๐ฏ๐น๐ฒ๐ ๐บ๐๐๐ ๐ต๐ฎ๐๐ฒ ๐ฎ๐ป ๐ฎ๐น๐ถ๐ฎ๐ Every subquery in the FROM clause requires a table alias. Example: FROM ( ... ) AS dept_stats; Without an alias, most SQL databases will return an error. 6๏ธโฃ ๐ช๐ต๐ ๐๐๐ฒ ๐๐ฒ๐ฟ๐ถ๐๐ฒ๐ฑ ๐ง๐ฎ๐ฏ๐น๐ฒ๐? Derived tables help: โข Simplify complex queries โข Break large problems into smaller steps โข Reuse calculated results โข Improve query readability 7๏ธโฃ ๐๐ผ๐บ๐ฏ๐ถ๐ป๐ถ๐ป๐ด ๐๐ฒ๐ฟ๐ถ๐๐ฒ๐ฑ ๐ง๐ฎ๐ฏ๐น๐ฒ๐ ๐๐ถ๐๐ต ๐๐ข๐๐ก๐ Derived tables can be joined with other tables. Example: SELECT d.department, d.average_salary, m.manager_name FROM ( SELECT department, AVG(salary) AS average_salary FROM employees GROUP BY department ) AS d JOIN managers m ON d.department = m.department; 8๏ธโฃ ๐ฆ๐๐๐๐๐ง ๐๐๐ฏ๐พ๐๐ฒ๐ฟ๐ถ๐ฒ๐ ๐๐. ๐๐ฒ๐ฟ๐ถ๐๐ฒ๐ฑ ๐ง๐ฎ๐ฏ๐น๐ฒ๐ SELECT subqueries return individual values. Derived tables return complete result sets that can be filtered, joined, and sorted. 9๏ธโฃ ๐ช๐ต๐ฒ๐ป ๐๐ผ ๐๐๐ฒ ๐๐ต๐ฒ๐บ Common use cases include: โข Customer order summaries โข Department salary reports โข Sales analytics โข Ranking and reporting โข Preparing intermediate datasets ๐ ๐๐ฒ๐ฟ๐ถ๐๐ฒ๐ฑ ๐ง๐ฎ๐ฏ๐น๐ฒ๐ ๐ฎ๐ฟ๐ฒ ๐ฎ ๐๐๐ฒ๐ฝ ๐๐ผ๐๐ฎ๐ฟ๐ฑ ๐๐ง๐๐ Understanding derived tables makes it much easier to learn Common Table Expressions (CTEs), which offer an even cleaner way to structure complex SQL queries. ๐ก ๐๐ฒ๐ ๐๐ฎ๐ธ๐ฒ๐ฎ๐๐ฎ๐: Subqueries can appear in the SELECT clause to calculate row-level values and in the FROM clause as derived tables. These techniques help organize complex queries into smaller, reusable components, making your SQL easier to read and maintain. Grab SQL Playbook: codewithdhanian.gumroad.com/l/hjmix Do you prefer using derived tables or Common Table Expressions (CTEs) when writing complex SQL queries?










