ruffsl

joined 2 years ago
MODERATOR OF
 

Related publication:

 

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

 

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
 

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

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

 

April fool's!

 

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

April fool's!

[–] ruffsl@programming.dev 2 points 2 years ago

A while back, I tried looking into what it would take to modify Android to disable Bluetooth microphones for wireless headsets, allowing for call audio to be streamed via regular AAC or aptX, and for the call microphone to be captured from the phones internal mic. This would prevent the bit rate for call audio in microphone being effectively halved when using the ancient HFP/HSP Bluetooth codecs, instead allowing for the same call quality as when using a wired headset. This would help when multitasking with different audio sources, such as listening to music while hanging out on discord, without the music being distorted from the lower bit rate of HFP/HSP. This would also benefit regular VoLTE, as the regular call audio quality already exceeds that of legacy Bluetooth headset profiles.

Although, I didn't manage to tease apart the mechanics of the audio policy configuration files used by the source Android project, given the sparse documentation and vague commit history.

I'd certainly be fine with the awkwardness of holding up and speaking to my phone as if it was in speaker mode, but listening to the call over wireless headphones, in order to improve or double the audio quality. Always wondered what these audio policies fall back to when a Bluetooth device doesn't have a headset profile, but it's almost impossible to find high quality consumer grade Bluetooth headphones without a microphone nowadays.

[–] ruffsl@programming.dev 2 points 2 years ago

For the call setting under Bluetooth audio devices, I really wish they would break out or separate the settings for using the audio device as a source or sink for call audio. Sort of like how you can disable HSP/HSF Bluetooth profiles for audio devices in Linux or Windows.

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

Thanks, fixed!

[–] ruffsl@programming.dev 2 points 2 years ago (2 children)

Has Bryan done any more recent recorded talks?

[–] ruffsl@programming.dev 2 points 2 years ago

The only experience I have with working with Fortran would be setting up gfortran when building SciPy from source, and perusing its codebase to see how it's FFT functions were so optimized. Not enough to diligently mod I'm afraid.

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

That's would be one long commute to the job site. Likely only a one way trip. I guess if cryostasis every becomes viable for human space flight, you'd have a better chance living long enough to catch up to the craft, but then you'd probably have the hassle of getting reassigned to a new office team, given all your old colleagues would have long retired, and who would really want to start patching hardware in production with a support crew you only just met after waking up. Sounds like a tough remote working environment, with all the cons in a aynchronous workplace, but with none of the perk in working from home.

[–] ruffsl@programming.dev 10 points 2 years ago (4 children)

I was thinking of cross posting this to a Fortran community, but it looks like we don't yet have one.

[–] ruffsl@programming.dev 2 points 2 years ago (1 children)

I'm not sure why, but GitHub's search engine, Blackbird, seems to be returning some erroneous results for this query:

Any chance you could narrow down your search to a list of repose that use the library that pulls in tnt_select() function, then clone and manually grep just those, or is it's use too common to index by?

Real funny that even narrowing down GitHub search to just the same repo doesn't help the query results:

[–] ruffsl@programming.dev 1 points 2 years ago* (last edited 2 years ago) (1 children)

Ah, I've got a old android phone that could be perfect for this. Thanks for the heads up about Macro Deck!

By the way, does Macro Deck utilize multi touch support? That could enable the use of modifier keys to expand the button functionality, without having the add so many dedicated buttons. For example, the video makes use of modifier for individually switching the keyboard and mouse without changing the video, in case using a multi screen KVM setup.

[–] ruffsl@programming.dev 13 points 2 years ago

Pain... This too painful to be posted as just a meme...

view more: ‹ prev next ›