Skip to content

Instantly share code, notes, and snippets.

Avatar

Pratik Mallya pratikmallya

View GitHub Profile
View foo.rst
.. code:: hcl
resource "google_compute_global_address" "global-static-<SERVICE_NAME>" {
project = "<PROJECT_NAME>"
name = "<SERVICE_NAME>"
}
@pratikmallya
pratikmallya / faildiffererntly.go
Created Feb 10, 2020
echo server that returns different http status codes
View faildiffererntly.go
package main
import (
"github.com/labstack/echo"
"net/http"
)
func main() {
e := echo.New()
e.Use(FailDifferently)
@pratikmallya
pratikmallya / deploy_daemonset_hpa.yaml
Last active Jan 8, 2020
Simulating a daemonset with a deployment
View deploy_daemonset_hpa.yaml
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: nginx
spec:
minReplicas: 1
maxReplicas: 10000
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
View rfc_over_time.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View gist:e2ccb486d32f166f06b4fcd76f80644a
2018-11-29T15:20:27.859-0800 [DEBUG] plugin.terraform-provider-google_v1.18.0_x4: ---[ REQUEST ]---------------------------------------
2018-11-29T15:20:27.859-0800 [DEBUG] plugin.terraform-provider-google_v1.18.0_x4: PUT /v1beta1/projects/liveramp-eng-actbe/locations/us-central1/clusters/act-be-prod-cluster?alt=json&prettyPrint=false HTTP/1.1
2018-11-29T15:20:27.859-0800 [DEBUG] plugin.terraform-provider-google_v1.18.0_x4: Host: container.googleapis.com
2018-11-29T15:20:27.859-0800 [DEBUG] plugin.terraform-provider-google_v1.18.0_x4: User-Agent: google-api-go-client/0.5 Terraform/0.11.7 (+https://www.terraform.io)
2018-11-29T15:20:27.859-0800 [DEBUG] plugin.terraform-provider-google_v1.18.0_x4: Content-Length: 14
2018-11-29T15:20:27.859-0800 [DEBUG] plugin.terraform-provider-google_v1.18.0_x4: Content-Type: application/json
2018-11-29T15:20:27.859-0800 [DEBUG] plugin.terraform-provider-google_v1.18.0_x4: Accept-Encoding: gzip
2018-11-29T15:20:27.859-0800 [DEBUG] plugin.terraform-provider-google_v1.18.0_x4:
2
View keybase.md

Keybase proof

I hereby claim:

  • I am pratikmallya on github.
  • I am pratikmallya (https://keybase.io/pratikmallya) on keybase.
  • I have a public key ASC2gLFkR_rfTTjNNTKzOYc0RFr5KSIObVU0N8-fTrCivgo

To claim this, I am signing this object:

@pratikmallya
pratikmallya / BASH_k8s_template.md
Last active Jan 24, 2018
Using BASH environment variables in k8s templates
View BASH_k8s_template.md

When deploying k8s resources from task runners (like Jenkins) its often convenient to use environment variables directly in the template, and then pre-process the template using envsubst before feeding it to kubectl apply.

That can be accomplished by the following one liner (assuming you have gettext GNU package installed, which provides envsubst):

envsubst < k8s_template.yml | kubectl apply -f -

example k8s_template.yml:

@pratikmallya
pratikmallya / bobp-python.md
Created Aug 30, 2016 — forked from sloria/bobp-python.md
A "Best of the Best Practices" (BOBP) guide to developing in Python.
View bobp-python.md

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
@pratikmallya
pratikmallya / CreateJob.sh
Created Aug 29, 2016 — forked from stuart-warren/CreateJob.sh
Create a job in Jenkins (or folder) using the HTTP API
View CreateJob.sh
# check if job exists
curl -XGET 'http://jenkins/checkJobName?value=yourJobFolderName' --user user.name:YourAPIToken
# with folder plugin
curl -s -XPOST 'http://jenkins/job/FolderName/createItem?name=yourJobName' --data-binary @config.xml -H "Content-Type:text/xml" --user user.name:YourAPIToken
# without folder plugin
curl -s -XPOST 'http://jenkins/createItem?name=yourJobName' --data-binary @config.xml -H "Content-Type:text/xml" --user user.name:YourAPIToken
# create folder
View bash.generate.random.alphanumeric.string.sh
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1
You can’t perform that action at this time.