Sooloe Learning Notes

website·Indexed 29 days ago

https://sooloe.com

A collection of technical learning notes and guides covering multiple programming languages including Go, Python, Java, and C. The documentation includes topics on CSS selectors, SOLID principles, design patterns like the Observer pattern, Linux command-line tools (scp, tcpdump, ps), and software engineering practices such as refactoring and clean code.

Tokens
52.6K
Snippets
349
Records
425
Agent score
50%

What's inside Sooloe

  1. Overview of the macOS sips command-line tool

    The sips command is a built-in macOS command-line utility used for image processing. It allows developers and users to crop images, modify dimensions, rotate/flip images, and inspect image metadata directly from the terminal.
  2. Overview of the Observer Design Pattern

    The Observer pattern defines a one-to-many dependency between objects so that when one object (the Subject) changes state, all its dependents (Observers) are notified and updated automatically to maintain consistency.

    Core Components:

    • Subject (Target Object): Maintains a list of observers, handles registration/deregistration, and notifies observers when state changes.
    • Observer: Provides an update method to be called by the Subject to execute business logic.
    • Concrete Subject: Maintains the actual state and triggers notifications upon state changes.
    • Concrete Observer: Implements the update logic to react to the Subject's state change.
  3. Overview of SOLID Design Principles

    SOLID is a set of five basic principles for object-oriented programming and design intended to make software more maintainable and extensible. The acronym stands for:

    • Single Responsibility Principle (SRP)
    • Open-Closed Principle (OCP)
    • Liskov Substitution Principle (LSP)
    • Interface Segregation Principle (ISP)
    • Dependency Inversion Principle (DIP)
  4. Overview of tcpdump packet analyzer

    tcpdump is a command-line packet analyzer used to analyze network behavior, performance, and traffic generated or received by applications. It supports filtering by network layer, protocol, host, and port, and allows the use of logical operators such as and, or, and not to filter out unnecessary information.
  5. Understand Unix-like signals for inter-process communication

    Signals are a mechanism for inter-process communication (IPC) that act as software interrupts. They notify a process that a specific event has occurred, allowing processes to interact or handle exceptional situations. Signals can be triggered by user input (e.g., keyboard shortcuts), the operating system (e.g., terminal disconnects), or other processes.
  6. Understand Go string types and literals

    In Go, strings are immutable value types represented as fixed-length byte arrays. Modifying a string results in a new memory allocation, leaving the original string intact. Go supports two types of string literals:

    1. Interpreted strings: Enclosed in double quotes ("). They process escape characters (e.g., \n for newline).
    2. Raw string literals: Enclosed in backticks (`). They treat escape characters literally and support multi-line strings.
    package main
    
    func main() {
        // Interpreted string: \n is converted to a newline
        interpreted := "Hello\nWorld"
        
        // Raw string: \n is printed literally
        raw := `Hello\nWorld` 
    }
  7. Define and declare functions in C

    A C function consists of a header (return type, name, and parameter list) and a body (the implementation). A function declaration (prototype) informs the compiler about the function's signature and should be placed before the function is called.
    // Function Declaration
    int sum(int a, int b);
    
    // Function Definition
    int sum(int a, int b) {
        return a + b;
    }
  8. Understand Python Set characteristics

    A Set in Python is an unordered collection of unique elements. Key characteristics include:

    • Elements must be of an immutable type (e.g., numbers, strings, tuples).
    • Elements are unordered; the sequence is not guaranteed.
    • Duplicate elements are automatically removed.
    • The set itself is mutable, meaning you can add or remove immutable elements.
  9. Understand the C language compilation stages

    C is a compiled language where source code must be processed by a compiler to create an executable. The process consists of four distinct stages:

    1. Preprocessing: The compiler processes source code, removes comments, and expands macro definitions (replacing all directives starting with #).
    2. Compilation: The preprocessed source code is converted into assembly code (high-level language to low-level language). This stage includes syntax and semantic analysis, resulting in a binary object file containing relocatable machine code and symbol tables.
    3. Assembly: The assembler translates assembly code into machine code instructions, producing binary object files (sequences of bytes).
    4. Linking: The linker merges multiple object files and library files into a single executable. It uses symbol tables to redirect addresses and resolve all symbol references to actual memory addresses.
  10. Understand Go Goroutines and their advantages over OS threads

    Goroutines are user-space threads implemented by Go. Unlike operating system threads, goroutines are managed in user code, avoiding the high performance overhead of entering the OS kernel for creation and switching.

    Key differences include:

    • Memory Efficiency: OS threads are allocated a large, fixed stack size. Goroutines start with a small default stack (2KB) that can automatically grow or shrink as needed, preventing memory waste and stack overflow.
    • Scheduling: Goroutines use cooperative switching rather than preemptive switching. A single OS thread can run multiple goroutines, with the thread handling the scheduling; only one goroutine per thread runs at a time.
  11. Understand Go slice concepts

    A slice is a variable-length sequence that acts as a reference to an underlying array. Unlike arrays, slices are dynamic and do not have a fixed size in their type declaration (written as []Type). A slice represents a contiguous segment of an array, starting from a specific index and ending at another.
  12. Understand the Boolean type in Python

    The Boolean type (bool) is a basic data type in Python used to represent logical truth values. It has only two possible values: True and False. In Python, bool is a subclass of the integer type (int), where True is numerically equal to 1 and False is numerically equal to 0.
    print(True == 1)     # Output: True
    print(False == 0)    # Output: True
    print(True is True)  # Output: True
    print(True is 1)     # Output: False (different types)