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
@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 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';
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();
@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 adapter.scad
difference() {
metric_thread(72, 0.75 ,10);
metric_thread(58, 0.75 ,10, internal=true);
}
@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')
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 Distance for Yesterday', 'getDistance')
.addToUi();
View GoogleFitWeightSample.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 Weight for Yesterday', 'getWeight')
.addToUi();
View GmailSmtp.cs
// Gmail Address from where you send the mail
var fromAddress = "username@gmail.com";
// any address where the email will be sending
var toAddress = YourEmail.Text.ToString();
//Password of your gmail address
const string fromPassword = "pass";
// Passing the values and make a email formate to display
string subject = YourSubject.Text.ToString();
string body = "From: " + YourName.Text + "\n";
body += "Email: " + YourEmail.Text + "\n";
You can’t perform that action at this time.