Skip to content

Instantly share code, notes, and snippets.

View ConnorGriffin's full-sized avatar

Connor Griffin ConnorGriffin

View GitHub Profile
@ConnorGriffin
ConnorGriffin / ynabReport-CategoryGroupSummary.gs
Last active September 25, 2018 00:24
YNAB Weekly Spending Report - Google Script (Standalone) - Using Totals from Category Groups
// YNAB Weekly Spending Report sending script
function sendYnabReport() {
// Set our options
var accessToken = 'token goes here' // Your YNAB Personal Access Token
var budgetName = "Connor's Budget" // Budget name to use, in case you have multiple budgets
var categories = ['Sports & Wellness', 'Food & Drink', 'Housing'] // Your desired category groups to monitor, in Javascript array syntax
var recipient = 'test@example.com, test2@example.com' // Email recipients, comma separated
// API stuff
var url = 'https://api.youneedabudget.com/v1'
@ConnorGriffin
ConnorGriffin / ynabReport.gs
Last active October 22, 2019 14:24
YNAB Weekly Spending Report - Google Script (Standalone)
// YNAB Weekly Spending Report sending script
function sendYnabReport() {
// Set our options
var accessToken = 'token goes here' // Your YNAB Personal Access Token
var budgetName = "Connor's Budget" // Budget name to use, in case you have multiple budgets
var categories = ['Fast Food', 'Groceries'] // Your desired category names to monitor, in Javascript array syntax
var recipient = 'test@example.com, test2@example.com' // Email recipients, comma separated
var url = 'https://api.youneedabudget.com/v1'
var headers = {
@ConnorGriffin
ConnorGriffin / Get-SrpUsage.ps1
Last active December 4, 2019 20:44
Get SRP (Salt River Project) power usage per hour using PowerShell
# Set the SRP base url and get yesterday's date in a format that the report expects
$baseUrl = 'https://myaccount.srpnet.com'
$yesterday = (Get-Date).AddDays(-1).ToString('M/d/yyyy')
# Start a session, pull the form data
$r = Invoke-WebRequest $baseUrl -SessionVariable session
# Identify the username/password form
$loginForm = $r.Forms.Where{$_.Fields.Keys -contains 'UserName'}
@ConnorGriffin
ConnorGriffin / GDrive.Download.ps1
Created September 4, 2018 05:37
Download files from Google Drive, converting to specific MIME types if necessary
# Set the Google Auth parameters. Fill in your RefreshToken, ClientID, and ClientSecret
$params = @{
Uri = 'https://accounts.google.com/o/oauth2/token'
Body = @(
"refresh_token=$RefreshToken", # Replace $RefreshToken with your refresh token
"client_id=$ClientID", # Replace $ClientID with your client ID
"client_secret=$ClientSecret", # Replace $ClientSecret with your client secret
"grant_type=refresh_token"
) -join '&'
Method = 'Post'
@ConnorGriffin
ConnorGriffin / GDrive.Upload.ps1
Last active February 9, 2024 22:10
GDrive Upload PowerShell Script
# Set the Google Auth parameters. Fill in your RefreshToken, ClientID, and ClientSecret
$params = @{
Uri = 'https://accounts.google.com/o/oauth2/token'
Body = @(
"refresh_token=$RefreshToken", # Replace $RefreshToken with your refresh token
"client_id=$ClientID", # Replace $ClientID with your client ID
"client_secret=$ClientSecret", # Replace $ClientSecret with your client secret
"grant_type=refresh_token"
) -join '&'
Method = 'Post'