[-] ruffsl@programming.dev 3 points 1 year ago

I think it stands for Managed Service Providers.

40
-16
81
2

Just a short elevator pitch that was posted today in that 100 seconds format. Maybe useful in introducing others.

8
126
submitted 2 years ago* (last edited 2 years ago) by ruffsl@programming.dev to c/programming@programming.dev
96
98

I had to go full Rube Goldberg to clean up old image tags from closed PRs, while still leaving deletion of untagged image to the ECR repo's own lifecycle policy. Never go full Rube Goldberg:

name: ECR Retention Policy

on:
  pull_request:
    types:
      - closed
  workflow_call:
  workflow_dispatch:

jobs:
  clean-unused-ecr:
    name: Delete unused container images
    runs-on: runs-on,runner=2cpu-linux-x64,run-id=${{ github.run_id }},image=ecr_login_image
    steps:
      - name: Configure AWS credentials
        uses: aws-actions/configure-aws-credentials@v4
        with:
          aws-region: ${{ env.RUNS_ON_AWS_REGION }}
      - name: AWS ECR Login
        id: login-ecr
        uses: aws-actions/amazon-ecr-login@v2
      - name: AWS ECR Info
        shell: bash
        run: |
          echo "ECR_REGISTRY=${{ steps.login-ecr.outputs.registry }}" >> $GITHUB_ENV
          echo "ECR_REPO=$(basename ${{ github.repository }})" >> $GITHUB_ENV
      - name: Docker meta
        id: docker_meta
        uses: docker/metadata-action@v5
        with:
          images: ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPO }}
          flavor: suffix=-
          tags: type=raw,value=${{ github.head_ref || github.ref_name }}
      # NOTE: This is convoluted because AWS ECR has no simple way to untag image without deletion
      # given we want to leave deletion of untagged image to the ECR repo's own lifecycle policy
      # https://stackoverflow.com/questions/70065254/remove-ecr-image-tag-despite-imagereferencedbymanifestlist-error
      # https://github.com/aws/containers-roadmap/issues/1567
      - name: AWS ECR Cleanup
        shell: bash
        run: |
          REPO_EXISTS=$(aws ecr describe-repositories --repository-names $ECR_REPO 2>&1 || true)
          if echo "${REPO_EXISTS}" | grep -q 'RepositoryNotFoundException'; then
            echo "Repository not found, skipping cleanup."
            exit 0
          fi
          IMAGE_TAGS=$(aws ecr list-images --repository-name $ECR_REPO --query 'imageIds[*].imageTag' --output text)

          docker pull busybox
          docker tag busybox $ECR_REGISTRY/$ECR_REPO:_
          docker push $ECR_REGISTRY/$ECR_REPO:_

          TEMP_IMAGE=$(
            aws ecr batch-get-image \
                --repository-name $ECR_REPO \
                --image-ids imageTag=_ )
          TEMP_MANIFEST=$(echo $TEMP_IMAGE | jq -r '.images[].imageManifest')
          TEMP_DIGEST=$(echo $TEMP_IMAGE | jq -r '.images[].imageId.imageDigest')

          TAG_PREFIX=$(echo ${{ fromJSON(steps.docker_meta.outputs.json).tags[0] }} | cut -d: -f2)
          for TAG in $IMAGE_TAGS
          do
            if [[ $TAG == $TAG_PREFIX* ]]; then
              docker tag busybox $ECR_REGISTRY/$ECR_REPO:$TAG
              docker push $ECR_REGISTRY/$ECR_REPO:$TAG
              echo "Untaged image $TAG"
            fi
          done

          # Delete the temporary image by digest
          aws ecr batch-delete-image \
            --repository-name $ECR_REPO \
            --image-ids imageDigest=$TEMP_DIGEST
-63

cross-posted from: https://programming.dev/post/12247721

🔥 🚢 overviews the recent supply chain attack on XZ library.

26
13
submitted 2 years ago* (last edited 2 years ago) by ruffsl@programming.dev to c/programmer_humor@programming.dev

April fool's!

1
submitted 2 years ago* (last edited 2 years ago) by ruffsl@programming.dev to c/nix@programming.dev

cross-posted from: https://programming.dev/post/12228684

April fool's!

[-] ruffsl@programming.dev 2 points 3 years ago

Fair enough. I just wanted to point out why you may see others, or news outlets, refer to tech giants, such as Microsoft, as FANGs or FAANGs given the historical context, regardless of how one may prefer to grammatically re-phrase such nonsensical statements. E.g:

