Skip to content

Instantly share code, notes, and snippets.

View Skarlso's full-sized avatar
🏫
On training

Gergely Brautigam Skarlso

🏫
On training
View GitHub Profile
Context("can add a nodegroup into a new subnet", func() {
FIt("creates a new nodegroup", func() {
cfg := &api.ClusterConfig{
Metadata: &api.ClusterMeta{
Name: params.ClusterName,
Region: params.Region,
},
}
ctl, err := eks.New(&api.ProviderConfig{Region: params.Region}, cfg)
Expect(err).NotTo(HaveOccurred())
apiVersion: kustomize.toolkit.fluxcd.io/v1beta1
kind: Kustomization
metadata:
creationTimestamp: null
name: pctl-profile-dependson-nginx-nginx-chart
namespace: default
spec:
dependsOn:
- name: pctl-profile-dependson-nginx-dependon
namespace: default
@Skarlso
Skarlso / docker_image.go
Last active July 17, 2020 19:34
A convenient, succinct regex to verify validity of docker image tags without lookahead or lookbehind
// Deals with the following formats:
// image/tag:v1.0.0
// 123.123.123.123:123/image/tag:v1.0.0
// your-domain.com/image/tag
// your-domain.com/image/tag:v1.1.1-patch1
// image/tag
// image
// image:v1.1.1-patch
// ubuntu@sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2
// etc...
@Skarlso
Skarlso / rotate.go
Created April 12, 2020 05:53
Rotate a matrix 90 degrees
// going with the transpose / reverse solution
func rotate(matrix [][]int) {
n := len(matrix);
for i := 0; i<n; i++ {
for j := i + 1; j < n; j++ {
matrix[i][j], matrix[j][i] = matrix[j][i], matrix[i][j]
}
}
for i := 0; i<n; i++ {
func isValidSudoku(board [][]byte) bool {
var colV [9][9]int
var rowV [9][9]int
var boxV [9][9]int
for row := 0; row < 9; row++ {
for col := 0; col < 9; col++ {
value := board[row][col] - '0'
if value > 0 && value <= 9 {
if rowV[row][value-1] != 0 || colV[col][value-1] != 0 {
@Skarlso
Skarlso / longest_palindrome.go
Created March 6, 2020 16:10
Longest palindrome in string using Go
func longestPalindrome(s string) string {
if len(s) < 1 {
return ""
}
start := 0
end := 0
for i := 0; i < len(s); i++ {
len1 := expandAroundCenter(s, i, i)
len2 := expandAroundCenter(s, i, i+1)
len := int(math.Max(float64(len1), float64(len2)))
package main
import (
"bufio"
"fmt"
"io"
"os"
"strconv"
"strings"
)
@Skarlso
Skarlso / tree_building.go
Last active October 21, 2019 15:26
tree-building
package tree
import (
"errors"
"sort"
)
type Record struct {
ID int
Parent int
@Skarlso
Skarlso / main.go
Created September 23, 2019 20:43
Idle RPG checker
package main
import (
"context"
"crypto/tls"
"encoding/xml"
"flag"
"fmt"
"io/ioutil"
"net/http"
@Skarlso
Skarlso / athens_deployment.yaml
Last active November 29, 2019 07:31
Service Files for Kubernetes to deploy Athens -- Assumes cert-manager is installed.
apiVersion: apps/v1
kind: Deployment
metadata:
namespace: athens
name: athens-app
labels:
app: athens
spec:
replicas: 1
selector: