Skip to content

Instantly share code, notes, and snippets.

View schlos's full-sized avatar

Miroslav schlos

View GitHub Profile
@schlos
schlos / Code.gs
Created August 24, 2018 20:38 — forked from mhawksey/Code.gs
Automatically include your latest favorited Tweet in your Gmail signature. More info https://knoll.tech/2017/01/24/automatically-include-your-latest-tweet-in-your-gmail-signature/
// Grabs my latest tweet favorited using the handy TwtrService wrapper by +MartinHawksey - https://goo.gl/2it7yb
function getLatestTweet() {
var data = TwtrService.get("statuses/user_timeline", {screen_name: /*"YourTwitterHandle(without the @)"*/, count: 1});
var id = false;
for (var i = 0; i < data.length; i++){
if (data[i].favorited) {
id = data[i].id_str;
break;
}
}
@schlos
schlos / gist:6eb2c7ec240d109eca126735053dde56
Created August 24, 2018 19:33 — forked from mhawksey/gist:5419876
Google Apps Script to get feed post count and last post date
function fetchFeedItemCount(url,optType) {
var type = optType || "feed";
var output = [];
//var url = "http://confessionsofalearningtechnologist.blogspot.com/feeds/posts/default?alt=rss";
// little switch to get rss2 feed for blogger
if (/\/posts\/default$/.test(url)){
url += "?alt=rss";
}
@schlos
schlos / sheet2atom.gs
Created August 24, 2018 19:24 — forked from aarroyoc/sheet2atom.gs
Google Spreadsheet to RSS ATOM - Google Apps Script
function doGet(e) {
var rss='<?xml version="1.0" encoding="utf-8"?>';
rss+='<feed xmlns="http://www.w3.org/2005/Atom">';
rss+='<title>Frases y citas célebres - NexCono </title>';
rss+='<link href="http://nexcono.appspot.com"/>';
rss+='<author><name>NexCono</name></author>';
rss+='<id></id>';
var app=SpreadsheetApp.openById("1tLSL5BqnTAM6VsgyF355DJJe50r0ZQbfunTXAUFj_nE");
var data=app.getDataRange().getValues();
@schlos
schlos / gist:0d4501981aab2d9f08553c08e3a4fdee
Created February 12, 2018 20:29 — forked from peterherrmann/gist:2836208
Spreadsheet Splitter - Google Apps Script
// Creates new spreadsheets based on a column containing email addresses
// in the starting spreadsheet.
// Each new spreadsheet will contain the full set of rows for that email address.
// It will then be shared with that email address and a link emailed.
var EMAIL_COLUMN = 2; //Use the number: A=1,B=2,Z=26 etc
var ALSO_SHARE_WITH = ""; // Add any additional addresses here. Separated multiples with commas.
var NUM_HEADER_ROWS = 1; // The number of header rows.
// Do not change anything below this line
// 24 Nov 2010 - test mode works correctly after Google changes (session broke after Browser.msgBox)
@schlos
schlos / Code.gs
Last active February 12, 2018 20:26 — forked from oshliaer/.en.md
Google Apps Script
function onEdit() {
// moves a row from any sheet to an archive sheet when a magic value is entered in a column
var columnNumberToWatch = /* column Q */ 3; // column A = 1, B = 2, etc.
var ss = SpreadsheetApp.getActiveSpreadsheet();
var as = SpreadsheetApp.getActiveSheet();
var cell = as.getActiveCell();
var track_val = cell.getValue().toUpperCase(); // If the names of sheets needed exactly skip .toUpperCase()
@schlos
schlos / siteUptimeMonitor.js
Created February 12, 2018 20:15 — forked from lukmdo/siteUptimeMonitor.js
google apps script=js
var ONE_S = 1000,
ONE_M = 60*ONE_S,
ONE_H = 60*ONE_M,
RUN_EVERY = 5*ONE_M,
SLEEP_TIME = 30*ONE_M,
CHECK_URL = 'http://www.SITE.com',
NOTIFY_MAIL = '[email protected]',
NOTIFY_CALENDAR = '[email protected]';
@schlos
schlos / gist:06f8a7d690a1c6762cf529f3e1b4cf16
Last active February 4, 2018 00:16
Simple Google Apps Script to export a single sheet to PDF and email it to a contact list
// Simple function to send Weekly Status Sheets to contacts listed on the "Contacts" sheet in the MPD.
// Load a menu item called "Project Admin" with a submenu item called "Send Status"
// Running this, sends the currently open sheet, as a PDF attachment
function onOpen() {
var submenu = [{name:"Send Status", functionName:"exportSomeSheets"}];
SpreadsheetApp.getActiveSpreadsheet().addMenu('Project Admin', submenu);
}
function exportSomeSheets() {
@schlos
schlos / cloudflare-update-record.sh
Created January 27, 2018 15:05 — forked from benkulbertis/cloudflare-update-record.sh
Cloudflare API v4 Dynamic DNS Update in Bash
#!/bin/bash
# CHANGE THESE
auth_email="[email protected]"
auth_key="c2547eb745079dac9320b638f5e225cf483cc5cfdda41" # found in cloudflare account settings
zone_name="example.com"
record_name="www.example.com"
# MAYBE CHANGE THESE
ip=$(curl -s http://ipv4.icanhazip.com)
@schlos
schlos / Google Spreadsheet GeoCode.js
Created December 10, 2017 21:20 — forked from timwburch/Google Spreadsheet GeoCode.js
Simple Google Script to GeoCode from address in cell
function getGeocodingRegion() {
return PropertiesService.getDocumentProperties().getProperty('GEOCODING_REGION') || 'au';
}
function addressToPosition() {
// Select a cell with an address and two blank spaces after it
var sheet = SpreadsheetApp.getActiveSheet();
var cells = sheet.getActiveRange();
var addressColumn = 1;