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 / bestplan.ipynb
Last active September 22, 2024 21:29
Python to simulate different PG&E rate plans with an electric vehicle. Why? See https://ithoughthecamewithyou.com/post/which-pge-rate-plan-works-best-for-ev-charging
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@abfo
abfo / CORSRule.xml
Created August 11, 2024 23:03
How to enable compression in CloudFront for S3 hosted content. Details at https://ithoughthecamewithyou.com/post/enable-gzip-compression-for-amazon-s3-hosted-website-in-cloudfront
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<MaxAgeSeconds>3000</MaxAgeSeconds>
<AllowedHeader>Authorization</AllowedHeader>
<AllowedHeader>Content-Length</AllowedHeader>
</CORSRule>
</CORSConfiguration>
@abfo
abfo / great-highway.ipynb
Last active July 21, 2024 00:20
Analysis of traffic accidents and the closure of the Great Highway in San Francisco. See https://ithoughthecamewithyou.com/post/does-closing-the-great-highway-cause-an-increase-in-traffic-accidents for details.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@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 / 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');