This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| git branch -m master main && \ | |
| git fetch origin && \ | |
| git branch -u origin/main main && \ | |
| git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/main |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: "Terraform" | |
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| jobs: | |
| terraform: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| #set -x | |
| partitions_between() { | |
| local from=$1 | |
| local to=$2 | |
| local offset_in_seconds=$3 | |
| local fmt=$4 | |
| current=$from |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| aws ec2 describe-regions | \ | |
| jq -r '.Regions[] | .RegionName' | \ | |
| xargs -l aws resourcegroupstaggingapi get-resources --region | \ | |
| jq '.ResourceTagMappingList[] | .ResourceARN' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # get token from https://github.com/settings/tokens (repo and delete_repo permissions) | |
| export TOKEN="" | |
| curl -H "Authorization: token $TOKEN" https://api.github.com/user/repos | \ | |
| jq '.[].full_name' | \ | |
| grep demo | \ | |
| gxargs -I '{}' curl -H "Authorization: token $TOKEN" -X DELETE https://api.github.com/repos/'{}' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Export variables if not set already | |
| export CLOUDKARAFKA_BROKERS="${CLOUDKARAFKA_BROKERS:-ark-01.srvs.cloudkafka.com:9094,ark-02.srvs.cloudkafka.com:9094,ark-03.srvs.cloudkafka.com:9094}" | |
| export CLOUDKARAFKA_USERNAME="${CLOUDKARAFKA_USERNAME:-herecomesyourusername}" | |
| export CLOUDKARAFKA_PASSWORD="${CLOUDKARAFKA_PASSWORD:-herecomesyourpassword}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.io._ | |
| import scala.xml.XML | |
| import ammonite.ops._ | |
| import ammonite.ops.ImplicitWd._ | |
| val tempFile = File.createTempFile("tmp", "tmp") | |
| tempFile.deleteOnExit() | |
| val f = tempFile.getAbsolutePath | |
| val res = %%('mvn, "help:effective-pom", s"-Doutput=${f}") | |
| val xml = XML.loadFile(f) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| trait IHaveLakeName { | |
| def lakeName: String | |
| } | |
| trait IHaveStreamName { | |
| def streamName: String | |
| } | |
| trait IHaveLakeAndStreamName extends IHaveLakeName with IHaveStreamName |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import org.apache.spark.sql.SparkSession | |
| import org.apache.spark.sql.cassandra._ | |
| import com.datastax.spark.connector.cql.CassandraConnectorConf.ConnectionHostParam | |
| import com.datastax.spark.connector.cql.DefaultAuthConfFactory.{PasswordParam, UserNameParam} | |
| val spark = { | |
| SparkSession | |
| .builder() | |
| .master("local[*]") | |
| .appName("test") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import spark.implicits._ | |
| import org.apache.spark.sql.functions._ | |
| val ds = spark.read | |
| .format("kafka") | |
| .option("kafka.bootstrap.servers", bootstrapServers) | |
| .option("subscribe", topic) | |
| .option("startingOffsets", "earliest") | |
| .load() | |
| .orderBy(desc("timestamp")) |