Skip to content

Instantly share code, notes, and snippets.

Avatar
☁️
Catfood Earth 4 released with all images remastered to 4K

Robert Ellison abfo

☁️
Catfood Earth 4 released with all images remastered to 4K
View GitHub Profile
View style-transfer-for-timelapse.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@abfo
abfo / Code.gs
Created Jan 22, 2019
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.
View Code.gs
// 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 / clouds.cs
Created Jul 31, 2020
Code snippet showing how to create an equirectangular cloud image from University of Wisconsin-Madison Space Science and Engineering Center web mercator tiles, see https://ithoughthecamewithyou.com/post/improving-the-accuracy-of-the-new-catfood-earth-clouds-layer for more information
View clouds.cs
string cloudsDownloadPath = HostingEnvironment.MapPath(CloudsDownloadName);
string cloudsTransformedPath = HostingEnvironment.MapPath(CloudsTransformedName);
string cloudsWarpedPath = HostingEnvironment.MapPath(CloudsWarpedName);
string cloudsFinalPath = HostingEnvironment.MapPath(AxdCloudsHandler.CloudsPath);
string gdalFolder = HostingEnvironment.MapPath(GdalFolder);
string gdalTranslatePath = HostingEnvironment.MapPath(GdalTranslate);
string gdalWarpPath = HostingEnvironment.MapPath(GdalWarp);
// download the most recent tiles
using (Bitmap cloudImage = new Bitmap(CloudsTileDimension * CloudsTileCount, CloudsTileDimension * CloudsTileCount, PixelFormat.Format32bppArgb))
View PageSpeed.gs
var pageSpeedApiKey = '';
var pageSpeedMonitorUrl = '';
function monitor() {
var desktop = callPageSpeed('desktop');
var mobile = callPageSpeed('mobile');
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
var sheet = spreadsheet.getSheetByName('results');
sheet.appendRow([
Utilities.formatDate(new Date(), 'GMT', 'yyyy-MM-dd'),
View main.cs
Thread.Sleep(10000); // look like you're doing something
Console.WriteLine("No! Use Google Docs instead."); // reject proposal
@abfo
abfo / Code.gs
Last active Apr 10, 2020
Pull Azure Metrics into a Google Sheet (for i.e. Data Studio monitoring). For instructions see https://ithoughthecamewithyou.com/post/using-the-azure-monitor-rest-api-from-google-apps-script
View Code.gs
// script settings
var ClientID = '';
var TennantID = '';
var ClientSecret = '';
var ResourceID = '';
var AuthBaseUrl = 'https://login.microsoftonline.com/' + TennantID + '/oauth2/v2.0/authorize';
var AuthTokenUrl = 'https://login.microsoftonline.com/' + TennantID + '/oauth2/v2.0/token';
var AuthScope = 'https://management.azure.com/user_impersonation offline_access';
@abfo
abfo / Code.gs
Last active Jan 7, 2020
Apps script to add photos from Google Photos to Google Drive automatically, see https://ithoughthecamewithyou.com/post/how-to-backup-google-photos-to-google-drive-automatically-after-july-2019-with-apps-script for instructions.
View Code.gs
// script settings
var ClientID = '';
var ClientSecret = '';
var BackupFolder = 'Google Photos';
var MaxLength = 50000000;
var AlertEmail = ''
function onOpen() {
var ui = SpreadsheetApp.getUi();
ui.createMenu('Google Photos Backup')
View Code.gs
// script settings
//
// https://ithoughthecamewithyou.com/post/how-to-backup-google-photos-to-google-drive-automatically-after-july-2019-with-apps-script
//
var ClientID = '';
var ClientSecret = '';
var BackupFolder = 'Google Photos';
function onOpen() {
var ui = SpreadsheetApp.getUi();
View Blend.cs
private static void SimpleBlend(string image1path, string image2path, byte alpha)
{
using (Bitmap image1 = (Bitmap)Bitmap.FromFile(image1path))
{
using (Bitmap image2 = (Bitmap)Bitmap.FromFile(image2path))
{
// update the alpha for each pixel of image 2
for (int x = 0; x < image2.Width; x++)
{
for (int y = 0; y < image2.Height; y++)
You can’t perform that action at this time.