Skip to content

Instantly share code, notes, and snippets.

View chukaofili's full-sized avatar

Chuka Ofili chukaofili

View GitHub Profile
@chukaofili
chukaofili / ExampleController.js
Created May 19, 2016 08:01
Sails Paginate Service
/**
* ExampleController.js
*/
module.exports = {
list: function(req, res) {
var perPage = req.query.per_page;
var currentPage = req.query.page;
var conditions = {active: true};
PaginationService.paginate(res, SailsModelHere, conditions, currentPage, perPage, [{name: 'AssociatedModel', query: {isDeleted: false}}], 'createdAt DESC');
@chukaofili
chukaofili / README.md
Last active June 30, 2018 15:17
Persistent LoopBack Alias

Loopback Alias

Creates an alias on the loopback interface (lo0) with the IP 200.0.0.1 on Mac OS X.

Installation

  1. Install the plist to: /Library/LaunchDaemons/com.runlevel1.lo0.200.0.0.1.plist
  2. Set mode: chmod 0644 /Library/LaunchDaemons/com.runlevel1.lo0.200.0.0.1.plist
  3. Set owner: sudo chown root:wheel /Library/LaunchDaemons/com.runlevel1.lo0.200.0.0.1.plist
  4. Load: sudo launchctl load /Library/LaunchDaemons/com.runlevel1.lo0.200.0.0.1.plist

Keybase proof

I hereby claim:

  • I am chukaofili on github.
  • I am chuka (https://keybase.io/chuka) on keybase.
  • I have a public key ASDH2L0dSJmaX2CcTXURqsSrejb7oFArvJ173y0AO3AEHQo

To claim this, I am signing this object:

@chukaofili
chukaofili / install-k8s.sh
Last active June 21, 2020 14:27
K8s on DigitalOcean
#!/bin/bash
sudo su
echo "Initializing docker service ..."
systemctl enable docker && systemctl start docker
echo "Docker service initialized successfully."
echo "Installing CNI ..."
CNI_VERSION="v0.6.0"
mkdir -p /opt/cni/bin
@chukaofili
chukaofili / echo-server.yml
Last active October 19, 2021 01:29
Echo Server Deployment
apiVersion: v1
kind: Namespace
metadata:
name: echoserver
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: echoserver
namespace: echoserver
@chukaofili
chukaofili / ingress-nginx.sh
Last active June 21, 2020 14:26
Nginx Ingress
#!/bin/bash
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/namespace.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/default-backend.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/configmap.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/tcp-services-configmap.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/udp-services-configmap.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/rbac.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/with-rbac.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/provider/baremetal/service-nodeport.yaml
@chukaofili
chukaofili / digitalocean-secret.yml
Created May 18, 2018 12:39
DigitalOcean secret for flex-plugin provisioner
apiVersion: v1
kind: Secret
metadata:
name: digitalocean
namespace: kube-system
data:
access-token: [base64-encoded-string-goes-here]
@chukaofili
chukaofili / digitalocean-provisioner.yml
Created May 18, 2018 12:41
DigitalOcean flex-plugin provisioner
apiVersion: apps/v1beta2
kind: Deployment
metadata:
labels:
app: digitalocean-provisioner
name: digitalocean-provisioner
namespace: kube-system
spec:
replicas: 2
selector:
@chukaofili
chukaofili / digitalocean-flexplugin-deploy.yml
Created May 18, 2018 12:41
DigitalOcean flexplugin deploy
apiVersion: apps/v1beta2
kind: DaemonSet
metadata:
labels:
app: digitalocean-flexplugin-deploy
name: digitalocean-flexplugin-deploy
namespace: kube-system
spec:
selector:
matchLabels:
@chukaofili
chukaofili / digitalocean-flexplugin-rbac.yml
Created May 18, 2018 12:43
DigitalOcean rbac flexplugin deploy
apiVersion: v1
kind: ServiceAccount
metadata:
name: digitalocean-provisioner
namespace: kube-system
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: digitalocean-provisioner