Skip to content

Instantly share code, notes, and snippets.

Avatar
💆‍♂️
Need a head massage badly.

pTk pratheekhegde

💆‍♂️
Need a head massage badly.
View GitHub Profile
View git-author-rewrite.sh
#!/bin/sh
git filter-branch --env-filter '
OLD_EMAIL="your-old-email@example.com"
CORRECT_NAME="Your Correct Name"
CORRECT_EMAIL="your-correct-email@example.com"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
View minio-s3-django-env-vars
AWS_STORAGE_BUCKET_NAME = 'mybucket'
AWS_S3_REGION_NAME = 'us-east-1'
AWS_ACCESS_KEY_ID = "minio_access"
AWS_SECRET_ACCESS_KEY = "minio_secret"
S3_USE_SIGV4 = True
AWS_S3_ENDPOINT_URL = 'http://127.0.0.1:9000'
AWS_S3_USE_SSL = False
@pratheekhegde
pratheekhegde / lamda-rds-snapshot-with-sns.js
Created August 12, 2018 05:53
Lamda function for taking manual RDS snapshot with email alerts.
View lamda-rds-snapshot-with-sns.js
var AWS = require('aws-sdk');
const awsConf = {
accessKeyId: process.env.ACCESS_KEY,
secretAccessKey: process.env.SECRET_KEY,
region: process.env.REGION
}
const rdsConfig = {
apiVersion: '2014-10-31',
@pratheekhegde
pratheekhegde / lamda-rds-snapshot.js
Created August 10, 2018 05:34
Lamda function for taking manual RDS snapshot.
View lamda-rds-snapshot.js
var AWS = require('aws-sdk');
const rdsConfig = {
apiVersion: '2014-10-31',
accessKeyId: process.env.ACCESS_KEY,
secretAccessKey: process.env.SECRET_KEY,
region: process.env.REGION
}
const rds = new AWS.RDS(rdsConfig);
@pratheekhegde
pratheekhegde / my-site.conf
Created August 9, 2018 17:57
Nginx config for a Frontend App
View my-site.conf
server {
server_name www.my-site.com
listen 80;
# Get the actual IP of the client through load balancer in the logs
real_ip_header X-Forwarded-For;
set_real_ip_from 0.0.0.0/0;
# redirect if someone tries to open in http
@pratheekhegde
pratheekhegde / 1_kubernetes_on_macOS.md
Created June 4, 2018 09:49 — forked from kevin-smets/1_kubernetes_on_macOS.md
Local Kubernetes setup on macOS with minikube on VirtualBox and local Docker registry
View 1_kubernetes_on_macOS.md

Requirements

Minikube requires that VT-x/AMD-v virtualization is enabled in BIOS. To check that this is enabled on OSX / macOS run:

sysctl -a | grep machdep.cpu.features | grep VMX

If there's output, you're good!

Prerequisites

View gist:c4af2052b23e2ebe72e7ac4dc627bdaa
server {
server_name s1.website.com;
return 301 https://s2.website.com$request_uri;
}
@pratheekhegde
pratheekhegde / 0.md
Created March 29, 2018 20:09 — forked from maxogden/0.md
JS hoisting by example
View 0.md

JavaScript function hoisting by example

Below are many examples of function hoisting behavior in JavaScript. Ones marked as works successfuly print 'hi!' without errors.

To play around with these examples (recommended) clone them with git and execute them with e.g. node a.js

Notes on hoisting

(I may be using incorrect terms below, please forgive me)

@pratheekhegde
pratheekhegde / BreadCrumb.vue
Last active February 19, 2018 16:54
Vue BreadCrumb component
View BreadCrumb.vue
<template>
<div>
{{ crumbs }} // printing raw json
<br><br>
<div class="container">
<b-breadcrumb :items="crumbs"/>
</div>
</div>
</template>
<script>
@pratheekhegde
pratheekhegde / bread-crumbs-array.js
Created February 17, 2018 08:37
create-breadcrumbs-array
View bread-crumbs-array.js
let breadcrumbs = pathArray.reduce((breadcrumbArray, path, idx) => {
breadcrumbArray.push({
path: path,
to: breadcrumbArray[idx - 1]
? "/" + breadcrumbArray[idx - 1].path + "/" + path
: "/" + path,
text: this.$route.matched[idx].meta.breadCrumb || path,
});
return breadcrumbArray;
}, [])