So, who are the FAANGs?

[-] ruffsl@programming.dev 2 points 3 years ago

Ex. An NBA or Sports instance containing /c/NBA /c/NFL /c/NHL and all the related teams.

[-] ruffsl@programming.dev 2 points 3 years ago

Perhaps pict-rs, Lemmy's image hosting backend, could auto downscale image uploads and only fail if the input was egregiously large to preserve upload bandwidth and avoid DDoSing. Would still be another added workload for the server.

Perhaps down scaling would be best done on the client side, then the resulting effect would be more transparent to the user before submission. Could that be done in easily in JS? Then that could help save storage and egress expenses for hosting funded only by donations.

[-] ruffsl@programming.dev 2 points 3 years ago

Not sure how to help on iOS. Perhaps you could modify the manifest file for the PWA, before installing it, and change the display property to something other than fullscreen or standalone, so that the browser navigation bar is retained, but at that point, might as well use the browser anyway.

https://developer.mozilla.org/en-US/docs/Web/Manifest/display

Perhaps you could file a ticket on the Lemmy UI repo about iOS PWA navigation? Although, surely iOS web devs must have a solution to such a common UI pattern.

[-] ruffsl@programming.dev 2 points 3 years ago

It would be kind of cool for the bot to consider the entire chain of comments up to and including one's reply that pings the bot. Although perhaps that feature could be gated behind a command argument, like when commanding bot accounts from GitHub comments for CI/CD. That could gard against unintentional prompt injection or dilution of context with longer reply chains. Thoughts @rikudou@lemmings.world ?

[-] ruffsl@programming.dev 2 points 3 years ago* (last edited 3 years ago)

Email is too big to change, too broken to fix… and too important to ignore.

That is such a great quote! Here is my attempt at such a quip:
Email's own complexity, legacy, and backwards compatibility divines its own Incorruptibility.

[-] ruffsl@programming.dev 2 points 3 years ago

One thing that could help improve this is better first-class support for cross-posting, integrations such as selectively merging discussion threads from communities on the same instance, to avoid fragmenting discussions, e.g. like how Hacker News can merge topics that reach mega-thread status. Posters could choose or be force to enable such cross posting for certain communities. E.g. if you want to post to the general !programming community, you first have to put forth a little effort to categorize your post by cross-posting from the most relevant community first. Although, this could be more akin to #tags, that may scale better with multiple matching categories.

Another feature that could help would be more advance moderation tools, such as post migration. Instead of closing or deleting offtopic posts, moderators could migrate posts with existing discussion threads to more appropriate communities on the same instance, e.g. just like how Discourse can re-categorize and manage user posts. I'm not sure how the logistics like the handoff between communities could work or how votes should be retained, but it's just a thought.

[-] ruffsl@programming.dev 2 points 3 years ago

Similar discussion:

[-] ruffsl@programming.dev 2 points 3 years ago* (last edited 3 years ago)

Thank you so much!

Not sure of the compatibility implications for Lemmy, or integration with pict-rs, but if you toggle the setting for lossless compression to export as WebP instead of PNG, the site above reports a ~40% memory size reduction: for at least the example Rust PNG icon I linked above. WebP is well already supported by browsers and mobile platforms:

BTW, if anyone finds a offline or FOSS CLI utility that matches the lossless compression results provided by ShortPixel and other sites like it, I'd love to know. I've found a few, but all fall short of the optimization these proprietary websites provide.

[-] ruffsl@programming.dev 3 points 3 years ago

Hear, hear!

I'd prefer to keep all lang communities on topic. E.g. I occasionally block and unblock !c/programmer_humor when I want to read technical news or just have a laugh. If memes crossed into all local subs, then the noise-to-news ratio couldn't be customized as easily.

Although I suppose tagging posts would be a better compromise.
Does Lemmy support tagging posts, or filtering feeds by tag yet?

[-] ruffsl@programming.dev 2 points 3 years ago

On that note (haha 🎶), I enjoy the "Pop Goes Classical" playlist on Spotify if I want to listen to something familiar and recent in pop culture, but played using classical instruments without distracting lyrics:

https://open.spotify.com/playlist/37i9dQZF1DWUPafHP1BJw1?si=k5VFZi7uR7WCpPamvEKneg

If it's something original like Mozart or Vivaldi, I get too enthralled with the classical scores, so backgrounding pop melodies over piano or string instruments is a compromise.

view more: ‹ prev next ›

ruffsl

0 post score
0 comment score
joined 3 years ago
MODERATOR OF