Skip to content

Instantly share code, notes, and snippets.

View stevenvachon's full-sized avatar

Steven Vachon stevenvachon

View GitHub Profile
@stevenvachon
stevenvachon / index.mjs
Created May 9, 2025 18:37
Google API OAuth in a CLI tool
import { confirm } from '@inquirer/prompts';
import { createServer } from 'node:https';
import { google } from 'googleapis';
import open from 'open';
import { readFile, unlink as removeFile } from 'node:fs/promises';
import spawn from 'nano-spawn';
// Google API OAuth
const CLIENT_ID =
'129949395122-ht30bnmmmor0qenascegaa4vmgu09hgr.apps.googleusercontent.com';
@stevenvachon
stevenvachon / Toggle Dark Mode.applescript
Created May 20, 2020 21:32
Toggle between Terminal.app themes as macOS dark mode is changed
# I put this within an *.app file via Automator and added it to my user's "Login Items"
# It sets the theme every 5 minutes
repeat
tell application "System Events"
if dark mode of appearance preferences is true then
set terminalTheme to "custom_dark"
else
set terminalTheme to "custom_light"
end if
@stevenvachon
stevenvachon / README.md
Last active September 17, 2022 14:54
Apple Music/iTunes library audit

music-library-audit

Find file location errors within an Apple Music/iTunes library file.

This provides some insight into the "some of the songs were not imported because they could not be found" error.

Note: Only files referenced with file:// are supported. Any others will be reported as not found.

Installation

Node.js >= 12 is required. Type this at the command line:

@stevenvachon
stevenvachon / async-await.js
Last active June 4, 2019 22:45
Compare these
try {
const resumes = await this.getResumes();
if (resumes.length > 0) {
this.setState({
resume: await this.getResume(resumes[0])
});
}
} catch(error) {
console.error(error);
@stevenvachon
stevenvachon / promises.js
Last active October 16, 2015 00:04
easy way to understand javascript promises
"use strict";
var p1 = new Promise( function(resolve) {
resolve();
});
var p2 = new Promise( function(resolve) {
resolve();
});