Skip to content

Instantly share code, notes, and snippets.

View 20k-ultra's full-sized avatar

M. Casqueira 20k-ultra

View GitHub Profile
/*====
Cloudwatch Log Group
======*/
resource "aws_cloudwatch_log_group" "qriket" {
name = "qriket"
tags {
Environment = "${var.environment}"
Application = "Qriket API"
}
resource "aws_security_group" "ecs_service" {
vpc_id = "${var.vpc_id}"
name_prefix = "${var.environment}-ecs-service-sg"
description = "Allow egress from container"
egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
data "template_file" "web_task" {
template = "${file("${path.module}/tasks/web_task_definition.json")}"
vars {
image = "${aws_ecr_repository.qriket_app.repository_url}"
secret_key_base = "${var.secret_key_base}"
database_host = "${var.database_endpoint}"
database_user = "${var.database_username}"
database_pass = "${var.database_password}"
database_name = "${var.database_name}"
resource "aws_alb" "alb_qriket" {
name = "${var.environment}-alb-qriket"
subnets = ["${var.public_subnet_ids}"]
security_groups = ["${var.security_groups_ids}", "${aws_security_group.web_inbound_sg.id}"]
tags {
Name = "${var.environment}-alb-qriket"
Environment = "${var.environment}"
}
}
@20k-ultra
20k-ultra / theme.js
Last active December 10, 2019 03:53
Standard functions for getting/setting themes
function rememberTheme (theme) {
// Persist in sessionStorage so theme is applied
// across pages with file:/// apply remembered theme
sessionStorage.setItem('mdbook-theme', theme)
// Persist to localStorage for normal usage as well
localStorage.setItem('mdbook-theme', theme)
}
function getTheme () {
var theme
class Node {
constructor(val) {
this.data = val;
this.left = null;
this.right = null;
}
getChildren() {
let children = []
if (this.left) {
let nodes = [] // list of nodes
const ROOT //binary tree with getChildren function implemented
getNodes(ROOT.getChildren()) // start recursion with no level_index so default is used
function getNodes(level, level_index = 0) {
level.forEach(node => { // loop threw nodes in the level
if (Array.isArray(nodes[level_index])) {
nodes[level_index].push(node) // if node already in this level then add
@20k-ultra
20k-ultra / depth_first_search.js
Last active February 29, 2020 03:53
Depth First search algorithm in JS
class Node {
constructor(val) {
this.data = val;
this.left = null;
this.right = null;
}
getChildren() {
let children = []
@20k-ultra
20k-ultra / SETUP.md
Created March 22, 2023 15:21
My notes on setting up a new mbp

Dotfiles Darwin

  1. Setup hostname a. set dock and menu to autohide b. removed all items from dock
  2. create new ssh keys
  3. Download homebrew
  4. brew install:
    • git
  • wezterm
@20k-ultra
20k-ultra / main.tf
Created December 12, 2018 03:26
AWS ALB forwarding HTTP (443) to HTTP (80)
resource "aws_alb" "api_alb" {
name = "${var.environment}-alb"
subnets = ["${var.public_subnet_ids}"]
security_groups = ["${var.security_groups_ids}", "${aws_security_group.web_inbound_sg.id}"]
tags {
Name = "${var.environment}-alb"
Environment = "${var.environment}"
}
}