Searching We.Love.Privacy.Club

Twts matching #awk
Sort by: Newest, Oldest, Most Relevant
In-reply-to » @falsifian Correct, the two smaller versions are loading perfectly fine. The hickup is only for the originals. But in all reality, the middle ones are sufficient for me personally. Please don't get me wrong, at least for the people photos, the subjects are large enough. The Japanese landscapes, however, would definitely benefit from a bit more detail. ;-)

Turns out, I even go down to only 50% quality for my thumbnails: https://lyse.isobeef.org/tmp/galres.txt The difference between 50% and 80/90% is just barely noticeable.

$ convert -strip -quality 50 IMG_20251106_035048_448_size_400.jpg 50-stripped.jpg
$ convert -quality 50 IMG_20251106_035048_448_size_400.jpg 50.jpg
$ ls -lh 50*jpg | awk '{print $5 " " $9}'
26K 50.jpg
25K 50-stripped.jpg

⤋ Read More
In-reply-to » @lyse Thanks for letting me know. HTML checkers seem happy now. I'm not sure what to do about the images not loading. The photos have three sizes (thumbnail, photo page, and original if you click the img tag on the photo page); can you at least see the smaller two sizes? Maybe I will do some experimental fetches and/or start measuring things on my web server.

@falsifian@www.falsifian.org Correct, the two smaller versions are loading perfectly fine. The hickup is only for the originals. But in all reality, the middle ones are sufficient for me personally. Please don’t get me wrong, at least for the people photos, the subjects are large enough. The Japanese landscapes, however, would definitely benefit from a bit more detail. ;-)

I just tried it once more, and now, the tree with the sign (/photo/5Zy4pqVIt0oP/IMG_20251106_035048_448.jpg) fully loaded very quickly. Same with the Japanese dish (/photo/tJbmg8oleYbh/IMG_20251030_091719_086.jpg) and shopping center (/photo/qXG5ucIjpPju/IMG_20251029_045002_778.jpg). But the previous and next ones all ran into the same problems again. When I’m very lucky, I eventually get the upper half. Typically not even that much, a third, a fifth, or even less.

Waiting a bit before making an attempt, the wooden walkway through the forest or park (/photo/ojQpDLfBoGN4/IMG_20251023_043829_011.jpg) eventually also made it. But unlike the other successful attempts, it took a long time.

The more photos you add, the more beneficial it might be to separate the index into several different albums. I didn’t measure it, but it felt like 10 to 20 seconds for all the thumbnails to load. That traffic adds up.

Another idea would be to strip the EXIF data from the thumbnails and reducing quality to 90% or even 80%. Using the famous tree with the sign, I cannot tell the difference between the original thumbnail and the 80% quality one. I’m sure it depends on the subject. Here are the numbers:

$ convert -strip IMG_20251106_035048_448_size_400.jpg stripped.jpg
$ convert -quality 90 IMG_20251106_035048_448_size_400.jpg 90.jpg
$ convert -quality 80 IMG_20251106_035048_448_size_400.jpg 80.jpg
$ convert -strip -quality 90 IMG_20251106_035048_448_size_400.jpg 90-stripped.jpg
$ convert -strip -quality 80 IMG_20251106_035048_448_size_400.jpg 80-stripped.jpg
$ ls -lh *jpg | awk '{print $5 " " $9}' 
46K 80.jpg
45K 80-stripped.jpg
64K 90.jpg
63K 90-stripped.jpg
132K IMG_20251106_035048_448_size_400.jpg
127K stripped.jpg
$ ls -l *jpg | awk '{print $5 " " $9}'
46160 80.jpg
45064 80-stripped.jpg
65012 90.jpg
63916 90-stripped.jpg
135070 IMG_20251106_035048_448_size_400.jpg
129647 stripped.jpg

⤋ Read More

Awk to take lines from Plan 9’s /lib/unicode and prepend the actual glyph and a tab: awk ‘{cmd=sprintf(“unicode %s”, $1); cmd | getline c; printf(“%s %s\n”, c, $0)}’

⤋ Read More

