This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM python:3.13-slim-bookworm | |
| RUN pip install speedtest-cli | |
| ENTRYPOINT ["speedtest-cli"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| instance_id=$(curl -s http://169.254.169.254/latest/meta-data/instance-id) | |
| # Find any unassociated Elastic IPs for this EKS cluster, and associate 1 to this node | |
| allocate_eip () { | |
| allocation_ids_string=$(aws ec2 describe-addresses --filters Name=tag:cluster,Values=${cluster} --query "Addresses[?NetworkInterfaceId == null ].AllocationId" --output text) | |
| allocation_ids=($allocation_ids_string) | |
| # Check if there is at least 1 Elastic IP free | |
| if [ ${#allocation_ids[@]} -eq 0 ]; then | |
| return 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| brew install source-highlight | |
| # Tell less where source-highlight is installed | |
| # https://www.gnu.org/software/src-highlite/source-highlight.html#Using-source_002dhighlight-with-less | |
| export LESSOPEN="| $(brew list source-highlight | grep src-hilite-lesspipe.sh) %s" | |
| export LESS=' -R ' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # Combination of generating the JWT and the token | |
| # https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/generating-a-json-web-token-jwt-for-a-github-app#generating-a-json-web-token-jwt | |
| # https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/authenticating-as-a-github-app#using-a-json-web-token-jwt-to-authenticate-as-a-github-app | |
| # https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/generating-an-installation-access-token-for-a-github-app#generating-an-installation-access-token | |
| # https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/authenticating-as-a-github-app-installation | |
| set -o pipefail |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| jobs: | |
| unit-tests: | |
| name: Unit Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Go |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package cmd | |
| import ( | |
| "fmt" | |
| "os" | |
| "text/tabwriter" | |
| "github.com/you/your-project/cmd/testcmd" | |
| "github.com/spf13/cobra" | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ctx := context.TODO() | |
| queueName := "something" | |
| endpointURL := "http://localhost:9324" | |
| messageBody := "test" | |
| // Create a custom endpoint resolver for ElasticMQ | |
| elasticmqResolver := aws.EndpointResolverWithOptionsFunc(func(service, region string, options ...interface{}) (aws.Endpoint, error) { | |
| if service == sqs.ServiceID { | |
| return aws.Endpoint{URL: endpointURL}, nil | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| PARENT_NAMESPACE=pizzeria | |
| CHILD_NAMESPACE=pepperoni | |
| $ kubectl annotate namespace $CHILD_NAMESPACE \ | |
| hnc.x-k8s.io/subnamespace-of=$PARENT_NAMESPACE | |
| # namespace/pepperoni annotated | |
| $ cat <<EOF | kubectl apply -f - | |
| apiVersion: hnc.x-k8s.io/v1alpha2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apiVersion: batch/v1 | |
| kind: CronJob | |
| metadata: | |
| name: "restart-{{ $application.name }}" | |
| namespace: "{{ $.Release.Namespace }}" | |
| spec: | |
| concurrencyPolicy: Forbid | |
| schedule: "* * * * *" # crontab.guru | |
| jobTemplate: | |
| spec: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Latest Release | |
| # Customise for the tag format you are using | |
| on: | |
| push: | |
| tags: | |
| - v* | |
| # Required for the release action to upload artifacts | |
| permissions: |
NewerOlder