irelephant [he/him]🍭

  • 17 posts
  • 204 comments
Joined 3 years ago
Cake day: December 14th, 2023
  • Also Piefed needs more apps.

    What they can (should) do is support lemmy’s api, so you can use lemmy apps with it.

    The language something is written in usually doesn’t matter much, database stuff and i/o are the main performance bottleneck. Instagram and threads serve a massive amount of people and they’re written in python.

  • Its a completely different shell, not just another terminal emulator.

    Its more readable, and its syntax is less arcane than bash.

    For example, a script to get the first line of a file and its lenght in bash is:

    #!/bin/bash
    
    
    if [ "$#" -ne 1 ]; then
        echo "Usage: $0 filename"
        exit 1
    fi
    
    filename="$1"
    
    
    if [ ! -r "$filename" ]; then
        echo "File '$filename' does not exist or is not readable."
        exit 1
    fi
    
    
    read -r first_line < "$filename"
    
    
    echo "First line: $first_line"
    
    
    length=${#first_line}
    
    echo "Length of first line: $length"
    

    There is so much I hate about this, like using a semicolon after the if condition, and ending it in fi.

    Versus the powershell version:

    param (
        [Parameter(Mandatory = $true)]
        [string]$FilePath
    )
    
    
    if (-not (Test-Path -Path $FilePath)) {
        Write-Error "File '$FilePath' does not exist."
        exit 1
    }
    
    try {
        
        $firstLine = Get-Content -Path $FilePath -TotalCount 1
    }
    catch {
        Write-Error "Could not read from file '$FilePath'."
        exit 1
    }
    
    
    Write-Output "First line: $firstLine"
    
    
    $lineLength = $firstLine.Length
    Write-Output "Length of first line: $lineLength"
    

    It feels more modern.