Skip to content

Instantly share code, notes, and snippets.

Hendrix Roa hendrixroa

Block or report user

Report or block hendrixroa

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@hendrixroa
hendrixroa / README.md
Created Apr 18, 2019 — forked from iMilnb/README.md
AWS Terraform configuration: Stream CloudWatch Logs to ElasticSearch
View README.md

Rationale

This snippet is a sample showing how to implement CloudWatch Logs streaming to ElasticSearch using terraform. I wrote this gist because I didn't found a clear, end-to-end example on how to achieve this task. In particular, I understood the resource "aws_lambda_permission" "cloudwatch_allow" part by reading a couple of bug reports plus this stackoverflow post.

The js file is actually the Lambda function automatically created by AWS when creating this pipeline through the web console. I only added a endpoint variable handling so it is configurable from terraform.

@hendrixroa
hendrixroa / jwt-expiration.md
Created Dec 5, 2018 — forked from soulmachine/jwt-expiration.md
How to deal with JWT expiration?
View jwt-expiration.md

First of all, please note that token expiration and revoking are two different things.

  1. Expiration only happens for web apps, not for native mobile apps, because native apps never expire.
  2. Revoking only happens when (1) uses click the logout button on the website or native Apps;(2) users reset their passwords; (3) users revoke their tokens explicitly in the administration panel.

1. How to hadle JWT expiration

A JWT token that never expires is dangerous if the token is stolen then someone can always access the user's data.

Quoted from JWT RFC:

@hendrixroa
hendrixroa / introrx.md
Created Dec 5, 2018 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
View introrx.md
@hendrixroa
hendrixroa / Vagrantfile
Created Aug 17, 2018 — forked from lizrice/Vagrantfile
Vagrant file for setting up a single-node Kubernetes cluster that I can access from my desktop. Read more: https://medium.com/@lizrice/kubernetes-in-vagrant-with-kubeadm-21979ded6c63
View Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# This script to install Kubernetes will get executed after we have provisioned the box
$script = <<-SCRIPT
# Install kubernetes
apt-get update && apt-get install -y apt-transport-https
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
@hendrixroa
hendrixroa / curl.md
Created Aug 15, 2018 — forked from subfuzion/curl.md
curl POST examples
View curl.md

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@hendrixroa
hendrixroa / kube-registry.yaml
Created Aug 11, 2018 — forked from coco98/kube-registry.yaml
Docker registry on minikube
View kube-registry.yaml
apiVersion: v1
kind: ReplicationController
metadata:
name: kube-registry-v0
namespace: kube-system
labels:
k8s-app: kube-registry
version: v0
spec:
replicas: 1
@hendrixroa
hendrixroa / delete_all_awslogs.sh
Created Aug 3, 2018 — forked from pahud/delete_all_awslogs.sh
delete all aws log groups
View delete_all_awslogs.sh
aws logs describe-log-groups --query 'logGroups[*].logGroupName' --output table | awk '{print $2}' | grep -v ^$ | while read x; do aws logs delete-log-group --log-group-name $x; done
You can’t perform that action at this time.