Skip to content

Instantly share code, notes, and snippets.

@atalv
atalv / assignEditUrls.gs
Last active April 12, 2020 07:59
Google Apps Script code to add Google Form edit response links in the linked Google Sheet. It will also append the form edit links for newly added responses - instead of generating links for all the responses each time.
function assignEditUrls() {
// Function to add edit form link for each response recorded in sheets. Will append for new responses.
var formUrl = SpreadsheetApp.getActiveSpreadsheet().getFormUrl();
var form = FormApp.openByUrl(formUrl);
// Provide the sheet name where Google Form responses are being recorded
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Form Responses 1');
var data = sheet.getDataRange().getValues();
// Identifying existing edit form url column - 'editFormURL' - if exists then add edit links this column, else add a new column
// Assuming first row contains headers
var findCol = sheet.getRange(1, 1, 1, sheet.getLastColumn()).createTextFinder('editFormURL').matchEntireCell(true).findNext();
@atalv
atalv / setup.py
Created April 19, 2020 18:55
Sample setup.py configuration for creating a Python Wheel/Egg
from setuptools import setup, find_packages
setup(
#this will be the package name you will see, e.g. the output of 'conda list' in anaconda prompt
name = '<some name of the distribution>',
#some version number you may wish to add - increment this after every update
version='1.0',
# Use one of the below approach to define package and/or module names:
@atalv
atalv / logger_utils.R
Created May 30, 2022 11:51
Sample scripts that demonstrate how to submit logging data to the Azure Monitor HTTP Data Collector API from R.
require(caTools)
require(digest)
require(httr)
require(jsonlite)
#' Build API signature for logging to Azure log analytics
#'
#' Azure log analytics HTTP REST API documentation for Python is followed to
#' create the R version of it. Python version of this function is described
#' at \url{https://docs.microsoft.com/en-us/azure/azure-monitor/logs/data-collector-api#python-3-sample}
@atalv
atalv / logger_functions.R
Last active September 23, 2022 14:26
Logging related functions using R package 'logger', and some reference utility functions being used from the logger_utils.R gist (https://gist.github.com/atalv/f98b928c870630c677694b5edac072dc)
require(logger)
require(utils)
#' Logging related functions
#'
#' Logger function defined which are created on top of
#' \code{\link[logger]{log_level}} -
#' which is part of another package \code{logger}. Additional
#' capabilities have been added to those functions which enables this function
#' to be able to send logs directly to the Azure log analytics workspace, and