Colored Highlighter - A terminal tool to highlight specific words in your command output with colors
I needed to take a look at some live logs and quickly analyze some old ones, but I couldn’t find anything effective to highlight terms, except for esoteric sed and awk commands.
So I built ch - Colored Highlighter - a simple terminal tool to highlight specific words in your command output with colors. Perfect for tailing logs, debugging, and making command output more readable.

Try it out, all feedback is welcome!

[Comments](https://l … ⌘ Read more

⤋ Read More

Hmm, gnu.org is slow as heck. Shorter HTML pages load in about ten seconds. This complete AWK manual all in one large HTML page took a full minute: https://www.gnu.org/software/gawk/manual/gawk.html Is there maybe some anti AI shenanigans going on?

In any case, I find the user guide super interesting. My AWK skills are basically non-existent, so I finally decided to change that. This document is incredibly well written and makes it really fun to keep reading and learning. I’m very impressed. So far, I made it to section 1.6, happy to continue.

⤋ Read More

** Make awk rawk **
A friend online recently replied to something I wrote about awk by saying:

[…] it’s a danged shame [awk] didn’t continue to evolve the way Ruby, Python, PHP have evolved over the decades.

I had exactly this thought while working on my slightly unhinged“lets see if I can implement a basic scheme using awk by writing an assembler and VM in awk,” skwak. Which eventually lead me to start noodling on how to layer in some modern niceties into awk, without breaking awk’s portability.
… ⌘ Read more

⤋ Read More
In-reply-to » This weekend (as some of you may now) I accidently nuke this Pod's entire data volume 🤦‍♂️ What a disastrous incident 🤣 I decided instead of trying to restore from a 4-month old backup (we'll get into why I hadn't been taking backups consistently later), that we'd start a fresh! 😅 Spring clean! 🧼 -- Anyway... One of the things I realised was I was missing a very critical Safety Controls in my own ways of working... I've now rectified this...

Then I cleaned up my shell history of all of the invocations I ever made of dkv rm ... to make sure I never ever have this so easily accessible in my shell history (^R):

$ awk '
  /^#/ { ts = $0; next }
  /^dkv rm/ { next }
  { if (ts) print ts; ts=""; print }
' ~/.bash_history > ~/.bash_history.tmp && mv ~/.bash_history.tmp ~/.bash_history && history -r

⤋ Read More

** Styrofoam cups and awk **
I like writing these posts for my website, but I’ve sat down to write this one like 11 times and it either takes on a tone of totally encompassing dread and dystopian navel gazing or I feel like I’m burying my head in the sand and ignoring reality as it happens around me.

…I finished reading Victor LaValle’s The Changeling. It was engaging, and I was interested in where it was going, but I found that where it went wasn’t interesting. The dialogue and prose were lively and contemporary, which is what r … ⌘ Read more

⤋ Read More

@prologic@twtxt.net Regarding the new way of generating twt-hashes, to me it makes more sense to use tabs as separator instead of spaces, since the you can just copy/past a line directly from a twtxt-file that already go a tab between timestamp and message. But tabs might be hard to “type” when you are in a terminal, since it will activate autocomplete…🤔

Another thing, it seems that you sugget we only use the domain in the hash-creation and not the full path to the twtxt.txt

$ echo -e "https://example.com 2024-09-29T13:30:00Z Hello World!" | sha256sum - | awk '{ print $1 }' | base64 | head -c 12

⤋ Read More

@prologic@twtxt.net

#!/bin/sh

# Validate environment
if ! command -v msgbus > /dev/null; then
    printf "missing msgbus command. Use:  go install git.mills.io/prologic/msgbus/cmd/msgbus@latest"
    exit 1
fi

if ! command -v salty > /dev/null; then
    printf "missing salty command. Use:  go install go.mills.io/salty/cmd/salty@latest"
    exit 1
fi

if ! command -v salty-keygen > /dev/null; then
    printf "missing salty-keygen command. Use:  go install go.mills.io/salty/cmd/salty-keygen@latest"
    exit 1
fi

if [ -z "$SALTY_IDENTITY" ]; then
    export SALTY_IDENTITY="$HOME/.config/salty/$USER.key"
fi

get_user () {
    user=$(grep user: "$SALTY_IDENTITY" | awk '{print $3}')
    if [ -z "$user" ]; then
        user="$USER"
    fi
    echo "$user"
}

stream () {
    if [ -z "$SALTY_IDENTITY" ]; then
        echo "SALTY_IDENTITY not set"
        exit 2
    fi

    jq -r '.payload' | base64 -d | salty -i "$SALTY_IDENTITY" -d
}

lookup () {
    if [ $# -lt 1 ]; then
    printf "Usage: %s nick@domain\n" "$(basename "$0")"
    exit 1
    fi

    user="$1"
    nick="$(echo "$user" | awk -F@ '{ print $1 }')"
    domain="$(echo "$user" | awk -F@ '{ print $2 }')"

    curl -qsSL "https://$domain/.well-known/salty/${nick}.json"
}

readmsgs () {
    topic="$1"

    if [ -z "$topic" ]; then
        topic=$(get_user)
    fi

    export SALTY_IDENTITY="$HOME/.config/salty/$topic.key"
    if [ ! -f "$SALTY_IDENTITY" ]; then
        echo "identity file missing for user $topic" >&2
        exit 1
    fi

    msgbus sub "$topic" "$0"
}

sendmsg () {
    if [ $# -lt 2 ]; then
        printf "Usage: %s nick@domain.tld <message>\n" "$(basename "$0")"
        exit 0
    fi

    if [ -z "$SALTY_IDENTITY" ]; then
        echo "SALTY_IDENTITY not set"
        exit 2
    fi

    user="$1"
    message="$2"

    salty_json="$(mktemp /tmp/salty.XXXXXX)"

    lookup "$user" > "$salty_json"

    endpoint="$(jq -r '.endpoint' < "$salty_json")"
    topic="$(jq -r '.topic' < "$salty_json")"
    key="$(jq -r '.key' < "$salty_json")"

    rm "$salty_json"

    message="[$(date +%FT%TZ)] <$(get_user)> $message"

    echo "$message" \
        | salty -i "$SALTY_IDENTITY" -r "$key" \
        | msgbus -u "$endpoint" pub "$topic"
}

make_user () {
    mkdir -p "$HOME/.config/salty"

    if [ $# -lt 1 ]; then
        user=$USER
    else
        user=$1
    fi

    identity_file="$HOME/.config/salty/$user.key"

    if [ -f "$identity_file" ]; then
        printf "user key exists!"
        exit 1
    fi

    # Check for msgbus env.. probably can make it fallback to looking for a config file?
    if [ -z "$MSGBUS_URI" ]; then
        printf "missing MSGBUS_URI in environment"
        exit 1
    fi


    salty-keygen -o "$identity_file"
    echo "# user: $user" >> "$identity_file"

    pubkey=$(grep key: "$identity_file" | awk '{print $4}')

    cat <<- EOF
Create this file in your webserver well-known folder. https://hostname.tld/.well-known/salty/$user.json

{
  "endpoint": "$MSGBUS_URI",
  "topic": "$user",
  "key": "$pubkey"
}

EOF
}

# check if streaming
if [ ! -t 1 ]; then
    stream
    exit 0
fi

# Show Help
if [ $# -lt 1 ]; then
    printf "Commands: send read lookup"
    exit 0
fi


CMD=$1
shift

case $CMD in
    send)
        sendmsg "$@"
    ;;
    read)
        readmsgs "$@"
    ;;
    lookup)
        lookup "$@"
    ;;
    make-user)
        make_user "$@"
    ;;
esac

⤋ Read More

a simple Makefile for forwarding internet to your local machine:

SSH_HOST=https://xuu.me
PRIV_KEY=~/.ssh/id_ed25519
forward:
	LOCAL_PORT=$(HOST_PORT); sh -c "$(shell http --form POST $(SSH_HOST) pub=@$(PRIV_KEY).pub | grep ^ssh | head -1 | awk '{ print "ssh -T -p " $$4 " " $$5 " -R " $$7 " -i $(PRIV_KEY)"  }')"

⤋ Read More