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
#For PHP country Information
https://github.com/rinvex/country
#PHP enable CORS
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: POST, GET, OPTIONS, PUT, DELETE');
@nilesh93
nilesh93 / angular-watchers-count
Created April 28, 2017 05:21
Get Angular Watchers count
(function () {
if (!angular) {
console.log('Not a angular application or window.angular not found');
return;
}
var root = angular.element(document.getElementsByTagName('body'));
var watchers = [];
function getWatchers(root) {
root = angular.element(root || document.documentElement);
var watcherCount = 0;
function getElemWatchers(element) {
var isolateWatchers = getWatchersFromScope(element.data().$isolateScope);
var scopeWatchers = getWatchersFromScope(element.data().$scope);
var watchers = scopeWatchers.concat(isolateWatchers);
angular.forEach(element.children(), function (childElement) {
watchers = watchers.concat(getElemWatchers(angular.element(childElement)));
@nilesh93
nilesh93 / nfs-server.yaml
Created July 30, 2018 14:49
Kubernetes NFS Server 001
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: nfs-server
spec:
replicas: 1
selector:
matchLabels:
role: nfs-server
template:
apiVersion: v1
kind: Service
metadata:
name: nfs-server
spec:
# clusterIP: 10.3.240.20
ports:
- name: nfs
port: 2049
- name: mountd
apiVersion: v1
kind: PersistentVolume
metadata:
name: nfs
spec:
capacity:
storage: 10Gi
accessModes:
- ReadWriteMany
nfs:
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: nfs-busybox
spec:
replicas: 1
selector:
matchLabels:
name: nfs-busybox
template:
#!/bin/bash
yum -y update
yum -y install net-tools wget telnet yum-utils device-mapper-persistent-data lvm2
### Add Docker repository.
yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo -y
apiVersion: kubeadm.k8s.io/v1beta1
kind: ClusterConfiguration
kubernetesVersion: v1.14.3 # change according to kubeadm supported version
apiServer:
certSANs:
- 127.0.0.1
- cluster-api.example.com # change according to your requirements
extraArgs:
authorization-mode: Node,RBAC
feature-gates: "TTLAfterFinished=true"
#!bin/bash
sudo ufw allow http
sudo ufw allow https
sudo ufw allow 6443/tcp # apiserver
sudo ufw allow 7000/tcp # stats
sudo ufw allow 9101/tcp # metrics exporter
sudo apt-get -y install haproxy
sudo service haproxy restart