Skip to content

Instantly share code, notes, and snippets.

View abfo's full-sized avatar
☁️
Working on an LLM experiment called https://shopstories.us/

Robert Ellison abfo

☁️
Working on an LLM experiment called https://shopstories.us/
View GitHub Profile
@abfo
abfo / Code.gs
Created January 22, 2019 00:27
Google fit to google sheets improved sample, handles steps, weight and distance for one or more days at a time. See https://ithoughthecamewithyou.com/post/export-google-fit-daily-steps-to-a-google-sheet for instructions.
// add your Google API Project OAuth client ID and client secret here
var ClientID = '';
var ClientSecret = '';
function onOpen() {
var ui = SpreadsheetApp.getUi();
ui.createMenu('Google Fit')
.addItem('Authorize if needed (does nothing if already authorized)', 'showSidebar')
.addItem('Get Metrics for Yesterday', 'getMetrics')
.addItem('Get Metrics for past 60 days', 'getHistory')
@abfo
abfo / aura-carver-mat-shelf.scad
Last active December 27, 2023 01:13
OpenSCAD code for a wall mount for the Aura Carver Mat digital photo frame. Details at https://ithoughthecamewithyou.com/post/3d-printing-a-discreet-wall-mount-shelf-for-the-aura-carver-mat
difference() {
union() {
cube(size=[61,85,5], center = true);
translate([29.5, 0 ,5]) {
cube(size=[2, 85, 10], center = true);
}
translate([-29.5, 0 ,15]) {
cube(size=[2, 85, 30], center = true);
}
}
@abfo
abfo / kong-holder.scad
Last active June 26, 2023 00:07
SCAD design for a 3D printed Kong XL Holder. See https://ithoughthecamewithyou.com/post/3d-printing-a-kong-xl-holder for details.
difference() {
cube(size=[86,86,70]);
translate([43,43,10]) {
cylinder(h=35, d=60);
translate([0,0,30]){
cylinder(h=35, d=78);
}
}
translate([-2,-2,10]) {
cube(size=[40,40,70]);
// uses Google.Analytics.Data.V1Beta from NuGet
// credentials from Google cloud project authentication export
// GA4 Profile ID from GA4 Admin
var client = new BetaAnalyticsDataClientBuilder
{
CredentialsPath = "PathToCredentials.json"
}.Build();
RunReportRequest request = new RunReportRequest
@abfo
abfo / nest-window-mount.scad
Created April 19, 2023 01:31
OpenSCAD script for a Google Nest Cam Indoor Wired Gen 2 window mount.
difference() {
cube(size=[90, 120, 50]);
translate([45, 50, 0]) {
rotate(a=-25, v=[1,0,0]) {
translate([0, 0, -40]) {
cylinder(h=120, d=66);
}
}
}
}
@abfo
abfo / Code.gs
Created February 13, 2023 01:16
Google Apps Script code to send you an email every time a Google Analytics 4 property has a new referrer. Full instructions at https://ithoughthecamewithyou.com/post/email-alerts-for-new-referers-in-google-analytics-using-apps-script
var PropertyId = '';
var PropertyName = ''
var SendEmailTo = '';
function main() {
var scriptProperties = PropertiesService.getScriptProperties();
var currentProps = scriptProperties.getProperties();
var anythingNew = false;
var newText = '';
@abfo
abfo / Program.cs
Last active February 8, 2023 01:39
Sample code to read an Esri shapefile in .NET using Catfood.Shapefile. For full details please see https://ithoughthecamewithyou.com/post/esri-shapefile-reader-in-net
using Catfood.Shapefile;
using (Shapefile shapefile = new Shapefile(@"fips10c.shp"))
{
Console.WriteLine($"Shapefile type {shapefile.Type}, contains {shapefile.Count:n0} shapes.");
Console.WriteLine($"Bounding box is {shapefile.BoundingBox.Top:n2}, {shapefile.BoundingBox.Left:n2} - {shapefile.BoundingBox.Bottom:n2}, {shapefile.BoundingBox.Right:n2}");
foreach(Shape shape in shapefile)
{
string[] metadataNames = shape.GetMetadataNames();
@abfo
abfo / Code.gs
Last active December 7, 2022 05:22
Apps Script using the Todoist API to set a due date of today on any tasks in the Alexa To-do List and Inbox projects that do not have a due date. For instructions on setting this up see https://ithoughthecamewithyou.com/post/using-the-todoist-api-to-set-a-due-date-on-the-alexa-integration-todo-list-with-apps-script
var ApiToken = '';
function checkForAlexaTasksWithNoDate() {
processProject('Alexa To-do List');
processProject('Inbox');
}
function processProject(projectName) {
var id = getAlexaToDoListId(projectName);
var tasks = getAlexaToDoListTasks(id);
@abfo
abfo / gtag-parameters.js
Last active November 13, 2022 21:17
Send Google Analytics event parameters with every event to more than one tag - see https://ithoughthecamewithyou.com/post/send-event-parameters-with-every-event-and-multiple-tags-in-google-analytics-4
// from https://developers.google.com/analytics/devguides/collection/ga4/event-parameters?client_type=gtag
gtag('set', {
'page_title': 'Travel Destinations',
'currency': 'USD'
});
// Place your config commands after the set command like follows
gtag('config', 'G-XXXXXXXXXX-1');
gtag('config', 'G-XXXXXXXXXX-2');
gtag('config', 'G-XXXXXXXXXX-3');
@abfo
abfo / gtag_user_properties.js
Last active November 12, 2022 20:42
User properties example for gtag.js (user scoped custom dimensions in GA4), see https://ithoughthecamewithyou.com/post/user-scoped-custom-dimensions-in-google-analytics-4-using-gtag
gtag('set', 'user_properties', { 'user_quality': 'low' });