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
@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
*/
#!/bin/bash
WORKSPACE="${WORKSPACE:-@main/main}"
echo "Finding dependencies to watch under $WORKSPACE..."
watchedDependencies=$(yarn info "$WORKSPACE" --all --recursive --dependents --json | jq ".children.Dependencies[].locator, .value" | grep '@workspace' | sed 's/.*@workspace://' | sed 's/"$//' | xargs echo)
echo "Dependencies being watched: $watchedDependencies"
echo ""
echo "Finding dependencies that changed..."
// external
import * as aws from '@pulumi/aws';
import * as pulumi from '@pulumi/pulumi';
const awsAccountId = aws.getCallerIdentity().then(({ accountId }) => accountId);
const accountArn = pulumi.interpolate`arn:aws:iam::${awsAccountId}:root`;
const kmsPolicy = accountArn.apply(
(arn) =>
({
Version: '2012-10-17',
@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', () => {
@dmattia
dmattia / trading_bot.py
Last active October 25, 2021 04:30
Trading bot
print("Buy Bitcoin")
@dmattia
dmattia / terragrunt_light.js
Last active March 19, 2024 16:35
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.
*/
"""
Prereq: pip install --user pandas xlrd
Usage:
1) Create accounts.xlsx file
2) Run 'python accounts.py'
"""
import pandas as pd
import json
import { mount } from "@vue/test-utils";
const parentComponent = {
provide() {
return {
val: 'from parent'
};
},
template: `
<div>
@dmattia
dmattia / App.vue
Created June 4, 2019 06:43
Vue Firebase Demo
<template>
<div id="app">
<input v-model="path" type="text" />
<FireProvider :config="firebaseConfig">
<FireQuery :path="path" :shouldListen="false">
<template v-slot:error="{ errorMsg }">
Error: {{ errorMsg }}
</template>
@dmattia
dmattia / fb_auth.py
Created October 1, 2016 17:14
authenticate via token generator for firebase in python
import json
from firebase_token_generator import create_token
from firebase import Firebase
base_url = "https://sengo-fb3-prod.firebaseio.com/"
deal_url = base_url + 'deals'
active_deals_url = base_url + 'activeDeals/1/activeDeals'
future_deals_url = base_url + 'activeDeals/1/futureDeals'
inactive_deals_url = base_url + 'inactiveDeals/1/inactiveDeals'