ShiteCode

api awk axum bash C++ codex conf grep html IO nginx pdf php postgres random regex rsync ruby rust scrape script sed servers sql sqlite ssh ssl tutorial xml


Ruby:

@something.each_with_index do |thing,index|
    puts index
end

Rust:

fn print_indices<T>(something: &[T]) {
    for (index, _) in something.iter().enumerate() {
        println!("{}", index);
    }
}

Bash:

#!/bin/bash

print_indices() {
  local array=("${@}")
  local length="${#array[@]}"

  for ((i=0; i<length; i++)); do
    echo "$i"
  done
}

AWK: 😛

awk '{ for (i=1; i<=NF; i++) print i-1, $i }' input.txt

"Aufwachen, arschloch!"