Skip to content

Instantly share code, notes, and snippets.

View leovct's full-sized avatar

Léo Vincent leovct

View GitHub Profile
@leovct
leovct / kurtosis-cdk-cheat-sheet.sh
Last active June 30, 2025 15:57
Kurtosis CDK Cheat Sheets
############################################################
# ____ _____ ____ _ _____ __
# | _ \| ____| _ \| | / _ \ \ / /
# | | | | _| | |_) | | | | | \ V /
# | |_| | |___| __/| |__| |_| || |
# |____/|_____|_| |_____\___/ |_|
#
############################################################
# Deploy without cloning the repo.
#!/bin/bash
# Fetch PolygonScan zkEVM batch data.
# $ ./fetch_polygonscan.sh mainnet 2130013
# {
# "batchNumber": "2130013",
# "status": "Finalized",
# "verifyTimestamp": "2 hrs ago (Oct-07-2024 01:49:01 PM +UTC)",
# "verifyBlockNumber": "20914452",
# "verifyBatchTxHash": "0x34558961cd0f54d5d028e586d932a7799369f3c5074235f9d123dea85644c026",
#!/bin/bash
# Fetch batch data from multiple RPC endpoints.
usage() {
echo "Usage: $0 <network> <batch_number>"
echo " network: 'mainnet' or 'cardona'"
echo " batch_number: the batch number to query"
echo
echo "Example: $0 mainnet 2130013"
echo " $0 cardona 1000000"
@leovct
leovct / foo_controller_test_extract3.go
Created July 30, 2022 13:47
How to Test your Kubernetes Operator - Advanced integration test 3
Context("When deleting a pod with the same name as one of the Foo custom resourcess' friends", func() {
It("Should update the status of the first Foo custom resource", func() {
By("Deleting the pod")
ctx := context.Background()
pod := corev1.Pod{
ObjectMeta: metav1.ObjectMeta{
Name: foo1Friend,
Namespace: namespace,
},
}
@leovct
leovct / foo_controller_test_extract2.go
Last active July 30, 2022 13:46
How to Test your Kubernetes Operator - Advanced integration test 2
Context("When updating the name of a Foo custom resource's friend", func() {
It("Should update the status of the Foo custom resource", func() {
By("Getting the second Foo custom resource")
ctx := context.Background()
var foo2 tutorialv1.Foo
foo2Request := types.NamespacedName{
Name: foo2Name,
Namespace: namespace,
}
Expect(k8sClient.Get(ctx, foo2Request, &foo2)).To(Succeed())
@leovct
leovct / foo_controller_test_extract1.go
Last active July 30, 2022 13:46
How to Test your Kubernetes Operator - Advanced integration test 1
Context("When creating a pod with the same name as one of the Foo custom resources' friends", func() {
It("Should update the status of the first Foo custom resource", func() {
By("Creating the pod")
ctx := context.Background()
pod := corev1.Pod{
ObjectMeta: metav1.ObjectMeta{
Name: foo1Friend,
Namespace: namespace,
},
Spec: corev1.PodSpec{
@leovct
leovct / foo_controller_test.go
Last active July 30, 2022 13:38
How to Test your Kubernetes Operator - Simple integration tests
package controllers
import (
"context"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@leovct
leovct / suite_test.go
Last active October 10, 2023 07:10
How to Test your Kubernetes Operator - Test environment setup
package controller
import (
"context"
"fmt"
"path/filepath"
"runtime"
"testing"
ctrl "sigs.k8s.io/controller-runtime"
@leovct
leovct / color_test.go
Created July 17, 2022 16:13
How to Test your Kubernetes Operator - Color tests
package color
import (
"strings"
"testing"
)
func TestConvertStrToColor(t *testing.T) {
type test struct {
name string
@leovct
leovct / color.go
Created July 12, 2022 11:50
How to Test your Kubernetes Operator - Color package
package color
import (
"crypto/md5"
"encoding/hex"
"strconv"
)
// Convert a string to one of the 12 colors of the color wheel.
func ConvertStrToColor(s string) string {