Skip to content

Instantly share code, notes, and snippets.

@pratikmallya
pratikmallya / tail.go
Created May 9, 2024 15:32
A tail implementation using inotify (fsnotify)
package main
import (
"bufio"
"fmt"
"log"
"os"
"github.com/fsnotify/fsnotify"
)
@pratikmallya
pratikmallya / gist:4cbb43d03a5ed9afdf932bf38fdfd4e4
Last active October 21, 2021 06:53
List of brew packages
❯ brew list --full-name -1
autoconf
aws-okta
awscli
ca-certificates
fish
fzf
gdbm
git-delta
jq
heat_template_version: 2013-05-23
description: |
This is a Heat template to deploy a single Linux server running WordPress.
parameter_groups:
- label: Server Settings
parameters:
- server_hostname
@pratikmallya
pratikmallya / faildiffererntly.go
Created February 10, 2020 07:29
echo server that returns different http status codes
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 January 8, 2020 21:25
Simulating a daemonset with a deployment
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: nginx
spec:
minReplicas: 1
maxReplicas: 10000
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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

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 January 24, 2018 06:28
Using BASH environment variables in k8s templates

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: