Skip to content

Instantly share code, notes, and snippets.

View nilesh93's full-sized avatar
🎯
Focusing

Nilesh Jayanandana nilesh93

🎯
Focusing
  • @platformer-com
  • Colombo, Sri Lanka
View GitHub Profile
@nilesh93
nilesh93 / .net update
Created April 25, 2023 16:19
.net update
// Define the URL where updates are available
string updateUrl = "http://yourdomain.com/update.xml";
// Check for updates
var updateChecker = new System.Net.WebClient();
string updateXml = updateChecker.DownloadString(updateUrl);
// Parse the update XML
var doc = new System.Xml.XmlDocument();
doc.LoadXml(updateXml);
@nilesh93
nilesh93 / init.sh
Created September 2, 2022 05:21
choreo-local-dev
#!/bin/sh
mkdir -p .choreo
mkdir -p .githook
cat > .githook/pre-commit <<EOF
#!/bin/bash
APP_NAME=$(cat Ballerina.toml | grep "name =" | cut -d"=" -f2- | sed 's/\"//g; s/\ //g')
rm -rf .choreo/build
mkdir -p .choreo/build
apiVersion: "cilium.io/v2"
kind: CiliumNetworkPolicy
metadata:
name: "defult-capture"
spec:
endpointSelector:
matchLabels: {}
egress:
- toFQDNs:
- matchPattern: "*"
@nilesh93
nilesh93 / cillium-envoy-config.yaml
Last active August 23, 2022 05:35
Cilium Traffic Splitting
apiVersion: cilium.io/v2
kind: CiliumEnvoyConfig
metadata:
name: envoy-lb-listener
namespace: default
spec:
services:
- name: traffic-split-svc
namespace: default
backendServices:
apiVersion: v1
clusters:
- cluster:
server: <insert-data-2>
insecure-skip-tls-verify: true
name: katakoda-cluster
contexts:
- context:
cluster: katakoda-cluster
user: katakoda-cluster
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
annotations:
rbac.authorization.kubernetes.io/autoupdate: "true"
labels:
kubernetes.io/bootstrapping: rbac-defaults
name: cluster-admin
rules:
- apiGroups:
@nilesh93
nilesh93 / acr-token-generate.sh
Created November 8, 2020 04:07
arg1=ACR_NAME, arg2=SERVICE_PRINCIPAL_NAME
#generate service pricipal id and password using below command under shell script file
# Modify for your environment.
ACR_NAME=$1
SERVICE_PRINCIPAL_NAME=$2
ACR_NAME=cloudmanager.azurecr.io
SERVICE_PRINCIPAL_NAME=acr-service-principal
# Obtain the full registry ID for subsequent command args
ACR_REGISTRY_ID=$(az acr show --name $ACR_NAME --query id --output tsv)
@nilesh93
nilesh93 / sidecar-log-stream.yaml
Created October 15, 2020 09:26
Pod Sidecar Log Stream Example
apiVersion: v1
kind: Pod
metadata:
name: counter
spec:
containers:
- name: date
image: busybox
args:
#!/bin/bash
## prerequisites-kubernetes.sh
## Generic installation on all nodes
K8S_VERSION="$1"
## Enable IP Forwarding
sysctl -w net.ipv4.ip_forward=1
sed -i 's/#net.ipv4.ip_forward=1/net.ipv4.ip_forward=1/g' /etc/sysctl.conf
sudo sysctl -p /etc/sysctl.conf
#!/bin/sh
api="$1"
namespace="$2"
insecure="$3"
dir="$4"
output="$(kubectl get api $api -n $namespace -o json | jq '.metadata.name' -r)"
echo "$output"