Skip to content

Instantly share code, notes, and snippets.

View chiradeep's full-sized avatar

Chiradeep Vittal chiradeep

View GitHub Profile
https://download.llamameta.net/*?Policy=eyJTdGF0ZW1lbnQiOlt7InVuaXF1ZV9oYXNoIjoidXd3dnZzemh3cWQwZHZzYTQ2NTFybHp0IiwiUmVzb3VyY2UiOiJodHRwczpcL1wvZG93bmxvYWQubGxhbWFtZXRhLm5ldFwvKiIsIkNvbmRpdGlvbiI6eyJEYXRlTGVzc1RoYW4iOnsiQVdTOkVwb2NoVGltZSI6MTcwODQ2NjYyNn19fV19&Signature=Lea2cBXYpgNT-0TnLxiS7d8A5vMpjTnTcqzfW9g7fLUqhagorfuCAUGH939vbJGGrueW3259iQNYLFRTkjsAWaa6l28PT289DDGKDSX3qgRJ28F0bEHshz7oSVi-eA8tP-huno4zRTEjLNwza23-S9sD5iw8cK-vOroTqZaXSRlrB-2%7E3jeBZ79Fr5lzP6XHFyjkZ1of445vj-6NCV3A6jqJtQ4iMyo9KtoW9i3Nfzdz0Mnm3fLuRJ7BpBg8GVsBp2j8HJySjWj2c%7E0xgurB1zcdyXNulv81AEN-3BTbMW6O6qRYdYJ2VsOvfD5J3xbZhPniC4Mb-atOJl2S6zEPgA__&Key-Pair-Id=K15QRJLYKIFSLZ&Download-Request-ID=766058328316875
@chiradeep
chiradeep / Code.gs
Last active April 3, 2022 16:42
Google App Script to Collect GH Traffic Stats into Google Sheets
//Setup:
// Create a sheet with the first sheet called 'TrafficData'. Cell Values are:
// A1: Repo Traffic Collector
// A3: Organization B3: <org value>
// A4: Repo B4: <repo name>
// A7: Date, B7: Views, C7: Uniques, D7: Weeknumber
//Tools -> Script Editor
//Add this script, fill in your GitHub TOKEN (https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line)
//Run the onOpen script - you will be warned it is insecure, but accept anyway. This should add a menu item to your sheet
//Use the Custom GitHub menu to run the getRepoTrafficStats function
@chiradeep
chiradeep / citrix-k8s-cpx-ingress.yaml
Last active November 21, 2019 06:39
Deploy Citrix CPX as an Ingress Controller with Prometheus monitoring
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: cpx-ingress-k8s-role
rules:
- apiGroups: [""]
resources: ["services", "endpoints", "ingresses", "pods", "secrets"]
verbs: ["*"]
- apiGroups: ["extensions"]
@chiradeep
chiradeep / gist:80a76a661309b193a458351814bf398f
Created September 21, 2018 16:38
Watch for changes in Endpoints using K8s native Python client
from kubernetes import client, config, watch
config.load_kube_config()
api_v1 = client.CoreV1Api()
def watch_endpoints():
w = watch.Watch()
for event in w.stream(api_v1.list_namespaced_endpoints, "default"):
print(event)
{
"$schema": "https://vega.github.io/schema/vega/v4.json",
"width": 720,
"height": 720,
"padding": 5,
"autosize": "none",
"signals": [
{
"name": "labels", "value": true,
@chiradeep
chiradeep / policy_export.py
Last active July 15, 2018 23:53
Export existing content switching policies and cs vserver into NetScaler Ansible playbook
import requests
from collections import OrderedDict
import yaml
import yamlloader
cs_vserver = 'test_csvserver'
ns_host = 'localhost:32769'
ns_login = 'nsroot'
ns_password= 'nsroot'
url = 'http://%s/nitro/v1/config/csvserver_cspolicy_binding/%s' % (ns_host, cs_vserver)
<!DOCTYPE html>
<meta charset="utf-8">
<link rel="stylesheet" href="http://cmx.io/v/0.1/cmx.css">
<script src="http://cmx.io/v/0.1/cmx.js" charset="utf-8"></script>
<style>.cmx-user-scene4 .cmx-text-border .cmx-path {stroke: orange}</style>
<body>
<div style="max-width:900px; -webkit-transform:rotate(0deg)">
<scene id="scene1">
<label t="translate(0,346)">

Integrate a Next Gen Firewall with Citrix NetScaler VPX in AWS

Overview

Quickly deploy a single tier webserver farm solution integrating the Citrix NetScaler loadbalancer and a Next Generation firewall. Solution components include:

  • a CloudFormation template (vpc_2azs.json) to deploy a VPC across 2 zones. There are 2 subnets in each zone: a Public Subnet and a Private Subnet. Internet facing appliances such as the NetScaler and NG FW are deployed in the Public Subnet while the web server farm is deployed in the private subnet.
  • a CloudFormation template (ns.1nic.json) to deploy a single NetScaler VPX appliance in the Public Subnet in one zone
  • a CloudFormation template (webservers.json)to deploy 2 web servers in the Private Subnet in the same zone as the NetScaler VPX
  • a CloudFormation template (pa-fw.json) to deploy a single Next Gen Firewall (Palo Alto VM Series) in the Public Subnet with a network interface in the Private Subnet (same zone as above).
@chiradeep
chiradeep / generate_haproxy_cfg.py
Created August 10, 2016 19:02
Simple Jinja2 template to generate HAProxy cfg
from jinja2 import Environment, FileSystemLoader
def render_haproxy_cfg(services):
env = Environment(loader=FileSystemLoader ('templates'), trim_blocks=True)
templ = env.get_template('haproxy.jinja2.cfg')
outp = templ.render(services=services)
outp = templ.render(services=services)
with open('haproxy.cfg', 'wb') as f:
f.write(outp)
#!/bin/bash
set -x
master_ip=$1
ipaddr=$(ip addr show dev eth0 | grep "inet " | cut -d ' ' -f 6 | cut -f 1 -d '/')
is_master=${2:-"true"}
[ -n "$master_ip" ] || exit 1