Skip to content

Instantly share code, notes, and snippets.

Avatar

Ivan Kutil codeas

View GitHub Profile
@codeas
codeas / get-filtered-rows-from-sheet.js
Last active Feb 25, 2022
#GoogleSheet #GoogleSheetAPI
View get-filtered-rows-from-sheet.js
/*
Get filtered rows from Google Sheets
@author Ivan Kutil
Preparation: add Advanced service "Sheets" into Google Apps Script project
*/
function getFilteredRows() {
console.time("filtered-rows")
let spreadsheetId = SpreadsheetApp.getActive().getId();
let sheetName = "MySheetName"
View gas-gcp-zones.js
/*
Apps Script code snippet based on GCPping.com
@author Ivan Kutil
*/
var URLS = {
"asia-east1": "http://104.155.201.52/ping",
"asia-east2": "http://35.220.162.209/ping",
"asia-northeast1": "http://104.198.86.148/ping",
"asia-south1": "http://35.200.186.152/ping",
"asia-southeast1": "http://35.185.179.198/ping",
@codeas
codeas / code.gs
Created Jan 22, 2019
Native Android application with Apps Script
View code.gs
function doGet(e) {
return HtmlService.createTemplateFromFile("view").evaluate();
}
View gas-oscar-main.js
var SPREADSHEET_ID = "xxxxx"; // <-- Google Spreadsheet ID
var settings = {
nomadland : "xxxxxx" // <--- subtitles fileId
}
function RUN() {
var movie = "nomadland"
var fileId = settings[movie];
var output = subitlesParser(fileId);
View gas-google-nlp.js
/*
* Get sentiment from Google Cloud Natural Language API
*/
var getSentiment = function(text) {
var apiKey = PropertiesService.getScriptProperties().getProperty("apiKey")
var url = "https://language.googleapis.com/v1/documents:analyzeSentiment?key=%KEY".replace("%KEY", apiKey)
var data = {
document: {
language: "en-us",
@codeas
codeas / subtitlesParser.js
Last active Apr 26, 2021
OSCAR and Google NLP
View subtitlesParser.js
var subitlesParser = function(fileId) {
var agregated = false;
var CHARS = "-->";
var BATCH_SIZE = 2; // time-window (e.g. 2minutes)
var epoch = 0;
var text = [];
var output = [];
var content = DriveApp.getFileById(fileId).getBlob().getDataAsString();
var rows = content.split("\n");
@codeas
codeas / gas2slack_webhook.js
Last active Nov 13, 2018
gas2slack by incoming webhook
View gas2slack_webhook.js
function START() {
var url = "https://hooks.slack.com/services/xxxxxx/xxxxxxx/xxxxxxxxxxxxxxxxxxxxxxxxxx";
var payload = {
"channel" : "#test", // <-- optional parameter, use if you want to override default channel
"username" : "robot", // <-- optional parameter, use if you want to override default "robot" name
"text" : "It's working", // <-- required parameter
"icon_emoji": ":robot_face:", // <-- optional parameter, use if you want to override default icon,
//"icon_url" : "http://image" // <-- optional parameter, use if you want to override default icon