Skip to content

Instantly share code, notes, and snippets.

View mbierman's full-sized avatar

Michael Bierman mbierman

View GitHub Profile
my closeNotif()
on closeNotif()
global activeApp
tell application "System Events"
set activeApp to name of first application process whose frontmost is true
-- set theDialogText to "The curent app is " & (activeApp)
-- display dialog theDialogText
@mbierman
mbierman / Find and Replace.scpt
Last active August 11, 2018 16:30
Ever want a 'Find and Replace' for Evernote? Here's an Aplescript for doing that on a Mac
(*
Find and replace based on
Evernote Note Folder
Version 1.02
2018/03/15
SCRIPT INFORMATION
Retrieves the note's Mac folder from the database
@mbierman
mbierman / DirectoryClean.gs
Last active March 19, 2018 16:46
This looks at an arbitrary directory, looks for any folders inside that directory, and recursively looks for files older than 'Days'. I use this to clean out a directory of security camera video.
/*
Version 1.0.1
Updated 03/19/2018
This looks at an arbitrary directory, looks for any folders inside that directory, and recursively looks for files older than 'Days'.
I use this to clean out a directory of security camera video.
To configure, set the folderID and the Days.
Michael Bierman
@mbierman
mbierman / ArrisReboot.js
Last active October 19, 2020 05:09
A puppeteer script to reboot an Arris modem
/*
* @name Reboot Arris modem.
*
* @desc Puppeteer script for rebooting an Arris modem.
* since the specific navigation for your modem will vary, this
* is more of an example and isn't guaranteed to work for your particular
* modem.
* Many thanks to https://stackoverflow.com/users/6870228/keith for his help!
*
*/
@mbierman
mbierman / arris.sh
Last active December 3, 2018 20:21
#!/usr/bin/env bash
# Configure/Initialize
APIKEY="$(cat ~/Documents/Applications/bin/arrisdata.txt | grep API | cut -f2 -d "=" )"
USER="$(cat ~/Documents/Applications/bin/arrisdata.txt | grep USER | cut -f2 -d "=" )"
PASS="$(cat ~/Documents/Applications/bin/arrisdata.txt | grep PASS | cut -f2 -d "=" )"
tries=1
SECONDS=0
run="null"
@mbierman
mbierman / clearnotes.sh
Created May 31, 2018 17:22
Clear Notes
#!/usr/bin/env bash
ERROR=$(automator "$HOME/Library/Services/Notifications.workflow" 3>&1 1>&2 2>&3 | tee /dev/stderr)
if [[ $ERROR = *"Cache location entry for /System/Library/CoreServices/Applications/System"* ]]; then
echo "Fixing cache.."
rm "/Users/bierman/Library/Caches/com.apple.automator.actionCache-bundleLocations.plist"
fi
@mbierman
mbierman / gettemp.sh
Last active August 11, 2022 02:10
Uses osx-cpu (https://github.com/lavoiesl/osx-cpu-temp) to get temp and fanspeed. Using LaunchAgent, run every 5 minutes, log to a file
#!/usr/bin/env bash
MACH=$(hostname -s)
tool="$HOME/Documents/Applications/bin/osx-cpu-temp"
if [ ! -f ${tool} ]; then
echo -e "\n\nSorry, you need to install osx-cup-temp on \"$MACH\" for this to function.\n Check https://github.com/lavoiesl/osx-cpu-temp\n"
exit
fi
@mbierman
mbierman / Import
Created August 2, 2018 23:51
I use this to take CSV data about the temperature and fan speed of my Mac (https://gist.github.com/mbierman/af96ef30445f0359e2d91bb7e2c184ad).
function importData() {
var fSource = DriveApp.getFolderById('1x_iNzrNZDfgWz1MykMiADa_7Yd0kMtln'); // reports_folder_id = id of folder where csv reports are saved
var fi = fSource.getFilesByName('report.csv'); // latest report file
var ss = SpreadsheetApp.openById('1BkLfWzBB9WFmUxkBtM8ID43Y34nO9kC0IpjSZQ5aCBA'); // data_sheet_id = id of spreadsheet that holds the data to be updated with new report data
// Convert CSV > Google Sheet
if ( fi.hasNext() ) { // proceed if "report.csv" file exists in the reports folder
var file = fi.next();
// Logger.log('starting point: ' + file.getName());
Drive.Files.copy({}, file.getId(), {convert: true});
@mbierman
mbierman / Import
Created August 2, 2018 23:51
I use this to take CSV data about the temperature and fan speed of my Mac (https://gist.github.com/mbierman/af96ef30445f0359e2d91bb7e2c184ad).
function importData() {
var fSource = DriveApp.getFolderById('1x_iNzrNZDfgWz1MykMiADa_7Yd0kMtln'); // reports_folder_id = id of folder where csv reports are saved
var fi = fSource.getFilesByName('report.csv'); // latest report file
var ss = SpreadsheetApp.openById('1BkLfWzBB9WFmUxkBtM8ID43Y34nO9kC0IpjSZQ5aCBA'); // data_sheet_id = id of spreadsheet that holds the data to be updated with new report data
// Convert CSV > Google Sheet
if ( fi.hasNext() ) { // proceed if "report.csv" file exists in the reports folder
var file = fi.next();
// Logger.log('starting point: ' + file.getName());
Drive.Files.copy({}, file.getId(), {convert: true});
@mbierman
mbierman / Import CSV to Google Sheet.gs
Last active August 2, 2018 23:54
I use this to take CSV data about the temperature and fan speed of my Mac (https://gist.github.com/mbierman/af96ef30445f0359e2d91bb7e2c184ad). This Google App Script 1. converts CSV to a Google compatible format 2. copies the data 3. Renames the CSV for backup for a while... and then adds the data to the end of a spreadsheet which creates a chart.
function importData() {
var fSource = DriveApp.getFolderById('enter ID Here'); // reports_folder_id = id of folder where csv reports are saved
var fi = fSource.getFilesByName('report.csv'); // latest report file
var ss = SpreadsheetApp.openById('enter ID here'); // data_sheet_id = id of spreadsheet that holds the data to be updated with new report data
// Convert CSV > Google Sheet
if ( fi.hasNext() ) { // proceed if "report.csv" file exists in the reports folder
var file = fi.next();
// Logger.log('starting point: ' + file.getName());
Drive.Files.copy({}, file.getId(), {convert: true});