Skip to content

Instantly share code, notes, and snippets.

@sairamkrish
sairamkrish / github_action_access_external_private_repo.yaml
Created August 11, 2023 12:39
Github action to run pytest that depends on another private repository
name: UnitTest
on:
workflow_dispatch:
push:
jobs:
unittest:
name: Unit Test
env:
# gather requirements
FROM python:3.9.2-slim as requirements-stage
WORKDIR /tmp
COPY ./pyproject.toml ./poetry.lock /tmp/
RUN apt-get update && \
apt-get install -y git && \
pip install poetry && \
poetry export -f requirements.txt --output requirements.txt --without-hashes
# Final stage
@sairamkrish
sairamkrish / spark-application-rbac.yaml
Created June 9, 2022 14:04
Spark application deployment file
#
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
@sairamkrish
sairamkrish / json_encode_benefit.tf
Created February 18, 2022 20:33
terraform demo benefit of jsonencode
# Not good
resource "aws_iam_policy" "secrets_policy" {
name = "some_name"
policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Action": "secretsmanager:GetSecretValue",
"Effect": "Allow". # syntax error - dot instead of comma
@sairamkrish
sairamkrish / for_each_usage_example.tf
Created February 18, 2022 20:23
terraform for_each reference example
resource "aws_iam_policy" "my_node_policy" {
name = format("node_policy_%s", var.environment)
policy = jsonencode({
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ec2:CreateNetworkInterface",
"ec2:DeleteNetworkInterface",
docker-compose run --rm terraform init
docker-compose run --rm terraform fmt
docker-compose run --rm terraform validate
docker-compose run --rm terraform plan
docker-compose run --rm terraform apply
# useful terraform sub commands
terraform state list
terraform state show <resource>
terraform output #shows last output
@sairamkrish
sairamkrish / docker-compose.yaml
Created February 18, 2022 19:26
docker compose for Terraform
version: "3.9"
services:
terraform:
# stdin_open: true
# tty: true
image: hashicorp/terraform:1.1.5
volumes:
- .:/infra
working_dir: /infra
-- Need to manually run each query now.
CREATE SCHEMA IF NOT EXISTS hive.iris
WITH (location = 's3a://iris/');
-- Path s3a://iris/iris_data is the holding directory. We dont give full file path. Only parent directory
CREATE TABLE IF NOT EXISTS hive.iris.iris_data (
sepal_length DOUBLE,
sepal_width DOUBLE,
petal_length DOUBLE,
@sairamkrish
sairamkrish / metastore-site.xml
Created December 29, 2021 23:58
Hive metastore demo configuration
<configuration>
<property>
<name>metastore.thrift.uris</name>
<value>thrift://hive-metastore:9083</value>
<description>Thrift URI for the remote metastore. Used by metastore client to connect to remote metastore.</description>
</property>
<property>
<name>metastore.task.threads.always</name>
<value>org.apache.hadoop.hive.metastore.events.EventCleanerTask,org.apache.hadoop.hive.metastore.MaterializationsCacheCleanerTask</value>
</property>
@sairamkrish
sairamkrish / docker-compose.yaml
Created December 29, 2021 23:49
Trino-Superset demo
version: "3.9"
services:
mariadb:
hostname: mariadb
image: mariadb:10.7.1
container_name: mariadb
ports:
- 3306:3306
volumes:
- ./mariadb-data:/var/lib/mysql