Skip to content

Instantly share code, notes, and snippets.

View dmattia's full-sized avatar

David Mattia dmattia

  • Transcend.io
  • United States
View GitHub Profile
@tafkam
tafkam / terragrunt_light.js
Last active November 9, 2021 22:55 — forked from dmattia/terragrunt_light.js
A less verbose terragrunt
/**
* Wrapper around terragrunt to display output succinctly on Atlantis.
*
* Terragrunt is notoriously verbose, which can cause Atlantis to output
* hundreds of comments on single PRs, which can be annoying.
*
* This script will output just the final plan for resources to update on
* successful terragrunt runs, but will output all terragrunt output on
* errors.
*/
@dmattia
dmattia / mostPerfectPassingGames.ts
Created November 7, 2021 18:58
Qbs with the most 100% completion percentage games in a season
import got from 'got';
import { mapSeries } from 'bluebird';
/**
* Finds all players who had 100% completion percentages during a given week of a given year.
*
* @param year - The year the games were played
* @param week - The week of the regular season a game was played
* @returns a list of names
*/
@dmattia
dmattia / pettutor.ts
Last active September 23, 2021 19:40
PetTutor Feed dispense
// external
import noble from '@abandonware/noble';
noble.on('stateChange', async (state) => {
if (state === 'poweredOn') {
await noble.startScanningAsync();
}
});
noble.on('scanStart', () => {
@pahud
pahud / bootstrap.sh
Last active April 8, 2024 14:00
AWS SSO + Codespaces
#!/bin/bash
# video demo - https://www.youtube.com/watch?v=Y8TyE_DNds8
mkdir ~/.tmp && cd $_
# install aws-cli v2
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && \
unzip awscliv2.zip && \
sudo ./aws/install
@sportebois
sportebois / ecr-add-tag.sh
Created March 29, 2018 18:55
Add tag to a docker image in ECR via AWS CLI
#!/usr/bin/env bash
function ecr-add-tag() {
if (( $# < 3 )); then
echo "Wrong number of arguments. Usage: ecr-add-tag ECR_REPO_NAME TAG_TO_FIND TAG_TO_ADD [AWS_PROFILE]"
return
fi
local repo_name=$1
local existing_tag=$2
local new_tag=$3
@shortjared
shortjared / list.txt
Last active April 28, 2024 07:20
List of AWS Service Principals
a4b.amazonaws.com
access-analyzer.amazonaws.com
account.amazonaws.com
acm-pca.amazonaws.com
acm.amazonaws.com
airflow-env.amazonaws.com
airflow.amazonaws.com
alexa-appkit.amazon.com
alexa-connectedhome.amazon.com
amazonmq.amazonaws.com
@remojansen
remojansen / class_decorator.ts
Last active September 14, 2023 14:54
TypeScript Decorators Examples
function logClass(target: any) {
// save a reference to the original constructor
var original = target;
// a utility function to generate instances of a class
function construct(constructor, args) {
var c : any = function () {
return constructor.apply(this, args);
}
@davideast
davideast / MyViewController.swift
Last active December 27, 2017 05:19
Using Firebase references in a UIViewController
import UIKit
class MyViewController: UIViewController {
// Store ref and handle as implicitly unwrapped optionals
var ref: Firebase!
var handle: UInt!
override func viewDidLoad() {
super.viewDidLoad()
@tfrank64
tfrank64 / AppDelegate.swift
Created June 8, 2014 17:32
Swift UITabBar Programmatically
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool {
// Override point for customization after application launch.
self.window = UIWindow(frame: UIScreen.mainScreen().bounds)
var nav1 = UINavigationController()
var first = FirstViewController(nibName: nil, bundle: nil)
nav1.viewControllers = [first]
var second = SecondViewController(nibName: nil, bundle: nil)
var nav2 = UINavigationController()