Skip to content

Instantly share code, notes, and snippets.

View mbierman's full-sized avatar

Michael Bierman mbierman

View GitHub Profile
@mbierman
mbierman / cleanupHomeboy.gs
Created August 20, 2018 17:24
Google App script to remove files created more than 90 days from multiple directories
function DeleteOldFiles() {
var Folders = new Array(
'insert dir ID', //Entry
'insert dir ID', //Garage
'insert dir ID' //Kitchen
);
var Files;
Logger.clear();
@mbierman
mbierman / Arris.sh
Last active January 8, 2019 19:22
Reboot Arris modem
#!/usr/bin/env bash
# Configure/Initialize
# Configure/Initialize
# read sensitive data from local files. Example:
# KEY=value
BASEDIR=$(dirname "$0")
APIKEY="$(cat $BASEDIR/arrisdata.txt | grep API | cut -f2 -d "=" )"
USER="$(cat $BASEDIR/arrisdata.txt | grep USER | cut -f2 -d "=" )"
PASS="$(cat $BASEDIR/arrisdata.txt | grep PASS | cut -f2 -d "=" )"
@mbierman
mbierman / update row.js
Last active July 3, 2019 17:36
Google AppScript to automatically copy formulas to the last row of columns D:I of a Google Spreadsheet if an edit is made on a particular sheet
function onEdit(e) {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sName = ss.getSheetName();
var target = 'Data'
Logger.log('Starting script...');
if (sName == target){
Logger.log('The sheet name: "' + target +'" was edited.');
var destSheet = ss.getSheetByName(target);
@mbierman
mbierman / imagerename.sh
Last active July 30, 2019 22:46
renames image files using exif creation
#!/bin/sh
# echo "RSS feed?"
# read FeedName
domain="https://ramahnorcal.smugmug.com"
if [ "$1" = "1" ]; then
path="/hack/feed.mg?Type=gallery&Data=194176300_3dMVQd&format=rss200"
foldername="Day 1"
elif [ "$1" = "2" ]; then
@mbierman
mbierman / updateDate.js
Last active September 6, 2019 22:52
Update Google Sheet column based on other cells in same row.
function onEdit(e) {
var range = e.range;
var ss = SpreadsheetApp.getActiveSpreadsheet();
var target = "Data";
var sheet = ss.getSheetByName(target);
var datestamp = Utilities.formatDate(new Date(), "PST", "dd/MM/yyyy hh:mm:ss a");
// SpreadsheetApp.getUi().alert("Edited in A1 Notation is: " + range.getA1Notation() + "\nDatestamp: " + datestamp ); //If you're having problems, uncomment this to make sure your named range is properly defined
@mbierman
mbierman / overdueCheck.js
Last active September 6, 2019 23:25
email based on past date
function overdueCheck() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheetByName("Data");
// var values = sheet.getRange("J2:J").getValues();
var values = sheet.getRangeByName("FollowUp").getValues();
var today = new Date();
var todays = today.getTime();
var TO = "[email protected]";
var URL = "https://docs.google.com/spreadsheets/d/1hMZnkvsVE1B_9X37V-WH6o7dYmX_BoHxwP2YCY8DOWE/edit#gid=0";
@mbierman
mbierman / Archive.js
Last active September 6, 2019 23:26
Archive a row in a spreadsheet
function myArchive(){
Logger.log("Archieving...");
// moves a row from a sheet to another when a magic value is entered in a column
// adjust the following variables to fit your needs
// see https://productforums.google.com/d/topic/docs/ehoCZjFPBao/discussion
var target = 'Data';
@mbierman
mbierman / updatenoip.sh
Created April 7, 2020 01:47
Update no IP address
#!/bin/bash
###############################################################
## ChangeIP.com bash update script
###############################################################
## Written 3/18/09 by Tom Rinker, released to the Public Domain
## Re-write 09/15/2017 by Michael Bierman
## I replaced wget with curl so it can work on all macs.
## This works with no-ip.com
###############################################################
@mbierman
mbierman / brewme.sh
Last active September 10, 2020 18:40
#!/usr/bin/env bash
echo -e $(date) - "Start" >> /tmp/local.brew.out
echo "updating brew..."
brew update
echo "outdated brew..."
brew outdated
echo "upgrading brew..."
brew upgrade --cask
echo "cleaning up brew..."
@mbierman
mbierman / neurio.sh
Last active May 20, 2020 20:44
Get your current power usage from your Neurio/PWRview monitor
#!/usr/bin/env bash
BASEDIR=$(dirname "$0")
APIKEY="$(cat $BASEDIR/neuriodata.txt | grep API | cut -f2 -d "=" )"
POWER=$(curl -s -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Basic $APIKEY=" -H 'Pragma: no-cache' http://neurio.lan/current-sample | jq '.channels[1].p_W')
echo -e "Your home is currently using: $POWER w \n\n"