This file contains 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 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 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 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 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 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 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: |
This file contains 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
# Can use https://gist.github.com/magickatt/e7885f748c2ecd5bb88dd64828b30fbf | |
# to adopt the Deployment resources themselves | |
NAME=test | |
NAMESPACE=default | |
kubectl get -n $NAMESPACE deployment -o name \ | |
| xargs -I % kubectl patch -n $NAMESPACE % -p \ | |
'{"spec": {"template":{"metadata":{"annotations":{"meta.helm.sh/release-name": "$NAME"}}}}}' |
This file contains 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 | |
NAME=test | |
NAMESPACE=default | |
RESOURCES=service,role.rolebinding # Comma-delimited | |
kubectl get -n $NAMESPACE $RESOURCES -o name \ | |
| xargs -I % kubectl label -n $NAMESPACE % app.kubernetes.io/managed-by=Helm | |
kubectl get -n $NAMESPACE $RESOURCES -o name \ | |
| xargs -I % kubectl annotate -n $NAMESPACE % meta.helm.sh/release-name=$NAME |
This file contains 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
# https://stackoverflow.com/a/22981757 | |
import ctypes | |
so_name='/usr/lib64/libgmp.so.10' # or /usr/lib/libgmp.so, etc | |
var_name='__gmp_version' | |
L=ctypes.cdll.LoadLibrary(so_name) | |
v=ctypes.c_char_p.in_dll(L,var_name) | |
print(v.value) |
NewerOlder