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/sh | |
NS=$1 | |
# Delete existing pods and services if they exist | |
kubectl -n $NS delete pod pod1 pod2 --ignore-not-found | |
kubectl -n $NS delete service pod1-svc pod2-svc --ignore-not-found | |
# Create services | |
kubectl -n $NS create service clusterip pod1-svc --tcp=8080:8080 --dry-run=client -o yaml | kubectl set selector --local -f - 'run=pod1' -o yaml | kubectl -n $NS apply -f - | |
kubectl -n $NS create service clusterip pod2-svc --tcp=8080:8080 --dry-run=client -o yaml | kubectl set selector --local -f - 'run=pod2' -o yaml | kubectl -n $NS apply -f - |
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
import requests | |
def make_post_request(base_url, action, duration_seconds, web_identity_token, version): | |
# Define the URL and query parameters | |
url = base_url | |
params = { | |
"Action": action, | |
"DurationSeconds": duration_seconds, | |
"WebIdentityToken": web_identity_token, | |
"Version": version |
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
awk '/-----BEGIN CERTIFICATE-----/{f++}{print > "cert" f ".pem"}' yourfile.pem && for cert in cert*.pem; do kubectl create secret tls $(basename $cert .pem) --cert=$cert --dry-run=client -o yaml | kubectl apply -f -; done |
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: admissionregistration.k8s.io/v1alpha1 | |
kind: MutatingAdmissionPolicy | |
metadata: | |
name: "modify-init-container-security-context" | |
spec: | |
matchConstraints: | |
resourceRules: | |
- apiGroups: ["apps"] | |
apiVersions: ["v1"] | |
operations: ["CREATE", "UPDATE"] |
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: projectcalico.org/v3 | |
kind: NetworkPolicy | |
metadata: | |
name: allow-same-namespace-communication | |
namespace: my-namespace | |
spec: | |
selector: app == 'myapp' # Applies to pods with the label `app=myapp` | |
types: | |
- Ingress | |
- Egress |
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: v1 | |
kind: Secret | |
metadata: | |
name: storage-configuration | |
namespace: minio-tenant | |
stringData: | |
config.env: |- | |
export MINIO_ROOT_USER="minio" | |
export MINIO_ROOT_PASSWORD="minio123" | |
export MINIO_STORAGE_CLASS_STANDARD="EC:2" |
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
defmodule YourApp.Validators.Email do | |
use Ecto.Changeset | |
@mail_regex ~r/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/ | |
# ensure that the email looks valid | |
def validate_email(changeset, field) do | |
changeset | |
|> validate_format(field, @mail_regex) | |
end | |
end |
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
CREATE CONSTRAINT ON (l:Location) ASSERT l.locationid IS UNIQUE; | |
CREATE INDEX ON :Location(locationid); | |
USING PERIODIC COMMIT 5000 | |
LOAD CSV WITH HEADERS FROM 'file:///wln_label-type.txt.csv' AS line WITH line | |
MERGE (location:Location {locationid: toInt(line.locationid)} ) | |
RETURN COUNT(location); |
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
# -*- coding: utf-8 -*- | |
""" | |
Created on Wed May 25 11:26:57 2016 | |
@author: julius | |
""" | |
import getopt, sys |
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
defmodule ListAndRecursion do | |
def all?([head | tail], filter) do | |
if filter.(head) == true do | |
pall?(tail, filter, true) | |
else | |
false | |
end | |
end | |
defp pall?([head | tail], filter, _previous) do | |
if filter.(head) == true do |
NewerOlder