Skip to content

Instantly share code, notes, and snippets.

View davehowell's full-sized avatar
🏠
Working from home - just like you

David Howell davehowell

🏠
Working from home - just like you
View GitHub Profile
@davehowell
davehowell / merge-schemas.scala
Created October 19, 2021 10:38 — forked from eduardorost/merge-schemas.scala
Merge Schema with structs
import org.apache.spark.SparkConf
import org.apache.spark.sql.SparkSession
import org.apache.spark.sql.types._
import org.slf4j.{Logger, LoggerFactory}
object Main {
val logger: Logger = LoggerFactory.getLogger(this.getClass)
private lazy val sparkConf: SparkConf = new SparkConf()
.setMaster("local[*]")
@davehowell
davehowell / aws-sts-functions.sh
Created February 9, 2021 15:05 — forked from strebitz/aws-sts-functions.sh
Obtain AWS STS session-tokens with BASH for multiple awscli profiles or an IAM role ARN
#!/bin/bash
# Add these functions to your bash_profile or bash_rc
# Dependencies:
# - awscli - AWS command line client
# - jq - Command-line JSON processor
function cfn-validate-template() {
for template in $@
do
@davehowell
davehowell / jsonlines_gzip_bytesio_bytestream_serialize_serialise.py
Last active November 28, 2018 11:30 — forked from veselosky/s3gzip.py
How to store and retrieve gzip-compressed objects in AWS S3
# Totally ~plagiarised~ inspired from the forked file by Vince Veselosky in this gist, extended to work with jsonlines format
# and skipping the S3 write so the serialisation can be tested without mocking S3
import re
import io
import json
import gzip
import dateutil.parser
from json import JSONEncoder
from pprint import pprint
@davehowell
davehowell / postgres-cheatsheet.md
Created November 15, 2018 01:17 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)