Skip to content

Instantly share code, notes, and snippets.

View hendrixroa's full-sized avatar
🏠
Working from home

Hendrix Roa hendrixroa

🏠
Working from home
View GitHub Profile
@hendrixroa
hendrixroa / README.md
Created April 18, 2019 05:49 — forked from iMilnb/README.md
AWS Terraform configuration: Stream CloudWatch Logs to ElasticSearch

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 December 5, 2018 00:29 — forked from soulmachine/jwt-expiration.md
How to deal with JWT expiration?

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 December 5, 2018 00:29 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@hendrixroa
hendrixroa / Vagrantfile
Created August 17, 2018 02:51 — 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
# -*- 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 August 15, 2018 20:21 — forked from subfuzion/curl.md
curl POST examples

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 August 11, 2018 21:40 — forked from coco98/kube-registry.yaml
Docker registry on minikube
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 August 3, 2018 04:45 — forked from pahud/delete_all_awslogs.sh.md
delete all aws log groups
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