diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e43b0f9 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.DS_Store diff --git a/.nova/Configuration.json b/.nova/Configuration.json new file mode 100644 index 0000000..5bef902 --- /dev/null +++ b/.nova/Configuration.json @@ -0,0 +1,3 @@ +{ + "editor.default_syntax" : "shell" +} diff --git a/Angus/tdarr-bounce b/Angus/tdarr-bounce new file mode 100755 index 0000000..5d7a72c --- /dev/null +++ b/Angus/tdarr-bounce @@ -0,0 +1,4 @@ +#!/bin/bash + +cd "/Usres/shughey" +killall Tdarr_Node; sleep 5;./Tdarr_Node/Tdarr_Node & diff --git a/Angus/tdarr-start b/Angus/tdarr-start new file mode 100755 index 0000000..39e9604 --- /dev/null +++ b/Angus/tdarr-start @@ -0,0 +1,6 @@ +#!/bin/bash + +cd /Users/shughey +killall Tdarr_Node +sleep 3 +./Tdarr_Node/Tdarr_Node & diff --git a/airport b/airport new file mode 100755 index 0000000..308cdf5 Binary files /dev/null and b/airport differ diff --git a/allow_sleep.php b/allow_sleep.php new file mode 100644 index 0000000..a57e47f --- /dev/null +++ b/allow_sleep.php @@ -0,0 +1,111 @@ + (2*3600)) { // two hours + unlink($file); + } + } + if (file_exists($file)) { + $fileage = (time() - filemtime($file)); + if ($fileage > (1.25*3600)) { // half hour + $killout = shell_exec("kill -9 {$thisProc}"); + $ds = date("D M j G:i:s T Y"); + $txt = "Firefox, News or Vivaldi [{$thisProc}] killed at {$ds}\n"; + $fh = fopen($killLog, "a"); + fwrite($fh, $txt); + echo $txt; + fclose($fh); + unlink($file); + } else { + echo "File age: {$fileage}\n"; + } + } else { + $fh = fopen($file, "w"); + fwrite($fh, "{$thisProc}\n"); + fclose($fh); + } + } + } + +?> diff --git a/arc-export/LICENSE b/arc-export/LICENSE new file mode 100644 index 0000000..e6303a7 --- /dev/null +++ b/arc-export/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 Andrey Ivanov + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/arc-export/README.md b/arc-export/README.md new file mode 100644 index 0000000..5b3b8ef --- /dev/null +++ b/arc-export/README.md @@ -0,0 +1,85 @@ +# Arc Pinned Tabs to HTML Bookmarks Converter + +## Overview + +This project provides a script for converting pinned tabs in the **Arc Browser** to standard HTML bookmarks file. These bookmarks can then be imported into any web browser. + +This addresses the lack of a pinned tabs export feature in Arc Browser. + +## Requirements + +- Python 3.x +- Arc Browser installed + +## Installation + +1. Clone the repository: `git clone git@github.com:ivnvxd/arc-export.git` +2. Navigate to the project folder: `cd arc-export` + +or download using `curl`: + +```sh +curl -o main.py https://raw.githubusercontent.com/ivnvxd/arc-export/main/main.py +``` + +## Usage + +Run the `main.py` script from the command line: + +```sh +python3 main.py [-h] [-s] [-o OUTPUT] [-v] [--version] + +# or if there is an error: +python main.py [-h] [-s] [-o OUTPUT] [-v] [--version] +``` + +### Troubleshooting + +If you encounter any problems, manually copy the `StorableSidebar.json` file from the `~/Library/Application Support/Arc/` directory to the project's directory and run the script again. + +## Features +The script supports various command-line options for enhanced functionality: + +- **Show help message and exit** + - `-h`, `--help` + +- **Silence output** + - `-s`, `--silent` + +- **Specify the output file path** + - `-o OUTPUT`, `--output OUTPUT` + +- **Enable verbose output** + - `-v`, `--verbose` + +- **Print the git short hash and commit time** + - `--version` + +Example usage: + +`python3 main.py -v -o my_bookmarks.html` + +![Example Usage](example.gif) + +## How It Works + +1. **Read JSON**: Reads the `StorableSidebar.json` file from the Arc Browser's directory *or* the project's directory. +2. **Convert Data**: Converts the JSON data into a hierarchical bookmarks dictionary. +3. **Generate HTML**: Transforms the bookmarks dictionary into an HTML file. +4. **Write HTML**: Saves the HTML file with a timestamp, allowing it to be imported into any web browser. + +## Contributions + +Contributions are very welcome. Please submit a pull request or create an issue. + +## Support + +Thank you for using this project! If you find it helpful and would like to support my work, kindly consider buying me a coffee. Your support is greatly appreciated! + +Buy Me A Coffee + +And do not forget to give the project a star if you like it! :star: + +## License + +This project is licensed under the MIT License. diff --git a/arc-export/example.gif b/arc-export/example.gif new file mode 100644 index 0000000..17e056a Binary files /dev/null and b/arc-export/example.gif differ diff --git a/arc-export/main.py b/arc-export/main.py new file mode 100755 index 0000000..aa49307 --- /dev/null +++ b/arc-export/main.py @@ -0,0 +1,311 @@ +#!/usr/bin/env python3 + +import argparse +import datetime +import json +import logging +import os +import subprocess +from datetime import datetime +from pathlib import Path + + +class Colors: + RESET = "\033[0m" + BOLD = "\033[1m" + UNDERLINE = "\033[4m" + + BLACK = "\033[30m" + RED = "\033[31m" + GREEN = "\033[32m" + YELLOW = "\033[33m" + BLUE = "\033[34m" + MAGENTA = "\033[35m" + CYAN = "\033[36m" + WHITE = "\033[37m" + GREY = "\033[90m" + + @staticmethod + def Background(color: str) -> str: + return color.replace("[3", "[4", 1) + + +class CustomFormatter(logging.Formatter): + time_format = f"{Colors.GREY}%(asctime)s{Colors.RESET}" + FORMATS = { + logging.DEBUG: f"{time_format} {Colors.BOLD}{Colors.CYAN}DEBG{Colors.RESET} %(message)s", + logging.INFO: f"{time_format} {Colors.BOLD}{Colors.GREEN}INFO{Colors.RESET} %(message)s", + logging.WARNING: f"{time_format} {Colors.BOLD}{Colors.YELLOW}WARN{Colors.RESET} %(message)s", + logging.ERROR: f"{time_format} {Colors.BOLD}{Colors.RED}ERRR{Colors.RESET} %(message)s", + logging.CRITICAL: f"{time_format} {Colors.BOLD}{Colors.Background(Colors.RED)}CRIT{Colors.RESET} %(message)s", + } + + def format(self, record: any) -> str: + log_fmt = self.FORMATS.get(record.levelno) + formatter = logging.Formatter(log_fmt, datefmt="%H:%M") + return formatter.format(record) + + +def main() -> None: + parser = argparse.ArgumentParser( + description="reads Arc Browser JSON data, converts it to HTML, and writes the output to a specified file." + ) + parser.add_argument("-s", "--silent", action="store_true", help="silence output") + parser.add_argument( + "-o", "--output", type=Path, required=False, help="specify the output file path" + ) + parser.add_argument( + "-v", + "--verbose", + action="store_true", + default=False, + help="enable verbose output", + ) + parser.add_argument( + "--version", + action="store_true", + help="print the git short hash and commit time", + ) + + args = parser.parse_args() + + if args.silent: + logging.disable(logging.CRITICAL) + else: + setup_logging(args.verbose) + + if args.version: + commit_hash, commit_time = get_version() + if commit_hash is None or commit_time is None: + logging.critical("Could not fetch Git metadata.") + return + print( + f"{Colors.BOLD}GIT TIME{Colors.RESET} | {Colors.GREEN}{commit_time.strftime('%Y-%m-%d')}{Colors.RESET} [{Colors.YELLOW}{int(commit_time.timestamp())}{Colors.RESET}]" + ) + print( + f"{Colors.BOLD}GIT HASH{Colors.RESET} | {Colors.MAGENTA}{commit_hash}{Colors.RESET}" + ) + return + + data: dict = read_json() + html: str = convert_json_to_html(data) + write_html(html, args.output) + logging.info("Done!") + + +def setup_logging(is_verbose: bool) -> None: + handler = logging.StreamHandler() + handler.setFormatter(CustomFormatter()) + logging.basicConfig(level=logging.DEBUG, handlers=[handler]) + + if is_verbose: + logging.getLogger().setLevel(logging.DEBUG) + else: + logging.getLogger().setLevel(logging.INFO) + + +def get_version() -> tuple[str, datetime]: + try: + commit_hash: str = ( + subprocess.check_output(["git", "rev-parse", "--short", "HEAD"]) + .decode("utf-8") + .strip() + ) + commit_time_str: str = ( + subprocess.check_output(["git", "log", "-1", "--format=%ct"]) + .decode("utf-8") + .strip() + ) + commit_time = datetime.fromtimestamp(int(commit_time_str)) + except Exception: + commit_hash = None + commit_time = None + + return commit_hash, commit_time + + +def read_json() -> dict: + logging.info("Reading JSON...") + + filename: Path = Path("StorableSidebar.json") + if os.name == "nt": + arc_root_parent_path: Path = Path( + os.path.expanduser(r"~\AppData\Local\Packages") + ) + arc_root_paths: list[Path] = [ + f + for f in arc_root_parent_path.glob("*") + if f.name.startswith("TheBrowserCompany.Arc") + ] + if len(arc_root_paths) != 1: + raise FileNotFoundError + + library_path: Path = Path( + arc_root_paths[0].joinpath(r"LocalCache\Local\Arc") + ).joinpath(filename) + + else: + library_path: Path = Path( + os.path.expanduser("~/Library/Application Support/Arc/") + ).joinpath(filename) + + data: dict = {} + + if filename.exists(): + with filename.open("r", encoding="utf-8") as f: + logging.debug(f"Found {filename} in current directory.") + data = json.load(f) + + elif library_path.exists(): + with library_path.open("r", encoding="utf-8") as f: + logging.debug(f"Found {filename} in Library directory.") + data = json.load(f) + + else: + logging.critical( + '> File not found. Look for the "StorableSidebar.json" ' + ' file within the "~/Library/Application Support/Arc/" folder.' + ) + raise FileNotFoundError + + return data + + +def convert_json_to_html(json_data: dict) -> str: + containers: list = json_data["sidebar"]["containers"] + try: + target: int = next(i + 1 for i, c in enumerate(containers) if "global" in c) + except StopIteration: + raise ValueError("No container with 'global' found in the sidebar data") + + spaces: dict = get_spaces(json_data["sidebar"]["containers"][target]["spaces"]) + items: list = json_data["sidebar"]["containers"][target]["items"] + + bookmarks: dict = convert_to_bookmarks(spaces, items) + html_content: str = convert_bookmarks_to_html(bookmarks) + + return html_content + + +def get_spaces(spaces: list) -> dict: + logging.info("Getting spaces...") + + spaces_names: dict = {"pinned": {}, "unpinned": {}} + spaces_count: int = 0 + n: int = 1 + + for space in spaces: + if "title" in space: + title: str = space["title"] + else: + title: str = "Space " + str(n) + n += 1 + + # TODO: Find a better way to determine if a space is pinned or not + if isinstance(space, dict): + containers: list = space["newContainerIDs"] + + for i in range(len(containers)): + if isinstance(containers[i], dict): + if "pinned" in containers[i]: + spaces_names["pinned"][str(containers[i + 1])]: str = title + elif "unpinned" in containers[i]: + spaces_names["unpinned"][str(containers[i + 1])]: str = title + + spaces_count += 1 + + logging.debug(f"Found {spaces_count} spaces.") + + return spaces_names + + +def convert_to_bookmarks(spaces: dict, items: list) -> dict: + logging.info("Converting to bookmarks...") + + bookmarks: dict = {"bookmarks": []} + bookmarks_count: int = 0 + item_dict: dict = {item["id"]: item for item in items if isinstance(item, dict)} + + def recurse_into_children(parent_id: str) -> list: + nonlocal bookmarks_count + children: list = [] + for item_id, item in item_dict.items(): + if item.get("parentID") == parent_id: + if "data" in item and "tab" in item["data"]: + children.append( + { + "title": item.get("title", None) + or item["data"]["tab"].get("savedTitle", ""), + "type": "bookmark", + "url": item["data"]["tab"].get("savedURL", ""), + } + ) + bookmarks_count += 1 + elif "title" in item: + child_folder: dict = { + "title": item["title"], + "type": "folder", + "children": recurse_into_children(item_id), + } + children.append(child_folder) + return children + + for space_id, space_name in spaces["pinned"].items(): + space_folder: dict = { + "title": space_name, + "type": "folder", + "children": recurse_into_children(space_id), + } + bookmarks["bookmarks"].append(space_folder) + + logging.debug(f"Found {bookmarks_count} bookmarks.") + + return bookmarks + + +def convert_bookmarks_to_html(bookmarks: dict) -> str: + logging.info("Converting bookmarks to HTML...") + + html_str: str = """ + +Bookmarks +

Bookmarks

+

""" + + def traverse_dict(d: dict, html_str: str, level: int) -> str: + indent: str = "\t" * level + for item in d: + if item["type"] == "folder": + html_str += f'\n{indent}

{item["title"]}

' + html_str += f"\n{indent}

" + html_str = traverse_dict(item["children"], html_str, level + 1) + html_str += f"\n{indent}

" + elif item["type"] == "bookmark": + html_str += f'\n{indent}

{item["title"]}' + return html_str + + html_str = traverse_dict(bookmarks["bookmarks"], html_str, 1) + html_str += "\n

" + + logging.debug("HTML converted.") + + return html_str + + +def write_html(html_content: str, output: Path = None) -> None: + logging.info("Writing HTML...") + + if output is not None: + output_file: Path = output + else: + current_date: str = datetime.now().strftime("%Y_%m_%d") + output_file: Path = Path("arc_bookmarks_" + current_date).with_suffix(".html") + + with output_file.open("w", encoding="utf-8") as f: + f.write(html_content) + + logging.debug(f"HTML written to {output_file}.") + + +if __name__ == "__main__": + main() diff --git a/bootableBigSur.sh b/bootableBigSur.sh new file mode 100755 index 0000000..49ac8da --- /dev/null +++ b/bootableBigSur.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +#################### +# Notes # +#################### +# +# Created 20200625 by Nathan Worster +# +# This script assumes that the macOS Beta installer is already staged in the Applications folder, and will convert that .app installer into a bootable .dmg. +# To download the latest macOS beta, go to https://developer.apple.com/download/ or, if applicable, https://appleseed.apple.com/. +# The .dmg file will be placed in ~/Downloads. +# This script must be run with sudo using "sudo bash " if run outside of an MDM. +# +#################### +# Variables # +#################### + +dmgName=$"macOS11BigSurBeta" + +#################### +# Script # +#################### + +cd ~/Downloads + +# Create and mount sparse volume: +hdiutil create -o install_container -size 20G -layout SPUD -fs HFS+J -type SPARSE +hdiutil attach install_container.sparseimage -noverify -mountpoint /Volumes/install_build + +# Copy contents of installer .app into mounted volume: +/Applications/Install\ macOS\ Beta.app/Contents/Resources/createinstallmedia --nointeraction --volume /Volumes/install_build + +# Detach the completed image: +hdiutil detach -force /Volumes/Install\ macOS\ Beta + +# Convert and rename the image: +hdiutil convert install_container.sparseimage -format UDZO -o $dmgName.dmg + +# Cleanup + +rm install_container.sparseimage + +exit 0 + diff --git a/control-console-windowmanager.sh b/control-console-windowmanager.sh new file mode 100644 index 0000000..7339044 --- /dev/null +++ b/control-console-windowmanager.sh @@ -0,0 +1,4 @@ +log stream --predicate '(process == "WindowServer")' --debug +com.apple.CoreDisplay:default +com.apple.SkyLight.display +sudo log config --process="259" --mode "level:off" \ No newline at end of file diff --git a/dactoggle b/dactoggle new file mode 100755 index 0000000..9b86eda --- /dev/null +++ b/dactoggle @@ -0,0 +1,21 @@ +#!/bin/bash +export PATH=$PATH:/usr/bin/local +cname=`scutil --get ComputerName` + +echo "" +echo "!!** dactoggle **!!" +echo "------------------------------------------------------------------------" +echo "Machine:" $cname +echo `date` +echo "" + +# machine specific: Angus && Petula, turn off HomeKit stuff +if [ $cname = "Angus" ]; +then + open -g "homecontrol://x-callback-url/run-action?action-type=switch-device-status&item-type=device&item-name=Office%20Plug%20A1&room-name=South%20Office&home-name=Holland%20Main&activation-mode=toggle&authentication-token=Ew2r577TQShzrOH3Cmfew" +elif [ $cname = "Petula" ]; +then + open -g "homecontrol://x-callback-url/run-action?action-type=switch-device-status&item-type=device&item-name=Mac%20Studio%20DAC%20Switch&room-name=North%20Office&home-name=Holland%20Main&activation-mode=toggle&authentication-token=Ew2r577TQShzrOH3Cmfew" +else + echo "** Not on Angus or Petula **" +fi \ No newline at end of file diff --git a/digall b/digall new file mode 100755 index 0000000..1bc36cd --- /dev/null +++ b/digall @@ -0,0 +1,2 @@ +#!/bin/sh +dig +nocmd $1 any +multiline +noall +answer diff --git a/displaycount (Callum.local's conflicted copy 2024-10-30).scpt b/displaycount (Callum.local's conflicted copy 2024-10-30).scpt new file mode 100644 index 0000000..42aae57 Binary files /dev/null and b/displaycount (Callum.local's conflicted copy 2024-10-30).scpt differ diff --git a/displaycount (Callum.local's conflicted copy 2025-03-11).scpt b/displaycount (Callum.local's conflicted copy 2025-03-11).scpt new file mode 100644 index 0000000..4097f1a Binary files /dev/null and b/displaycount (Callum.local's conflicted copy 2025-03-11).scpt differ diff --git a/displaycount (Steve’s MacBook Pro's conflicted copy 2025-07-28).scpt b/displaycount (Steve’s MacBook Pro's conflicted copy 2025-07-28).scpt new file mode 100644 index 0000000..c1a44d6 Binary files /dev/null and b/displaycount (Steve’s MacBook Pro's conflicted copy 2025-07-28).scpt differ diff --git a/displaycount.scpt b/displaycount.scpt new file mode 100644 index 0000000..be61f26 Binary files /dev/null and b/displaycount.scpt differ diff --git a/dropkick b/dropkick new file mode 100755 index 0000000..040d9b2 --- /dev/null +++ b/dropkick @@ -0,0 +1,67 @@ +#!/bin/bash +# +# DROPKICK.SH +# +# Detect and Disconnect the DropCam and Withings devices some people are using to +# spy on guests in their home, especially in AirBnB rentals. Based on Glasshole.sh: +# +# http://julianoliver.com/output/log_2014-05-30_20-52 +# +# This script was named by Adam Harvey (http://ahprojects.com), who also +# encouraged me to write it. It requires a GNU/Linux host (laptop, Raspberry Pi, +# etc) and the aircrack-ng suite. I put 'beep' in there for a little audio +# notification. Comment it out if you don't need it. +# +# See also http://plugunplug.net, for a plug-and-play device that does this +# based on OpenWrt. Code here: +# +# https://github.com/JulianOliver/CyborgUnplug +# +# Save as dropkick.sh, 'chmod +x dropkick.sh' and exec as follows: +# +# sudo ./dropkick.sh + +shopt -s nocasematch # Set shell to ignore case +shopt -s extglob # For non-interactive shell. + +readonly NIC=$1 # Your wireless NIC +readonly BSSID=$2 # Network BSSID (AirBnB WiFi network) +readonly MAC=$(/sbin/ifconfig | grep $NIC | head -n 1 | awk '{ print $5 }') +# MAC=$(ip link show "$NIC" | awk '/ether/ {print $2}') # If 'ifconfig' not +# present. +readonly GGMAC='@(30:8C:FB*|00:24:E4*)' # Match against DropCam and Withings +readonly POLL=30 # Check every 30 seconds +readonly LOG=/var/log/dropkick.log + +airmon-ng stop mon0 # Pull down any lingering monitor devices +airmon-ng start $NIC # Start a monitor device + +while true; + do + for TARGET in $(arp-scan -I $NIC --localnet | grep -o -E \ + '([[:xdigit:]]{1,2}:){5}[[:xdigit:]]{1,2}') + do + if [[ "$TARGET" == "$GGMAC" ]] + then + # Audio alert + beep -f 1000 -l 500 -n 200 -r 2 + echo "WiFi camera discovered: "$TARGET >> $LOG + aireplay-ng -0 1 -a $BSSID -c $TARGET mon0 + echo "De-authed: "$TARGET " from network: " $BSSID >> $LOG + echo ' + __ __ _ __ __ + ___/ /______ ___ / /__ (_)___/ /_____ ___/ / + / _ / __/ _ \/ _ \/ _// / __/ _/ -_) _ / + \_,_/_/ \___/ .__/_/\_\/_/\__/_/\_\\__/\_,_/ + /_/ + + ' + else + echo $TARGET": is not a DropCam or Withings device. Leaving alone.." + fi + done + echo "None found this round." + sleep $POLL +done +airmon-ng stop mon0 + diff --git a/fixhostname b/fixhostname new file mode 100755 index 0000000..915f17f --- /dev/null +++ b/fixhostname @@ -0,0 +1,6 @@ +#!/bin/bash +hostname=`hostname` +if [ "$hostname" == "Unknown.domain" ] +then + sudo hostname Go-Sharks.local +fi diff --git a/hatari-modem b/hatari-modem new file mode 100755 index 0000000..28662e6 --- /dev/null +++ b/hatari-modem @@ -0,0 +1,12 @@ +#!/bin/sh +# +# adapted from info on (and other places): +# http://breakintochat.com/blog/2012/12/13/telnet-to-bbs-within-hatari-emulator/ +# + +cd ~/Dropbox/Hatari/tcpser4j +sh tcpser4j >> tcpser4j.log 2>&1 +rm /Users/shughey/ownCloud/Hatari/modem.dev +cd /Users/shughey/ownCloud/Hatari +open Hatari.app & +socat PTY,link=/Users/shughey/ownCloud/Hatari/modem.dev,raw,echo=0 TCP4:localhost:25232 diff --git a/hyper b/hyper new file mode 100755 index 0000000..c8b9e5c Binary files /dev/null and b/hyper differ diff --git a/idlecheck b/idlecheck new file mode 100755 index 0000000..a0196a4 --- /dev/null +++ b/idlecheck @@ -0,0 +1,56 @@ +#!/bin/bash + +OUTPUT='/tmp/statusmail.txt' +START="$(date +%s)" +cname=`scutil --get ComputerName` +script=`basename $0` + +# [[ $(date +%s -r mstall.zip) -lt $(date +%s --date="77 min ago") ]] && echo File is older than 1hr 17min + +# [[ $(stat -f "%m" mstall.zip) -lt $(date -j -v-77M +%s) ]] && echo File is older than 1hr 17min +echo "" > ${OUTPUT} + +ESUBJ="$KMINFO_MacroName" +export ESUBJ + +# https://textkool.com/en/test-ascii-art-generator?text=idlecheck +# "ANSI Shadow" font +echo "// idlecheck" >> ${OUTPUT} +echo " " `date` >> ${OUTPUT} +echo " machine: ${cname}" >> ${OUTPUT} +echo " script: ${script}" >> ${OUTPUT} +echo " " `/usr/bin/sw_vers` >> ${OUTPUT} +echo " " `sysctl kern.version` >> ${OUTPUT} +echo " " `sysctl kern.ostype` >> ${OUTPUT} +echo " " `sysctl kern.osrelease` >> ${OUTPUT} +echo " " `sysctl kern.osrevision` >> ${OUTPUT} +echo "" >> ${OUTPUT} +echo "" >> ${OUTPUT} +echo "" >> ${OUTPUT} +echo "██╗██████╗ ██╗ ███████╗ " >> ${OUTPUT} +echo "██║██╔══██╗██║ ██╔════╝ " >> ${OUTPUT} +echo "██║██║ ██║██║ █████╗ " >> ${OUTPUT} +echo "██║██║ ██║██║ ██╔══╝ " >> ${OUTPUT} +echo "██║██████╔╝███████╗███████╗ " >> ${OUTPUT} +echo "╚═╝╚═════╝ ╚══════╝╚══════╝ " >> ${OUTPUT} +echo " " >> ${OUTPUT} +echo " ██████╗██╗ ██╗███████╗ ██████╗██╗ ██╗" >> ${OUTPUT} +echo " ██╔════╝██║ ██║██╔════╝██╔════╝██║ ██╔╝" >> ${OUTPUT} +echo " ██║ ███████║█████╗ ██║ █████╔╝ " >> ${OUTPUT} +echo " ██║ ██╔══██║██╔══╝ ██║ ██╔═██╗ " >> ${OUTPUT} +echo " ╚██████╗██║ ██║███████╗╚██████╗██║ ██╗" >> ${OUTPUT} +echo " ╚═════╝╚═╝ ╚═╝╚══════╝ ╚═════╝╚═╝ ╚═╝" >> ${OUTPUT} +echo "" >> ${OUTPUT} +echo "--------------------------------------------" >> ${OUTPUT} + + +/bin/bash ${HOME}/Dropbox/bin/idlecheck_tasks >> ${OUTPUT} +/bin/bash ${HOME}/Dropbox/bin/idlecheck_quitvideowake >> ${OUTPUT} +/bin/bash ${HOME}/Dropbox/bin/idlecheck_quitaudioprevent >> ${OUTPUT} +/bin/bash ${HOME}/Dropbox/bin/idlecheck_caffeinatestuck >> ${OUTPUT} +/usr/bin/pmset displaysleepnow +/usr/bin/python3 ${HOME}/Dropbox/bin/send_status_mail3.py +DURATION=$[ $(date +%s) - ${START} ] +#cat /tmp/wakemaints.txt | fgrep "Wake reason" +rm ${OUTPUT} +sleep 10 diff --git a/idlecheck_caffeinatestuck b/idlecheck_caffeinatestuck new file mode 100755 index 0000000..a75c9d8 --- /dev/null +++ b/idlecheck_caffeinatestuck @@ -0,0 +1,78 @@ +#!/bin/sh + +export PATH=$PATH:/usr/bin/local +cname=`scutil --get ComputerName` +export CNAME=$cname +pmt=/tmp/pmset-test.txt +pmv=/tmp/pmset-caffeinatepids.txt +pidf=/tmp/pmset-test-pid.txt +dnqf=/tmp/caffeinate-do-not-quit.txt + +doNotQuit=("Hogwasher" "HandBrake" "PreventUserIdleSleep" "ffmpeg" "Amphetamine") # last val actually not a prog output +preventButOK=("powerd" "cloudd" "bluetoothd" "coreaudiod") +# https://textkool.com/en/test-ascii-art-generator?text=idlecheck +# "ANSI Shadow" font +echo "" +echo "" +echo "// idlecheck_caffeinatestuck" +echo "----------------------------------------------" + +#Listed by owning process: +# pid 30456(caffeinate): [0x00004a4700018c74] 15:16:59 PreventUserIdleSystemSleep named: "caffeinate command-line tool" +#Details: caffeinate asserting on behalf of '/Users/shughey/Dropbox/bin/presleep' (pid 30455) +#Localized=THE CAFFEINATE TOOL IS PREVENTING SLEEP. +# pid 30456(caffeinate): [0x00004a4700078c77] 15:16:59 PreventSystemSleep named: "caffeinate command-line tool" +#Details: caffeinate asserting on behalf of '/Users/shughey/Dropbox/bin/presleep' (pid 30455) +#Localized=THE CAFFEINATE TOOL IS PREVENTING SLEEP. + +pmset -g assertions > ${pmt} +#cat test-caffeinate.txt > ${pmt} + +echo "" > ${pmv} +rm ${dnqf} +touch ${dnqf} + +fgrep "PreventUserIdleSystemSleep named" ${pmt} | grep pid | cut -d : -f 1,1 | sed 's/^.*pid \([0-9]\{1,6\}\)(\(.*\)).*$/\1 \2/' > ${pmv} + +tsize=`stat -f%z ${pmv}` +#echo "file size: ${tsize}" +zs=0 + +#cat ${pmt} # test + +if [ $tsize -gt 0 ]; then + cat ${pmv} | while read line + do +# echo $line + pid=$(echo $line | awk '{print $1}') + name=$(echo $line | awk '{print $2}') +# echo "PID: ${pid}" +# echo "NAME: ${name}" + if [[ ! " ${doNotQuit[*]} " =~ [[:space:]]${name}[[:space:]] ]]; then +# if [[ "$name" != "PreventUserIdleSystemSleep" && "$name" != "cloudd" ]]; then + if [[ ! " ${preventButOK[*]} " =~ [[:space:]]${name}[[:space:]] ]]; then # is it on the Prevent but sleep anyway list? ex: powerd + echo "* quitting: ${name} (PreventUserIdleSystemSleep, id ${pid})" + osascript -e "ignoring application responses" -e "quit app \"$name\"" -e "end ignoring" + sleep 3 + ps -p ${pid} > ${pidf} + pfsz=`stat -f%z ${pidf}` + if [ $pfsz -gt 40 ]; then + echo " killing pid as script didn't kill it? pid ${pid}" + sleep 3 + kill -9 $pid + else + echo " quit successfully!" + fi + fi + else + echo "* skipping from Do Not Quit list: ${name}" + echo ${name} >> ${dnqf} + fi + done +else + echo "* no PreventUserIdleSystemSleep" +fi + +if [ -f "${pmt}" ]; then rm ${pmt}; fi +if [ -f "${pmv}" ]; then rm ${pmv}; fi +if [ -f "${pidf}" ]; then rm ${pidf}; fi diff --git a/idlecheck_quitaudiolock b/idlecheck_quitaudiolock new file mode 100755 index 0000000..6413a4e --- /dev/null +++ b/idlecheck_quitaudiolock @@ -0,0 +1,75 @@ +#!/bin/sh + +# TO DO +# pmset -g assertions +# pid 419(coreaudiod): [0x0000a7e0000192db] 02:57:46 PreventUserIdleSystemSleep named: "com.apple.audio.AppleUSBAudioEngine:Burr-Brown from TI :USB Audio DAC :3200000:1.context.preventuseridlesleep" +# Created for PID: 2213. + +export PATH=$PATH:/usr/bin/local +cname=`scutil --get ComputerName` +export CNAME=$cname +pmt=/tmp/pmset-test.txt +pmv=/tmp/pmset-audiolockpids.txt +pidf=/tmp/pmset-test-pid.txt + +echo "" +echo "" +echo "// idlecheck_quitaudiolock" +echo "----------------------------------------------" + +pmset -g assertions > ${pmt} + +echo "" > ${pmv} +# fgrep "Video Wake Lock" ${pmt} | sed 's/^.*pid \([0-9]\{1,6\}\)(\(.*\)).*$/\1 \2/' > ${pmv} +lastlineps=0 +cat ${pmt} | while read line +do +# echo $line + if [[ $line =~ fgb3 ]]; then + if [ "$lastlineps" -eq 1 ]; then + echo $'\t' "^^ want to kill this PID" + fi + fi + if [[ $line =~ .*preventuseridlesleep.* ]]; then + echo $'\t' "^^ prevent" + lastlineps=1 + else + lastlineps=0 + fi +done + + +# fgrep "Created for PID:" ${pmt} | sed 's/^.*PID: \([0-9]\{1,6\}\).*$/\1/' > ${pmv} + +# tsize=`stat -f%z ${pmv}` +#echo "file size: ${tsize}" +# zs=0 + +#if [ $tsize -gt 0 ]; then +# cat ${pmv} | while read line +# do +# pid=$(echo $line | awk '{print $1}') +# name=$(echo $line | awk '{print $2}') + #echo "PID: ${pid}" + #echo "NAME: ${name}" +# echo "...quitting Video Wake Lock Process: ${name} (${pid})" +# osascript -e "ignoring application responses" -e "quit app \"$name\"" -e "end ignoring" +# sleep 3 +# ps -p ${pid} > ${pidf} +# pfsz=`stat -f%z ${pidf}` +# if [ $pfsz -gt 40 ]; then +# echo $'\t' "killing pid as script didn't kill it? pid ${pid}" +# sleep 3 +# kill -9 $pid +# else +# echo $'\t' "quit successfully!" +# fi +# done +#else +# echo "...no Video Wake Lock processes" +#fi + + +if [ -f "${pmt}" ]; then rm ${pmt}; fi +if [ -f "${pmv}" ]; then rm ${pmv}; fi +if [ -f "${pidf}" ]; then rm ${pidf}; fi diff --git a/idlecheck_quitaudioprevent b/idlecheck_quitaudioprevent new file mode 100755 index 0000000..1c800ee --- /dev/null +++ b/idlecheck_quitaudioprevent @@ -0,0 +1,51 @@ +#!/bin/sh + +export PATH=$PATH:/usr/bin/local +cname=`scutil --get ComputerName` +export CNAME=$cname +pmt=/tmp/pmset-test.txt +pmv=/tmp/pmset-audiowakepids.txt +pidf=/tmp/pmset-test-pid.txt + +echo "" +echo "" +echo "// idlecheck_quitaudioprevent" +echo "----------------------------------------------" + +pmset -g assertions > ${pmt} + +echo "" > ${pmv} +fgrep "Playing audio" ${pmt} | fgrep "NoIdleSleepAssertion" | sed 's/^.*pid \([0-9]\{1,6\}\)(\(.*\)).*$/\1 \2/' > ${pmv} + +tsize=`stat -f%z ${pmv}` +#echo "file size: ${tsize}" +zs=0 + +if [ $tsize -gt 0 ]; then + cat ${pmv} | while read line + do + pid=$(echo $line | awk '{print $1}') + name=$(echo $line | awk '{print $2}') + #echo "PID: ${pid}" + #echo "NAME: ${name}" + echo "* quitting Playing Audio Process: ${name} (${pid})" + osascript -e "ignoring application responses" -e "quit app \"$name\"" -e "end ignoring" + sleep 3 + ps -p ${pid} > ${pidf} + pfsz=`stat -f%z ${pidf}` + if [ $pfsz -gt 40 ]; then + echo " killing pid as script didn't kill it? pid ${pid}" + sleep 3 + kill -9 $pid + else + echo " quit successfully!" + fi + done +else + echo "* no Playing Audio processes" +fi + + +if [ -f "${pmt}" ]; then rm ${pmt}; fi +if [ -f "${pmv}" ]; then rm ${pmv}; fi +if [ -f "${pidf}" ]; then rm ${pidf}; fi diff --git a/idlecheck_quitvideowake b/idlecheck_quitvideowake new file mode 100755 index 0000000..9b466bb --- /dev/null +++ b/idlecheck_quitvideowake @@ -0,0 +1,56 @@ +#!/bin/sh + +# TO DO +# pmset -g assertions +# pid 419(coreaudiod): [0x0000a7e0000192db] 02:57:46 PreventUserIdleSystemSleep named: "com.apple.audio.AppleUSBAudioEngine:Burr-Brown from TI :USB Audio DAC :3200000:1.context.preventuseridlesleep" +# Created for PID: 2213. + +export PATH=$PATH:/usr/bin/local +cname=`scutil --get ComputerName` +export CNAME=$cname +pmt=/tmp/pmset-test.txt +pmv=/tmp/pmset-videowakepids.txt +pidf=/tmp/pmset-test-pid.txt + +echo "" +echo "" +echo "// idlecheck_quitvideowake" +echo "----------------------------------------------" + +pmset -g assertions > ${pmt} + +echo "" > ${pmv} +fgrep "Video Wake Lock" ${pmt} | sed 's/^.*pid \([0-9]\{1,6\}\)(\(.*\)).*$/\1 \2/' > ${pmv} + +tsize=`stat -f%z ${pmv}` +#echo "file size: ${tsize}" +zs=0 + +if [ $tsize -gt 0 ]; then + cat ${pmv} | while read line + do + pid=$(echo $line | awk '{print $1}') + name=$(echo $line | awk '{print $2}') + #echo "PID: ${pid}" + #echo "NAME: ${name}" + echo "* quitting Video Wake Lock Process: ${name} (${pid})" + osascript -e "ignoring application responses" -e "quit app \"$name\"" -e "end ignoring" + sleep 3 + ps -p ${pid} > ${pidf} + pfsz=`stat -f%z ${pidf}` + if [ $pfsz -gt 40 ]; then + echo " killing pid as script didn't kill it? pid ${pid}" + sleep 3 + kill -9 $pid + else + echo " quit successfully!" + fi + done +else + echo "* no Video Wake Lock processes" +fi + + +if [ -f "${pmt}" ]; then rm ${pmt}; fi +if [ -f "${pmv}" ]; then rm ${pmv}; fi +if [ -f "${pidf}" ]; then rm ${pidf}; fi diff --git a/idlecheck_tasks b/idlecheck_tasks new file mode 100755 index 0000000..d457710 --- /dev/null +++ b/idlecheck_tasks @@ -0,0 +1,35 @@ +#!/bin/sh +export PATH=$PATH:/usr/bin/local +cname=`scutil --get ComputerName` +export CNAME=$cname + +echo "" +echo "" +echo "// idlecheck_tasks" +echo "" +echo "" +echo "pmset -g" +echo "----------------------------------------------" +/usr/bin/pmset -g + + +echo "" +echo "" +echo "" +echo "pmset -g sched" +echo "----------------------------------------------" +/usr/bin/pmset -g sched + +echo "" +echo "" +echo "" +echo "pmset -g assertions" +echo "----------------------------------------------" +/usr/bin/pmset -g assertions + +#echo "" +#echo "" +#echo "" +#echo "ps auxc -r" +#echo "------------------------------------------" +#ps auxc -r diff --git a/imgcat b/imgcat new file mode 100755 index 0000000..15a1245 --- /dev/null +++ b/imgcat @@ -0,0 +1,153 @@ +#!/bin/bash + +# tmux requires unrecognized OSC sequences to be wrapped with DCS tmux; +# ST, and for all ESCs in to be replaced with ESC ESC. It +# only accepts ESC backslash for ST. We use TERM instead of TMUX because TERM +# gets passed through ssh. +function print_osc() { + if [[ $TERM == screen* ]] ; then + printf "\033Ptmux;\033\033]" + else + printf "\033]" + fi +} + +# More of the tmux workaround described above. +function print_st() { + if [[ $TERM == screen* ]] ; then + printf "\a\033\\" + else + printf "\a" + fi +} + +function load_version() { + if [ -z ${IMGCAT_BASE64_VERSION+x} ]; then + export IMGCAT_BASE64_VERSION=$(base64 --version 2>&1) + fi +} + +function b64_encode() { + load_version + if [[ "$IMGCAT_BASE64_VERSION" =~ GNU ]]; then + # Disable line wrap + base64 -w0 + else + base64 + fi +} + +function b64_decode() { + load_version + if [[ "$IMGCAT_BASE64_VERSION" =~ fourmilab ]]; then + BASE64ARG=-d + elif [[ "$IMGCAT_BASE64_VERSION" =~ GNU ]]; then + BASE64ARG=-di + else + BASE64ARG=-D + fi + base64 $BASE64ARG +} + +# print_image filename inline base64contents print_filename +# filename: Filename to convey to client +# inline: 0 or 1 +# base64contents: Base64-encoded contents +# print_filename: If non-empty, print the filename +# before outputting the image +function print_image() { + print_osc + printf '1337;File=' + if [[ -n "$1" ]]; then + printf 'name='`printf "%s" "$1" | b64_encode`";" + fi + + printf "%s" "$3" | b64_decode | wc -c | awk '{printf "size=%d",$1}' + printf ";inline=$2" + printf ":" + printf "%s" "$3" + print_st + printf '\n' + if [[ -n "$4" ]]; then + echo $1 + fi +} + +function error() { + echo "ERROR: $*" 1>&2 +} + +function show_help() { + echo "Usage: imgcat [-p] filename ..." 1>& 2 + echo " or: cat filename | imgcat" 1>& 2 +} + +function check_dependency() { + if ! (builtin command -V "$1" > /dev/null 2>& 1); then + echo "imgcat: missing dependency: can't find $1" 1>& 2 + exit 1 + fi +} + +## Main + +if [ -t 0 ]; then + has_stdin=f +else + has_stdin=t +fi + +# Show help if no arguments and no stdin. +if [ $has_stdin = f -a $# -eq 0 ]; then + show_help + exit +fi + +check_dependency awk +check_dependency base64 +check_dependency wc + +# Look for command line flags. +while [ $# -gt 0 ]; do + case "$1" in + -h|--h|--help) + show_help + exit + ;; + -p|--p|--print) + print_filename=1 + ;; + -u|--u|--url) + check_dependency curl + encoded_image=$(curl -s "$2" | b64_encode) || (error "No such file or url $2"; exit 2) + has_stdin=f + print_image "$2" 1 "$encoded_image" "$print_filename" + set -- ${@:1:1} "-u" ${@:3} + if [ "$#" -eq 2 ]; then + exit + fi + ;; + -*) + error "Unknown option flag: $1" + show_help + exit 1 + ;; + *) + if [ -r "$1" ] ; then + has_stdin=f + print_image "$1" 1 "$(b64_encode < "$1")" "$print_filename" + else + error "imgcat: $1: No such file or directory" + exit 2 + fi + ;; + esac + shift +done + +# Read and print stdin +if [ $has_stdin = t ]; then + print_image "" 1 "$(cat | b64_encode)" "" +fi + +exit 0 diff --git a/install-nginx.sh b/install-nginx.sh new file mode 100755 index 0000000..dcd9ce9 --- /dev/null +++ b/install-nginx.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +## DOWNLOADS +#sudo curl -OL h ftp://ftp.csx.cam.ac.uk//pub/software/programming/pcre/pcre-8.20.tar.gz > /usr/local/src/pcre-8.20.tar.gz +#sudo curl -OL h http://nginx.org/download/nginx-1.1.8.tar.gz > /usr/local/src/nginx-1.1.8.tar.gz + +## Install PCRE +sudo mkdir -p /usr/local/src +cd /usr/local/src +#tar xvzf pcre-8.20.tar.gz +cd pcre-8.20 +./configure --prefix=/usr/local +make +sudo make install +cd .. + +## Install Nginx +#tar xvzf nginx-1.1.8.tar.gz +cd nginx-1.1.8 +./configure --prefix=/usr/local --with-http_ssl_module +make +sudo make install + +## Start Nginx +#sudo /usr/local/sbin/nginx diff --git a/kbm-mountNAS.sh b/kbm-mountNAS.sh new file mode 100755 index 0000000..28e1f08 --- /dev/null +++ b/kbm-mountNAS.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +# list shares +#smbutil view -G //mini.nas | grep Disk | awk '{print $1" [mini, SMB]"}'; +#echo "------------------------------------"; +#smbutil view -G //ts.nas | grep Disk | awk '{print $1" [ts, SMB]"}'; +#echo "------------------------------------"; +#showmount -e benoit.nas | grep -v "Exports list" | awk '{print $1" [benoit, NFS]"}' + + +MOUNT=$KMVAR_selMount +#echo $MOUNT + +MOUNT='/BenoitBalls [benoit, NFS]' +#MOUNT='aura [ts, SMB]' + +M=`echo $MOUNT | awk '{print $1}' | sed 's/\///g'` +S=`echo $MOUNT | awk '{print $2}' | sed 's/\[//g' | sed 's/\,//g'` +T=`echo $MOUNT | awk '{print $3}' | sed 's/\]//g'` + +echo $M + +#if [[ "$S" == "benoit" ]]; then +# $S='' +if [[ "$T" == "NFS" ]]; then + #osascript -e "ignoring application responses" -e 'tell application "Finder" to mount volume "nfs://{$S}.nas/{$M}"' -e "end ignoring" + osascript -e 'tell application "Finder" to mount volume "nfs://'${S}'.nas/'${M}'"' +else + open "smb://${S}.nas/${M}"; +fi diff --git a/log-quieter.sh b/log-quieter.sh new file mode 100755 index 0000000..99debff --- /dev/null +++ b/log-quieter.sh @@ -0,0 +1,3 @@ +PID=`pgrep WindowServer` +sudo log config --process="${PID}" --mode "level:off" +echo "log stream --predicate '(process == \"WindowServer\")' --debug" \ No newline at end of file diff --git a/maintwakes b/maintwakes new file mode 100755 index 0000000..d36c855 --- /dev/null +++ b/maintwakes @@ -0,0 +1,88 @@ +#!/bin/bash + +OUTPUT='/tmp/statusmail.txt' +OUTPUT2='/tmp/maintwakes.txt' +TIMEINT='3h' +PMLOG_LMT='50' +START="$(date +%s)" +ESUBJ="$KMINFO_MacroName" +export ESUBJ +script=`basename $0` + +cname=`scutil --get ComputerName` + +echo "// wake! maintenance/DarkWake report" > ${OUTPUT} +echo " " `date` >> ${OUTPUT} +echo " Machine: ${cname}" >> ${OUTPUT} +echo " Script: " `basename $0` >> ${OUTPUT} +echo " " `/usr/bin/sw_vers` >> ${OUTPUT} +echo " " `sysctl kern.version` >> ${OUTPUT} +echo " " `sysctl kern.ostype` >> ${OUTPUT} +echo " " `sysctl kern.osrelease` >> ${OUTPUT} +echo " " `sysctl kern.osrevision` >> ${OUTPUT} +echo "" >> ${OUTPUT} +echo "" >> ${OUTPUT} +echo "" >> ${OUTPUT} +echo " █████ ███" >> ${OUTPUT} +echo " ░░███ ░███" >> ${OUTPUT} +echo " █████ ███ ███████████ ░███ █████ ██████ ░███" >> ${OUTPUT} +echo "░░███ ░███░░███░░░░░███░███░░███ ███░░███░███" >> ${OUTPUT} +echo " ░███ ░███ ░███ ███████░██████░ ░███████ ░███" >> ${OUTPUT} +echo " ░░███████████ ███░░███░███░░███ ░███░░░ ░░░ " >> ${OUTPUT} +echo " ░░████░████ ░░███████████ █████░░██████ ███" >> ${OUTPUT} +echo " ░░░░ ░░░░ ░░░░░░░░░░░ ░░░░░ ░░░░░░ ░░░ " >> ${OUTPUT} + +echo "Scanning log for maintenance wakes..." +log show --style syslog --last ${TIMEINT} | fgrep "Wake reason" | fgrep "Maintenance" | tail -r >> ${OUTPUT2} +lines=`cat ${OUTPUT2} | grep -c '^'` +DURATION=$[ $(date +%s) - ${START} ] +if [ "$lines" -gt 1 ] +then + echo "Maintenance Wakes // ---------------------------------------------" >> ${OUTPUT} + echo "" >> ${OUTPUT} + echo "Occurances: $lines" >> ${OUTPUT} + echo "Duration: ${DURATION}" >> ${OUTPUT} + echo "Look Back Time Interval: ${TIMEINT}" >> ${OUTPUT} + echo "" >> ${OUTPUT} + cat ${OUTPUT2} >> ${OUTPUT} + echo "" >> ${OUTPUT} + echo "------------------------------------------------------------------" >> ${OUTPUT} + #echo "$ott" > /tmp/wakemaints.txt +else + echo "No maintenance wakes last ${TIMEINT}" +fi + +echo "Scanning for DarkWake..." +pmset -g log | fgrep "DarkWake" | tail -r -n ${PMLOG_LMT} >> ${OUTPUT2} +lines2=`cat ${OUTPUT2} | grep -c '^'` +if [ "$lines2" -gt 1 ] +then + echo "" >> ${OUTPUT} + echo "" >> ${OUTPUT} + echo "" >> ${OUTPUT} + if [ "$lines" -gt 1 ]; then + echo "" >> ${OUTPUT} + fi + + echo "DarkWakes // -----------------------------------------------------" >> ${OUTPUT} + echo "" >> ${OUTPUT} + echo "Occurances: $lines2" >> ${OUTPUT} + echo "Look Back Line Limit: ${PMLOG_LMT}" >> ${OUTPUT} + echo "" >> ${OUTPUT} + cat ${OUTPUT2} >> ${OUTPUT} + echo "" >> ${OUTPUT} + echo "" >> ${OUTPUT} + echo "------------------------------------------------------------------" >> ${OUTPUT} + #echo "$ott" > /tmp/wakemaints.txt +else + echo "No DarkWakes last ${PMLOG_LMT} lines (pmset -g log)" +fi + +if [[ "$lines" -gt 1 || "$lines2" -gt 1 ]] +then + /usr/bin/python3 $HOME/Dropbox/bin/send_status_mail3.py +fi + +#cat /tmp/wakemaints.txt | fgrep "Wake reason" +rm ${OUTPUT} +rm ${OUTPUT2} diff --git a/maintwakes-halt b/maintwakes-halt new file mode 100755 index 0000000..e44c961 --- /dev/null +++ b/maintwakes-halt @@ -0,0 +1,35 @@ +#!/bin/bash + +OUTPUT='/tmp/statusmail.txt' +OUTPUT2='/tmp/maintwakes.txt' +TIMEINT='1h' +START="$(date +%s)" +echo "" > ${OUTPUT} +log show --style syslog --last ${TIMEINT} | fgrep "Wake reason" | fgrep "Maintenance" >> ${OUTPUT2} +lines=`cat ${OUTPUT2} | grep -c '^'` +DURATION=$[ $(date +%s) - ${START} ] +if [ "$lines" -gt 1 ] +then + echo "Occurances: $lines" >> ${OUTPUT} + echo "Duration: ${DURATION}" >> ${OUTPUT} + echo "Time Interval: ${TIMEINT}" >> ${OUTPUT} + echo "------------------------------------------------------------------" >> ${OUTPUT} + echo "" >> ${OUTPUT} + echo "" >> ${OUTPUT} + cat ${OUTPUT2} >> ${OUTPUT} + echo "" >> ${OUTPUT} + echo "" >> ${OUTPUT} + echo "------------------------------------------------------------------" >> ${OUTPUT} + #echo "$ott" > /tmp/wakemaints.txt + /usr/bin/python3 $HOME/Dropbox/bin/send_status_mail3.py +else + echo "No maintenance wakes last ${TIMEINT}" +fi +#cat /tmp/wakemaints.txt | fgrep "Wake reason" +rm ${OUTPUT} +rm ${OUTPUT2} +if [ "$lines" -gt 10 ] +then + sleep 10 + osascript -e 'tell application "System Events" to shut down' +fi diff --git a/makeicns b/makeicns new file mode 100755 index 0000000..4f1bcb4 --- /dev/null +++ b/makeicns @@ -0,0 +1,15 @@ +#!/bin/sh +mkdir MyIcon.iconset +sips -z 16 16 $1 --out MyIcon.iconset/icon_16x16.png +sips -z 32 32 $1 --out MyIcon.iconset/icon_16x16@2x.png +sips -z 32 32 $1 --out MyIcon.iconset/icon_32x32.png +sips -z 64 64 $1 --out MyIcon.iconset/icon_32x32@2x.png +sips -z 128 128 $1 --out MyIcon.iconset/icon_128x128.png +sips -z 256 256 $1 --out MyIcon.iconset/icon_128x128@2x.png +sips -z 256 256 $1 --out MyIcon.iconset/icon_256x256.png +sips -z 512 512 $1 --out MyIcon.iconset/icon_256x256@2x.png +sips -z 512 512 $1 --out MyIcon.iconset/icon_512x512.png +cp $1 MyIcon.iconset/icon_512x512@2x.png +iconutil -c icns MyIcon.iconset +rm -R MyIcon.iconset + diff --git a/mountvol b/mountvol new file mode 100755 index 0000000..c547da0 --- /dev/null +++ b/mountvol @@ -0,0 +1,6 @@ +#!/bin/sh +export PATH=$PATH:/usr/bin/local +echo "Looking for $1" +_MYDISK=`diskutil list | grep "$1" | sed 's/ GB/GB/g' | awk '{print $6}'` +echo "Mounting $_MYDISK" +diskutil mount /dev/$_MYDISK diff --git a/myip b/myip new file mode 100755 index 0000000..97e1fe8 --- /dev/null +++ b/myip @@ -0,0 +1,4 @@ +#!/bin/sh +printf 'Gateway: '; netstat -nr | grep default | awk '{print $2}'; +printf ' Public: '; curl -s http://checkip.dyndns.org | awk '{print $6}' | awk 'BEGIN {FS="<"}{print $1}' + diff --git a/pikvm b/pikvm new file mode 100755 index 0000000..84c06f3 --- /dev/null +++ b/pikvm @@ -0,0 +1,2 @@ +#!/bin/sh +/Applications/Vivaldi.app/Contents/MacOS/Vivaldi --app="https://pikvm.loc/" diff --git a/pikvm2 b/pikvm2 new file mode 100755 index 0000000..94dd52a --- /dev/null +++ b/pikvm2 @@ -0,0 +1,2 @@ +#!/bin/sh +/Applications/Vivaldi.app/Contents/MacOS/Vivaldi --app="https://pikvm2.loc/" diff --git a/presleep b/presleep new file mode 100755 index 0000000..ed256a2 --- /dev/null +++ b/presleep @@ -0,0 +1,14 @@ +#!/bin/bash + +OUTPUT='/tmp/statusmail.txt' +START="$(date +%s)" +ESUBJ="$KMINFO_MacroName" +export ESUBJ + +echo "" > ${OUTPUT} +/bin/bash $HOME/Dropbox/bin/presleep_quitapps >> ${OUTPUT} +/usr/bin/python3 $HOME/Dropbox/bin/send_status_mail3.py +DURATION=$[ $(date +%s) - ${START} ] +#cat /tmp/wakemaints.txt | fgrep "Wake reason" +rm ${OUTPUT} +sleep 30 diff --git a/presleep_quitapps b/presleep_quitapps new file mode 100755 index 0000000..579ce01 --- /dev/null +++ b/presleep_quitapps @@ -0,0 +1,216 @@ +#!/bin/bash +export PATH=$PATH:/usr/bin/local +cname=`scutil --get ComputerName` +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) +dtst=`date +"%Y%m%d-%H.%M"` + +echo "// presleep_quitapps" +echo " " `date` +echo " Machine: ${cname}" +echo " Script: " `basename $0` +echo " " `/usr/bin/sw_vers` +echo " " `sysctl kern.version` +echo " " `sysctl kern.ostype` +echo " " `sysctl kern.osrelease` +echo " " `sysctl kern.osrevision` +echo "" +echo "" +echo "" +echo "██╗██████╗ ██╗ ███████╗ " +echo "██║██╔══██╗██║ ██╔════╝ " +echo "██║██║ ██║██║ █████╗ " +echo "██║██║ ██║██║ ██╔══╝ " +echo "██║██████╔╝███████╗███████╗ " +echo "╚═╝╚═════╝ ╚══════╝╚══════╝ " +echo " " +echo " ██████╗██╗ ██╗███████╗ ██████╗██╗ ██╗" +echo " ██╔════╝██║ ██║██╔════╝██╔════╝██║ ██╔╝" +echo " ██║ ███████║█████╗ ██║ █████╔╝ " +echo " ██║ ██╔══██║██╔══╝ ██║ ██╔═██╗ " +echo " ╚██████╗██║ ██║███████╗╚██████╗██║ ██╗" +echo " ╚═════╝╚═╝ ╚═╝╚══════╝ ╚═════╝╚═╝ ╚═╝" +echo "" +echo "--------------------------------------------" + +if [[ $name = "Callum" ]]; then + HC_TKN="spFBeVc0RciFezbuU8vfA" +else + HC_TKN="Ew2r577TQShzrOH3Cmfew" +fi + +# machine specific: Angus && Petula, turn off HomeKit stuff +if [[ $cname = "Angus" || $cname = "Petula" ]]; +then + echo "** Machine Specific: $cname" + echo $'\t' "turning off xDuoo DAC using homecontrol" + open -g "homecontrol://x-callback-url/run-action?action-type=switch-device-status&item-type=device&item-name=xDuoo%20DAC&room-name=South%20Office&home-name=Holland%20Main&activation-mode=deactivate&authentication-token=${HC_TKN}" + sleep 5 + echo $'\t' "turning off iFi DAC using homecontrol" + open -g "homecontrol://x-callback-url/run-action?action-type=switch-device-status&item-type=device&item-name=DAC%20Stack&room-name=North%20Office&home-name=Holland%20Main&activation-mode=deactivate&authentication-token=${HC_TKN}" + sleep 5 + echo $'\t' "turning off South Office Lights using homecontrol" + echo $'\t\t' "Antler Hue" + open -g "homecontrol://x-callback-url/run-action?action-type=switch-device-status&item-type=device&item-name=Antler%20Hue&room-name=South%20Office&home-name=Holland%20Main&activation-mode=deactivate&authentication-token=${HC_TKN}" + sleep 5 + echo $'\t\t' "Hue Pole" + open -g "homecontrol://x-callback-url/run-action?action-type=switch-device-status&item-type=device&item-name=Hue%20Pole&room-name=South%20Office&home-name=Holland%20Main&activation-mode=deactivate&authentication-token=${HC_TKN}" + sleep 5 + echo $'\t\t' "Desk Play L" + open -g "homecontrol://x-callback-url/run-action?action-type=switch-device-status&item-type=device&item-name=Desk%20Play%20L&room-name=South%20Office&home-name=Holland%20Main&activation-mode=deactivate&authentication-token=${HC_TKN}" + sleep 5 + echo $'\t\t' "Desk Play R" + open -g "homecontrol://x-callback-url/run-action?action-type=switch-device-status&item-type=device&item-name=Desk%20Play%20R&room-name=South%20Office&home-name=Holland%20Main&activation-mode=deactivate&authentication-token=${HC_TKN}" +# sleep 5 +# echo $'\t' "turning off North Office Lights using homecontrol" +# echo $'\t\t' "Floor Lamp" +# open -g "homecontrol://x-callback-url/run-action?action-type=switch-device-status&item-type=device&item-name=Floor%20Lamp&room-name=North%20Office&home-name=Holland%20Main&activation-mode=deactivate&authentication-token=${HC_TKN}" +# sleep 5 +# echo $'\t\t' "Hue Go" +# open -g "homecontrol://x-callback-url/run-action?action-type=switch-device-status&item-type=device&item-name=Hue%20Go&room-name=North%20Office&home-name=Holland%20Main&activation-mode=deactivate&authentication-token=${HC_TKN}" + # open -g "homecontrol://x-callback-url/run-action?action-type=switch-device-status&item-type=device&item-name=PC%20Light%20Bars&room-name=North%20Office&home-name=Holland%20Main&activation-mode=deactivate&authentication-token=${HC_TKN}" + # open -g "homecontrol://x-callback-url/run-action?action-type=switch-device-status&item-type=device&item-name=North%20Office%20TV%20Bias&room-name=North%20Office&home-name=Holland%20Main&activation-mode=deactivate&authentication-token=${HC_TKN}" +# echo $'\t' "turning off Office Xmas Tree using homecontrol" + # open -g "homecontrol://x-callback-url/run-action?action-type=switch-device-status&item-type=device&item-name=Office%20Tree&room-name=South%20Office&home-name=Holland%20Main&activation-mode=deactivate&authentication-token=${HC_TKN}" + #echo $'\t' "^ TEMP DISABLED DUE TO NEW HOUSE/NO SETUP" + +fi + +echo -e "\n\n\n" +echo "** Assertions **" +echo "pmset -g assertions" +/usr/bin/pmset -g assertions + +echo -e "\n\n\n" +echo "** Screen Captures **" +DC=$(osascript ${SCRIPT_DIR}/displaycount.scpt) +counter=1 + +mvar=( ) +mkdir -p $HOME/ownCloud/Screen\ Shots/SleepShots +until [ $counter -gt ${DC} ] +do + ssf="${cname}-${dtst}-${counter}.png" + #echo "screencapture -D ${counter} ${ssf}" + screencapture -x -D ${counter} $HOME/Desktop/${ssf} + echo $'\t' "captured screen ${counter}, saved to ${ssf}" + mvar+=("${ssf}") + ((counter++)) +done + +for fn in "${mvar[@]}" +do + mv $HOME/Desktop/${fn} $HOME/ownCloud/Screen\ Shots/SleepShots/ +done + +echo -e "\n\n\n" +echo "** Quitting Applications **" + +prg=( "Zen Browser" "Opera" "Opera" "Opera" "Opera" "Opera" "MenubarX" "App Store" "WhatsApp" ".Agenda" "Steam" ".Loopback" ".Slack" "Boom 3D" "Paw" "DYMO Label" "QuickTime Player" "System Information" "Permute" "Activity Monitor" ".Transmit" ".Mail" ".Edison Mail" ".Airmail" "Setapp" ".Messages" "News" "zoom.us" "Preview" "Arq" "Carbon Copy Cloner" "Safari" "Vivaldi" "Firefox" "firefox" "Music" "Microsoft Edge" ".Parallels Desktop" ".Paw" ".Creative Cloud" "Things" ".Microsoft Word" ".Microsoft Excel" ".Microsoft PowerPoint" ".Xcode" "Simulator" "Audio Hijack" "Microsoft AutoUpdate" ".ToothFairy" "Creative Cloud" "Arc" "Brave Browser" "Safari Technology Preview" "YouTube" "SiriusXM" "Xcode.app" ".Xcode-beta" "Simulator" "Podcasts" "Microsoft Remote Desktop" "zen" "RustDesk") +#prg=( "Safari Technology Preview" ) +killprg=( "runningboardd" "Brave Browser" "Microsoft Edge" ) +for app in "${prg[@]}" +do + if [[ $app = .* ]] + then + skip="x" + else + # echo $'\t' "$app" + # timestamp + ts=`date +%T` + + #echo "$ts: begin checking..." + AID=$(ps -ef | grep "${app}" | grep -v `basename $0` | grep -v "grep" | wc -l) + #[[ $AID -eq 0 ]] && echo "$ts: $app not running" + + if [[ $AID -gt 0 ]] + then + RS=$(osascript ${SCRIPT_DIR}/quit-app.app "$app") + echo $'\t' ${RS} + if [[ $RS == *"QUIT"* ]]; then + killprg+=("${app}") + sleep 1 + fi + fi + fi +done + + +echo -e "\n\n\n" +echo "** Pause 10 secs **" + + +sleep 10 +echo -e "\n\n\n" +echo "** Force Quit (kill) Backup and Background Apps **" +killcnt=${#killprg[@]} +echo "...kill count: ${killcnt}" +if [[ $killcnt -gt 0 ]] +then + for app in "${killprg[@]}" + do + if [[ $app = .* ]] + then + sleep 1 + else + echo $'\t' "$app" + killall "${app}" + sleep 1 + fi + done +fi + +#echo -e "\n\n\n" +#echo "** pmset -g everything **" +#echo "pmset -g everything" +#/usr/bin/pmset -g everything + +# sudo defaults write /Library/Preferences/com.apple.mDNSResponder.plist NoMulticastAdvertisements -bool true +# sudo pmset disksleep 0 +# sudo pmset womp 0 +# sudo pmset powernap 0 +# sudo pmset ttyskeepawake 0 +# sudo pmset tcpkeepalive 1 +# sudo pmset schedule cancelall +# sudo pmset repeat cancel +# sudo chflags schg /Library/Preferences/SystemConfiguration/com.apple.AutoWake.plist +# sudo mkdir -p /Library/Preferences/FeatureFlags/Domain +# sudo cp /System/Library/FeatureFlags/Domain/powerd.plist /Library/Preferences/FeatureFlags/Domain +# sudo nano /Library/Preferences/FeatureFlags/Domain/powerd.plist +# replace to +# reboot + +# Make sure AutoWake file is not writeable +# sudo chflags schg /Library/Preferences/SystemConfiguration/com.apple.AutoWake.plist + +echo -e "\n\n\n" +echo "** Adjust Sleep Settings to Avoid Wakes **" +echo "* pmset settings" +echo "sudo -S pmset schedule cancelall" +# more /etc/sudoers.d/shughey +# shughey ALL=(ALL) NOPASSWD: /usr/bin/pmset +sudo -S pmset schedule cancelall +sudo pmset repeat cancel +# echo "sudo pmset -a hibernatemode 0" +# sudo pmset -a hibernatemode 0 +echo "sudo pmset -a autopoweroff 0" +sudo pmset -a autopoweroff 0 +echo "sudo pmset -a standby 0" +sudo pmset -a standby 0 +#echo "sudo pmset -a tcpkeepalive 0" +# trying to get back MultiCast - 23-Mar-2025 +echo "sudo pmset -a tcpkeepalive 0" +sudo pmset -a tcpkeepalive 0 +echo "sudo pmset -a powernap 0" +sudo pmset -a powernap 0 + +# trying to get back MultiCast - 23-Mar-2025 + + +#echo "sudo pmset -a tcpkeepalive 1" +#sudo pmset -a tcpkeepalive 1 +#sudo pmset disksleep 30 +# must add defaults to sudoers.d +#sudo defaults write /Library/Preferences/com.apple.mDNSResponder.plist NoMulticastAdvertisements -bool false +# export MACHINE=Angus; dns-sd -R ${MACHINE}.local _device-info._tcp local 0 +# dns-sd -q ${MACHINE}.local + \ No newline at end of file diff --git a/proxtun b/proxtun new file mode 100755 index 0000000..627eadf --- /dev/null +++ b/proxtun @@ -0,0 +1,7 @@ +#!/bin/sh +#ssh -p 5963 -C2TnNv -D 8050 -i ~/svn/d27n/ec2/id_rsa-gsg-keypair ubuntu@d27n.com +#Proxy +ssh -p 5963 -f -C -q -N -D 8151 -i ~/svn/d27n/ec2/id_rsa-gsg-keypair ubuntu@d27n.com +#Tunnel +#ssh -p 5963 localhost:8152:d27n.com:5963 -i ~/svn/d27n/ec2/id_rsa-gsg-keypair ubuntu@d27n.com +#ssh -p 5963 -Cv -D 8050 -i ~/svn/d27n/ec2/id_rsa-gsg-keypair ubuntu@d27n.com diff --git a/quit-app.app/Contents/Info.plist b/quit-app.app/Contents/Info.plist new file mode 100644 index 0000000..563fc6e --- /dev/null +++ b/quit-app.app/Contents/Info.plist @@ -0,0 +1,76 @@ + + + + + CFBundleAllowMixedLocalizations + + CFBundleDevelopmentRegion + en + CFBundleExecutable + applet + CFBundleIconFile + applet + CFBundleIdentifier + com.apple.ScriptEditor.id.quit-app + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + quit-app + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + aplt + LSMinimumSystemVersionByArchitecture + + x86_64 + 10.6 + + LSRequiresCarbon + + NSAppleEventsUsageDescription + This script needs to control other applications to run. + NSAppleMusicUsageDescription + This script needs access to your music to run. + NSCalendarsUsageDescription + This script needs access to your calendars to run. + NSCameraUsageDescription + This script needs access to your camera to run. + NSContactsUsageDescription + This script needs access to your contacts to run. + NSHomeKitUsageDescription + This script needs access to your HomeKit Home to run. + NSMicrophoneUsageDescription + This script needs access to your microphone to run. + NSPhotoLibraryUsageDescription + This script needs access to your photos to run. + NSRemindersUsageDescription + This script needs access to your reminders to run. + NSSiriUsageDescription + This script needs access to Siri to run. + NSSystemAdministrationUsageDescription + This script needs access to administer this system to run. + OSAAppletShowStartupScreen + + WindowState + + bundleDividerCollapsed + + bundlePositionOfDivider + 0.0 + dividerCollapsed + + eventLogLevel + 2 + name + ScriptWindowState + positionOfDivider + 371 + savedFrame + 2226 330 700 678 0 0 3008 1667 + selectedTab + description + + + diff --git a/quit-app.app/Contents/MacOS/applet b/quit-app.app/Contents/MacOS/applet new file mode 100755 index 0000000..4807ba3 Binary files /dev/null and b/quit-app.app/Contents/MacOS/applet differ diff --git a/quit-app.app/Contents/PkgInfo b/quit-app.app/Contents/PkgInfo new file mode 100644 index 0000000..3253614 --- /dev/null +++ b/quit-app.app/Contents/PkgInfo @@ -0,0 +1 @@ +APPLaplt \ No newline at end of file diff --git a/quit-app.app/Contents/Resources/Scripts/main (Callum.local's conflicted copy 2025-02-03).scpt b/quit-app.app/Contents/Resources/Scripts/main (Callum.local's conflicted copy 2025-02-03).scpt new file mode 100644 index 0000000..e9be786 Binary files /dev/null and b/quit-app.app/Contents/Resources/Scripts/main (Callum.local's conflicted copy 2025-02-03).scpt differ diff --git a/quit-app.app/Contents/Resources/Scripts/main (Steve’s MacBook Pro's conflicted copy 2025-07-18).scpt b/quit-app.app/Contents/Resources/Scripts/main (Steve’s MacBook Pro's conflicted copy 2025-07-18).scpt new file mode 100644 index 0000000..4c72b0b Binary files /dev/null and b/quit-app.app/Contents/Resources/Scripts/main (Steve’s MacBook Pro's conflicted copy 2025-07-18).scpt differ diff --git a/quit-app.app/Contents/Resources/Scripts/main (Steve’s MacBook Pro's conflicted copy 2025-07-28).scpt b/quit-app.app/Contents/Resources/Scripts/main (Steve’s MacBook Pro's conflicted copy 2025-07-28).scpt new file mode 100644 index 0000000..4c72b0b Binary files /dev/null and b/quit-app.app/Contents/Resources/Scripts/main (Steve’s MacBook Pro's conflicted copy 2025-07-28).scpt differ diff --git a/quit-app.app/Contents/Resources/Scripts/main (Steve’s MacBook Pro's conflicted copy 2025-08-25).scpt b/quit-app.app/Contents/Resources/Scripts/main (Steve’s MacBook Pro's conflicted copy 2025-08-25).scpt new file mode 100644 index 0000000..4c72b0b Binary files /dev/null and b/quit-app.app/Contents/Resources/Scripts/main (Steve’s MacBook Pro's conflicted copy 2025-08-25).scpt differ diff --git a/quit-app.app/Contents/Resources/Scripts/main.scpt b/quit-app.app/Contents/Resources/Scripts/main.scpt new file mode 100644 index 0000000..1789024 Binary files /dev/null and b/quit-app.app/Contents/Resources/Scripts/main.scpt differ diff --git a/quit-app.app/Contents/Resources/applet.icns b/quit-app.app/Contents/Resources/applet.icns new file mode 100644 index 0000000..0cdd170 Binary files /dev/null and b/quit-app.app/Contents/Resources/applet.icns differ diff --git a/quit-app.app/Contents/Resources/applet.rsrc b/quit-app.app/Contents/Resources/applet.rsrc new file mode 100644 index 0000000..79c0de2 Binary files /dev/null and b/quit-app.app/Contents/Resources/applet.rsrc differ diff --git a/quit-app.scpt b/quit-app.scpt new file mode 100644 index 0000000..c0b3da1 Binary files /dev/null and b/quit-app.scpt differ diff --git a/quit_browsers b/quit_browsers new file mode 100755 index 0000000..73a42b8 --- /dev/null +++ b/quit_browsers @@ -0,0 +1,28 @@ +#!/bin/sh +export PATH=$PATH:/usr/bin/local +python3 $HOME/Dropbox/bin/send_quitbrowsers_mail3.py +#sleep 10 +#/usr/bin/osascript -e 'quit app "Safari"' +#sleep 2 +#/usr/bin/osascript -e 'quit app "Vivaldi"' +#sleep 2 +#/usr/bin/osascript -e 'quit app "Slack"' +#sleep 2 +#/usr/bin/osascript -e 'quit app "Music"' +#sleep 2 +#/usr/bin/osascript -e 'quit app "Microsoft Edge"' +prg=( "Safari" "Vivaldi" "Slack" "Music" "Microsoft Edge" "Parallels Desktop" "Paw" "Creative Cloud") +for app in "${prg[@]}" +do + echo "Quitting $app" + /usr/bin/osascript -e 'quit app "$app"' + sleep 2 +done +sleep 10 +echo "Using killall to backup" +for app in "${prg[@]}" +do + echo "killall $app" + killall "$app" + sleep 2 +done diff --git a/rsync2mini.sh b/rsync2mini.sh new file mode 100755 index 0000000..d0002f5 --- /dev/null +++ b/rsync2mini.sh @@ -0,0 +1,33 @@ +#!/bin/sh +# +# *** REMEMBER TO ADD SSH KEY *** +# *** ADD /usr/sbin/cron TO FULL DISK ACCESS *** +# + +# Add the paths needed +PATH=/usr/local/bin:/usr/local/sbin:~/bin:/usr/bin:/bin:/usr/sbin:/sbin +# Disable mail alerts +MAILTO="" + +cd /Users/shughey/Dropbox/schmeeve-macos-tools + +# This solves the "Permission denied, please try again." error +# Where ssh-agent is running, for password-less access to the key +export SSH_AUTH_SOCK=$( ls /private/tmp/com.apple.launchd.*/Listeners ) + +# Print the time for logging purposes +now=$(date) +echo "Running backup now : $now" + +# Run the rsync +rsync -vrau --delete -e "ssh -p 22" \ +/Volumes/Katya/Users/shughey/motiv8 \ +schmeeve@mini.nas:/mnt/miniNas/miniShare1/Projects/ \ +--progress --stats \ +--exclude="Library" \ +--exclude="Library/*" \ +--exclude=".Trash" \ +--exclude=".Trash/*" + +# Print a blank line for logging purposes +echo "" \ No newline at end of file diff --git a/sendSuperDuperCompleteEmail b/sendSuperDuperCompleteEmail new file mode 100755 index 0000000..bcbb447 --- /dev/null +++ b/sendSuperDuperCompleteEmail @@ -0,0 +1,7 @@ +#!/bin/sh +#echo "Go-Sharks has completed backup of Krieger using SuperDuper" | mailx -v -s "SuperDuper Backup of Krieger Complete" -S smtp="emailz.d27n.com:587" -S smtp-use-starttls -S smtp-auth=login -S smtp-auth-user="steve@d27n.com" -S smtp-auth-password="$$azpts" -S ssl-verify=true steve@d27n.com +cd /tmp +echo "Go-Sharks has completed backup of Krieger using SuperDuper" > swaks-tmp +/usr/local/bin/swaks --to "steve-notify@d27n.com" --from "steve@d27n.com" --server emailz.d27n.com --port 587 --auth LOGIN --auth-user "steve@d27n.com" --auth-password "L2sC7JikwX" -tls --body swaks-tmp --header "Subject: == Go-Sharks Backup Complete ==" +rm swaks-tmp + diff --git a/send_quitbrowsers_mail.py b/send_quitbrowsers_mail.py new file mode 100755 index 0000000..48fd030 --- /dev/null +++ b/send_quitbrowsers_mail.py @@ -0,0 +1,38 @@ +# Settings + +SMTP_SERVER = 'emailz.d27n.com' +SMTP_PORT = 587 +SMTP_USERNAME = 'steve@d27n.com' +SMTP_PASSWORD = 'L2sC7JikwX' +SMTP_FROM = 'angus@d27n.com' +SMTP_TO = 'steve@d27n.com' + +SUBJECT = '[Angus] Token Saver Activated!' +TEXT_FILENAME = '/script/output/my_attachment.txt' +MESSAGE = """Stop being a useless drunk. +""" + +# Now construct the message +import smtplib, email +from email import encoders +import os + +msg = email.MIMEMultipart.MIMEMultipart() +body = email.MIMEText.MIMEText(MESSAGE) +attachment = email.MIMEBase.MIMEBase('text', 'plain') +#attachment.set_payload(open(TEXT_FILENAME).read()) +#attachment.add_header('Content-Disposition', 'attachment', filename=os.path.basename(TEXT_FILENAME)) +encoders.encode_base64(attachment) +msg.attach(body) +msg.attach(attachment) +msg.add_header('From', SMTP_FROM) +msg.add_header('To', SMTP_TO) +msg.add_header('Subject', SUBJECT) + +# Now send the message +mailer = smtplib.SMTP(SMTP_SERVER, SMTP_PORT) +# EDIT: mailer is already connected +# mailer.connect() +mailer.login(SMTP_USERNAME, SMTP_PASSWORD) +mailer.sendmail(SMTP_FROM, [SMTP_TO], msg.as_string()) +mailer.close() diff --git a/send_quitbrowsers_mail3.py b/send_quitbrowsers_mail3.py new file mode 100755 index 0000000..348f32b --- /dev/null +++ b/send_quitbrowsers_mail3.py @@ -0,0 +1,59 @@ +# Settings + +SMTP_SERVER = 'emailz.d27n.com' +SMTP_PORT = 587 +SMTP_USERNAME = 'steve@d27n.com' +SMTP_PASSWORD = 'L2sC7JikwX' +SMTP_FROM = 'angus@d27n.com' +SMTP_TO = 'steve@d27n.com' + +SUBJECT = '[Angus] Token Saver Activated!' +TEXT_FILENAME = '/script/output/my_attachment.txt' +MESSAGE = """Stop being a useless drunk. +""" + +# Now construct the message +import smtplib, email +from email.mime.multipart import MIMEMultipart +from email.mime.text import MIMEText +from email.mime.base import MIMEBase +from email import encoders + +#msg = email.MIMEMultipart.MIMEMultipart() +#body = email.MIMEText.MIMEText(data) +#attachment = email.MIMEBase.MIMEBase('text', 'plain') +#attachment.set_payload(open(TEXT_FILENAME).read()) +#attachment.add_header('Content-Disposition', 'attachment', filename=os.path.basename(TEXT_FILENAME)) +#encoders.encode_base64(attachment) +#msg.attach(body) +#msg.attach(attachment) +#msg.add_header('From', SMTP_FROM) +#msg.add_header('To', SMTP_TO) +#msg.add_header('Subject', SUBJECT) + +# Now send the message +#mailer = smtplib.SMTP(SMTP_SERVER, SMTP_PORT) +# EDIT: mailer is already connected +# mailer.connect() +#mailer.login(SMTP_USERNAME, SMTP_PASSWORD) +#mailer.sendmail(SMTP_FROM, [SMTP_TO], msg.as_string()) +#mailer.close() + +#creating the SMTP server object by giving SMPT server address and port number +smtp_server=smtplib.SMTP(SMTP_SERVER, SMTP_PORT) +smtp_server.ehlo() #setting the ESMTP protocol +#smtp_server.starttls() #setting up to TLS connection +#smtp_server.ehlo() #calling the ehlo() again as encryption happens on calling startttls() +smtp_server.login(SMTP_USERNAME, SMTP_PASSWORD) #logging into out email id + +msg_to_be_sent = MESSAGE + +message = MIMEMultipart() +message['From'] = SMTP_FROM +message['To'] = SMTP_TO +message['Subject'] = SUBJECT +message.attach(MIMEText(msg_to_be_sent, 'plain')) + +#sending the mail by specifying the from and to address and the message +smtp_server.sendmail( SMTP_FROM, SMTP_TO, message.as_string()) +smtp_server.quit() #terminating the server \ No newline at end of file diff --git a/send_sleep_email.sh b/send_sleep_email.sh new file mode 100755 index 0000000..f9db10d --- /dev/null +++ b/send_sleep_email.sh @@ -0,0 +1,3 @@ +#/bin/bash +export HOSTNAME=`hostname` +echo "Goodnight!\n" | mail -s "[$HOSTNAME] Going to sleep" -S smtp="emailz.d27n.com:587" -S smtp-use-starttls -S smtp-auth=login -S smtp-auth-user="steve@d27n.com" -S smtp-auth-password="L2sC7JikwX" -S ssl-verify=ignore steve@d27n.com diff --git a/send_sleep_mail.py b/send_sleep_mail.py new file mode 100644 index 0000000..dabdcfc --- /dev/null +++ b/send_sleep_mail.py @@ -0,0 +1,41 @@ +# Settings +import platform +PNODE = platform.node() +CNAME = PNODE.replace('.local', '') + +SMTP_SERVER = 'emailz.d27n.com' +SMTP_PORT = 587 +SMTP_USERNAME = 'steve@d27n.com' +SMTP_PASSWORD = 'L2sC7JikwX' +SMTP_FROM = '' + CNAME + '@d27n.com' +SMTP_TO = 'steve@d27n.com' + +SUBJECT = '[' + CNAME + '] Going to Sleep!' +TEXT_FILENAME = '/script/output/my_attachment.txt' +MESSAGE = """Goodnight! +""" + +# Now construct the message +import smtplib, email +from email import encoders +import os + +msg = email.MIMEMultipart.MIMEMultipart() +body = email.MIMEText.MIMEText(MESSAGE) +attachment = email.MIMEBase.MIMEBase('text', 'plain') +#attachment.set_payload(open(TEXT_FILENAME).read()) +#attachment.add_header('Content-Disposition', 'attachment', filename=os.path.basename(TEXT_FILENAME)) +encoders.encode_base64(attachment) +msg.attach(body) +msg.attach(attachment) +msg.add_header('From', SMTP_FROM) +msg.add_header('To', SMTP_TO) +msg.add_header('Subject', SUBJECT) + +# Now send the message +mailer = smtplib.SMTP(SMTP_SERVER, SMTP_PORT) +# EDIT: mailer is already connected +# mailer.connect() +mailer.login(SMTP_USERNAME, SMTP_PASSWORD) +mailer.sendmail(SMTP_FROM, [SMTP_TO], msg.as_string()) +mailer.close() diff --git a/send_sleep_mail3.py b/send_sleep_mail3.py new file mode 100644 index 0000000..d7cb67b --- /dev/null +++ b/send_sleep_mail3.py @@ -0,0 +1,64 @@ +# Settings +import platform +PNODE = platform.node() +CNAME = PNODE.replace('.local', '') + +SMTP_SERVER = 'emailz.d27n.com' +SMTP_PORT = 587 +SMTP_USERNAME = 'steve@d27n.com' +SMTP_PASSWORD = 'L2sC7JikwX' +SMTP_FROM = '' + CNAME + '@d27n.com' +SMTP_TO = 'steve@d27n.com' + +SUBJECT = '[' + CNAME + '] Going to Sleep!' +TEXT_FILENAME = '/script/output/my_attachment.txt' +MESSAGE = """Goodnight! +""" + +# Now construct the message +import smtplib, email +from email.mime.multipart import MIMEMultipart +from email.mime.text import MIMEText +from email.mime.base import MIMEBase +from email import encoders + +#msg = email.MIMEMultipart.MIMEMultipart() +#body = email.MIMEText.MIMEText(data) +#attachment = email.MIMEBase.MIMEBase('text', 'plain') +#attachment.set_payload(open(TEXT_FILENAME).read()) +#attachment.add_header('Content-Disposition', 'attachment', filename=os.path.basename(TEXT_FILENAME)) +#encoders.encode_base64(attachment) +#msg.attach(body) +#msg.attach(attachment) +#msg.add_header('From', SMTP_FROM) +#msg.add_header('To', SMTP_TO) +#msg.add_header('Subject', SUBJECT) + +# Now send the message +#mailer = smtplib.SMTP(SMTP_SERVER, SMTP_PORT) +# EDIT: mailer is already connected +# mailer.connect() +#mailer.login(SMTP_USERNAME, SMTP_PASSWORD) +#mailer.sendmail(SMTP_FROM, [SMTP_TO], msg.as_string()) +#mailer.close() + +#creating the SMTP server object by giving SMPT server address and port number +smtp_server=smtplib.SMTP(SMTP_SERVER, SMTP_PORT) +smtp_server.ehlo() #setting the ESMTP protocol +#smtp_server.starttls() #setting up to TLS connection +#smtp_server.ehlo() #calling the ehlo() again as encryption happens on calling startttls() +smtp_server.login(SMTP_USERNAME, SMTP_PASSWORD) #logging into out email id + +msg_to_be_sent = MESSAGE # comment out next line to use embedded body +#msg_to_be_sent = data + + +message = MIMEMultipart() +message['From'] = SMTP_FROM +message['To'] = SMTP_TO +message['Subject'] = SUBJECT +message.attach(MIMEText(msg_to_be_sent, 'plain')) + +#sending the mail by specifying the from and to address and the message +smtp_server.sendmail( SMTP_FROM, SMTP_TO, message.as_string()) +smtp_server.quit() #terminating the server \ No newline at end of file diff --git a/send_status_mail.py b/send_status_mail.py new file mode 100644 index 0000000..043f7cc --- /dev/null +++ b/send_status_mail.py @@ -0,0 +1,52 @@ +# Settings +import platform, os + +PNODE = platform.node() +CNAME = PNODE.replace('.local', '') + +SMTP_SERVER = 'emailz.d27n.com' +SMTP_PORT = 587 +SMTP_USERNAME = 'steve@d27n.com' +SMTP_PASSWORD = 'L2sC7JikwX' +SMTP_FROM = '' + CNAME + '@d27n.com' +SMTP_TO = 'steve@d27n.com' + +SUBJ = os.getenv('ESUBJ') +if not SUBJ: + SUBJ = "Status Notification" +SUBJECT = '[' + CNAME + '] ' + SUBJ; +TEXT_FILENAME = '/script/output/my_attachment.txt' +MESSAGE = """Status +""" + +with open ('/tmp/statusmail.txt', 'r') as file: + data = file.read() + +#from pathlib import Path +#txt = Path('data.txt').read_text() + + +# Now construct the message +import smtplib, email +from email import encoders +import os + +msg = email.MIMEMultipart.MIMEMultipart() +body = email.MIMEText.MIMEText(data) +attachment = email.MIMEBase.MIMEBase('text', 'plain') +#attachment.set_payload(open(TEXT_FILENAME).read()) +#attachment.add_header('Content-Disposition', 'attachment', filename=os.path.basename(TEXT_FILENAME)) +encoders.encode_base64(attachment) +msg.attach(body) +msg.attach(attachment) +msg.add_header('From', SMTP_FROM) +msg.add_header('To', SMTP_TO) +msg.add_header('Subject', SUBJECT) + +# Now send the message +mailer = smtplib.SMTP(SMTP_SERVER, SMTP_PORT) +# EDIT: mailer is already connected +# mailer.connect() +mailer.login(SMTP_USERNAME, SMTP_PASSWORD) +mailer.sendmail(SMTP_FROM, [SMTP_TO], msg.as_string()) +mailer.close() diff --git a/send_status_mail3.py b/send_status_mail3.py new file mode 100644 index 0000000..658a02b --- /dev/null +++ b/send_status_mail3.py @@ -0,0 +1,82 @@ +# Settings +import platform, os + + +PNODE = platform.node() +CNAME = PNODE.replace('.local', '') + +SMTP_SERVER = 'emailz.d27n.com' +SMTP_PORT = 587 +SMTP_USERNAME = 'steve@d27n.com' +SMTP_PASSWORD = 'L2sC7JikwX' +SMTP_FROM = '' + CNAME + '@d27n.com' +SMTP_TO = 'steve@d27n.com' + +SUBJ = os.getenv('ESUBJ') +if not SUBJ: + SUBJ = "Status Notification" +SUBJECT = '[' + CNAME + '] ' + SUBJ; +TEXT_FILENAME = '/script/output/my_attachment.txt' +MESSAGE = """Status +""" + +with open ('/tmp/statusmail.txt', 'r') as file: + data = file.read() + +#from pathlib import Path +#txt = Path('data.txt').read_text() + + +# Now construct the message +import smtplib, email +from email.mime.multipart import MIMEMultipart +from email.mime.text import MIMEText +from email.mime.base import MIMEBase +from email import encoders + +#msg = email.MIMEMultipart.MIMEMultipart() +#body = email.MIMEText.MIMEText(data) +#attachment = email.MIMEBase.MIMEBase('text', 'plain') +#attachment.set_payload(open(TEXT_FILENAME).read()) +#attachment.add_header('Content-Disposition', 'attachment', filename=os.path.basename(TEXT_FILENAME)) +#encoders.encode_base64(attachment) +#msg.attach(body) +#msg.attach(attachment) +#msg.add_header('From', SMTP_FROM) +#msg.add_header('To', SMTP_TO) +#msg.add_header('Subject', SUBJECT) + +# Now send the message +#mailer = smtplib.SMTP(SMTP_SERVER, SMTP_PORT) +# EDIT: mailer is already connected +# mailer.connect() +#mailer.login(SMTP_USERNAME, SMTP_PASSWORD) +#mailer.sendmail(SMTP_FROM, [SMTP_TO], msg.as_string()) +#mailer.close() + +#creating the SMTP server object by giving SMPT server address and port number +smtp_server=smtplib.SMTP(SMTP_SERVER, SMTP_PORT) +smtp_server.ehlo() #setting the ESMTP protocol +#smtp_server.starttls() #setting up to TLS connection +#smtp_server.ehlo() #calling the ehlo() again as encryption happens on calling startttls() +smtp_server.login(SMTP_USERNAME, SMTP_PASSWORD) #logging into out email id + +msg_to_be_sent = MESSAGE # comment out next line to use embedded body +msg_to_be_sent = '

' + data + ''
+
+
+message = MIMEMultipart("alternative")
+message['From'] = SMTP_FROM
+message['To'] = SMTP_TO
+message['Subject'] = SUBJECT
+#f = data.find("[st]")
+#part1 = MIMEText(data[f+4:], "plain")
+part1 = MIMEText(data, "plain")
+part2 = MIMEText(msg_to_be_sent, "html")
+message.attach(part1)
+message.attach(part2)
+
+
+#sending the mail by specifying the from and to address and the message 
+smtp_server.sendmail( SMTP_FROM, SMTP_TO, message.as_string())
+smtp_server.quit() #terminating the server
\ No newline at end of file
diff --git a/send_wake_email.sh b/send_wake_email.sh
new file mode 100755
index 0000000..72d9904
--- /dev/null
+++ b/send_wake_email.sh
@@ -0,0 +1,4 @@
+#/bin/bash
+export HOSTNAME=`hostname`
+log show --style syslog --last 1h | fgrep "Wake reason" > /tmp/wakereasons.txt
+mail -s "[$HOSTNAME] Wake Reasons 1h" smtp="emailz.d27n.com:587" -S smtp-use-starttls -S smtp-auth=login -S smtp-auth-user="steve@d27n.com" -S smtp-auth-password="L2sC7JikwX" -S ssl-verify=ignore steve@d27n.com < /tmp/wakereasons.txt
diff --git a/send_wake_mail.py b/send_wake_mail.py
new file mode 100644
index 0000000..0dd3c6f
--- /dev/null
+++ b/send_wake_mail.py
@@ -0,0 +1,53 @@
+# Settings
+import platform, os
+PNODE = platform.node()
+CNAME = PNODE.replace('.local', '')
+
+SMTP_SERVER = 'emailz.d27n.com'
+SMTP_PORT = 587
+SMTP_USERNAME = 'steve@d27n.com'
+SMTP_PASSWORD = 'L2sC7JikwX'
+SMTP_FROM = '' + CNAME + '@d27n.com'
+SMTP_TO = 'steve@d27n.com'
+
+SUBJ = os.getenv('ESUBJ')
+if not SUBJ:
+    SUBJ = "Wake Event"
+SUBJECT = '[' + CNAME + '] '  + SUBJ;
+
+TEXT_FILENAME = '/script/output/my_attachment.txt'
+MESSAGE = """Wake Up!
+"""
+
+with open ('/tmp/wakereasons.txt', 'r') as file:
+    data = file.read()
+
+#from pathlib import Path
+#txt = Path('data.txt').read_text()
+
+
+# Now construct the message
+import smtplib, email
+from email import encoders
+import os
+
+
+msg = email.MIMEMultipart.MIMEMultipart()
+body = email.MIMEText.MIMEText(data)
+attachment = email.MIMEBase.MIMEBase('text', 'plain')
+#attachment.set_payload(open(TEXT_FILENAME).read())
+#attachment.add_header('Content-Disposition', 'attachment', filename=os.path.basename(TEXT_FILENAME))
+encoders.encode_base64(attachment)
+msg.attach(body)
+msg.attach(attachment)
+msg.add_header('From', SMTP_FROM)
+msg.add_header('To', SMTP_TO)
+msg.add_header('Subject', SUBJECT)
+
+# Now send the message
+mailer = smtplib.SMTP(SMTP_SERVER, SMTP_PORT)
+# EDIT: mailer is already connected
+# mailer.connect()
+mailer.login(SMTP_USERNAME, SMTP_PASSWORD)
+mailer.sendmail(SMTP_FROM, [SMTP_TO], msg.as_string())
+mailer.close()
diff --git a/send_wake_mail3.py b/send_wake_mail3.py
new file mode 100644
index 0000000..a173eff
--- /dev/null
+++ b/send_wake_mail3.py
@@ -0,0 +1,82 @@
+# Settings
+import platform, os
+PNODE = platform.node()
+CNAME = PNODE.replace('.local', '')
+
+SMTP_SERVER = 'emailz.d27n.com'
+SMTP_PORT = 587
+SMTP_USERNAME = 'steve@d27n.com'
+SMTP_PASSWORD = 'L2sC7JikwX'
+SMTP_FROM = '' + CNAME + '@d27n.com'
+SMTP_TO = 'steve@d27n.com'
+
+SUBJ = os.getenv('ESUBJ')
+if not SUBJ:
+    SUBJ = "Wake Event"
+SUBJECT = '[' + CNAME + '] '  + SUBJ;
+
+TEXT_FILENAME = '/script/output/my_attachment.txt'
+MESSAGE = """Wake Up!
+"""
+
+with open ('/tmp/wakereasons.txt', 'r') as file:
+    data = file.read()
+
+#from pathlib import Path
+#txt = Path('data.txt').read_text()
+
+
+# Now construct the message
+import smtplib, email
+from email.mime.multipart import MIMEMultipart
+from email.mime.text import MIMEText
+from email.mime.base import MIMEBase
+from email import encoders
+
+#msg = email.MIMEMultipart.MIMEMultipart()
+#body = email.MIMEText.MIMEText(data)
+#attachment = email.MIMEBase.MIMEBase('text', 'plain')
+#attachment.set_payload(open(TEXT_FILENAME).read())
+#attachment.add_header('Content-Disposition', 'attachment', filename=os.path.basename(TEXT_FILENAME))
+#encoders.encode_base64(attachment)
+#msg.attach(body)
+#msg.attach(attachment)
+#msg.add_header('From', SMTP_FROM)
+#msg.add_header('To', SMTP_TO)
+#msg.add_header('Subject', SUBJECT)
+
+# Now send the message
+#mailer = smtplib.SMTP(SMTP_SERVER, SMTP_PORT)
+# EDIT: mailer is already connected
+# mailer.connect()
+#mailer.login(SMTP_USERNAME, SMTP_PASSWORD)
+#mailer.sendmail(SMTP_FROM, [SMTP_TO], msg.as_string())
+#mailer.close()
+
+#creating the SMTP server object by giving SMPT server address and port number
+smtp_server=smtplib.SMTP(SMTP_SERVER, SMTP_PORT)
+smtp_server.ehlo() #setting the ESMTP protocol
+#smtp_server.starttls() #setting up to TLS connection
+#smtp_server.ehlo() #calling the ehlo() again as encryption happens on calling startttls()
+smtp_server.login(SMTP_USERNAME, SMTP_PASSWORD) #logging into out email id
+
+msg_to_be_sent = MESSAGE # comment out next line to use embedded body
+msg_to_be_sent = '
' + data + ''
+
+
+message = MIMEMultipart("alternative")
+message['From'] = SMTP_FROM
+message['To'] = SMTP_TO
+message['Subject'] = SUBJECT
+#f = data.find("[st]")
+#part1 = MIMEText(data[f+4:], "plain")
+part1 = MIMEText(data, "plain")
+part2 = MIMEText(msg_to_be_sent, "html")
+message.attach(part1)
+message.attach(part2)
+#message.set_payload(msg_to_be_sent)
+# message.attach(MIMEText(msg_to_be_sent, 'plain'))
+
+#sending the mail by specifying the from and to address and the message 
+smtp_server.sendmail( SMTP_FROM, SMTP_TO, message.as_string())
+smtp_server.quit() #terminating the server
\ No newline at end of file
diff --git a/shutdown_safe b/shutdown_safe
new file mode 100755
index 0000000..b5ffa6e
--- /dev/null
+++ b/shutdown_safe
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+OUTPUT='/tmp/statusmail.txt'
+TIMEINT='2h'
+START="$(date +%s)"
+echo "" > ${OUTPUT}
+log show --style syslog --last ${TIMEINT} | fgrep "Wake reason" | fgrep "Maintenance" >> ${OUTPUT2}
+lines=`cat ${OUTPUT2} | grep -c '^'`
+DURATION=$[ $(date +%s) - ${START} ]
+echo "----| Shut Down Report |----" >> ${OUTPUT}
+echo "" >> ${OUTPUT}
+  echo "Occurances: $lines" >> ${OUTPUT}
+  echo "Duration: ${DURATION}" >> ${OUTPUT}
+  echo "Time Interval: ${TIMEINT}" >> ${OUTPUT}
+  echo "------------------------------------------------------------------" >> ${OUTPUT}
+  echo "" >> ${OUTPUT}
+  echo "" >> ${OUTPUT}
+  echo "" >> ${OUTPUT}
+  echo "" >> ${OUTPUT}
+  echo "------------------------------------------------------------------" >> ${OUTPUT}
+  /usr/bin/python3 /Users/shughey/Dropbox/bin/send_status_mail3.py
+rm ${OUTPUT}
+osascript -e 'tell app "System Events" to shut down'
diff --git a/sleep b/sleep
new file mode 100755
index 0000000..92a39c2
--- /dev/null
+++ b/sleep
@@ -0,0 +1,74 @@
+#!/bin/bash
+
+OUTPUT='/tmp/statusmail.txt'
+SDATE=`date +"%l:%M %p" | tr '[:upper:]' '[:lower:]'`
+START="$(date +%s)"
+FULLDATE="$(date)"
+ESUBJ="${KMINFO_MacroName} @ ${SDATE}"
+export ESUBJ
+cname=`scutil --get ComputerName`
+script=`basename $0`
+dnqf=/tmp/caffeinate-do-not-quit.txt
+
+echo "// idlecheck" > ${OUTPUT}
+echo "  " `date` >> ${OUTPUT}
+echo "   machine: ${cname}" >> ${OUTPUT}
+echo "   script: ${script}" >> ${OUTPUT}
+echo "  " `/usr/bin/sw_vers` >> ${OUTPUT}
+echo "  " `sysctl kern.version` >> ${OUTPUT}
+echo "  " `sysctl kern.ostype` >> ${OUTPUT}
+echo "  " `sysctl kern.osrelease` >> ${OUTPUT}
+echo "  " `sysctl kern.osrevision` >> ${OUTPUT}
+echo "" >> ${OUTPUT}
+
+/bin/bash ${HOME}/Dropbox/bin/idlecheck_caffeinatestuck >> ${OUTPUT}
+caffeinates=`cat ${dnqf} | wc -l`
+#echo ${dnqf}
+#echo ${caffeinates}
+#exit
+
+echo "" >> ${OUTPUT}
+echo "" >> ${OUTPUT}
+echo "" >> ${OUTPUT}
+if [[ ${caffeinates} -gt 0 ]]; then
+  echo " █████                                  " >> ${OUTPUT}
+  echo "░░███                                   " >> ${OUTPUT}
+  echo " ░███████  █████ ████  █████  █████ ████" >> ${OUTPUT}
+  echo " ░███░░███░░███ ░███  ███░░  ░░███ ░███ " >> ${OUTPUT}
+  echo " ░███ ░███ ░███ ░███ ░░█████  ░███ ░███ " >> ${OUTPUT}
+  echo " ░███ ░███ ░███ ░███  ░░░░███ ░███ ░███ " >> ${OUTPUT}
+  echo " ████████  ░░████████ ██████  ░░███████ " >> ${OUTPUT}
+  echo "░░░░░░░░    ░░░░░░░░ ░░░░░░    ░░░░░███ " >> ${OUTPUT}
+  echo "                               ███ ░███ " >> ${OUTPUT}
+  echo "                              ░░██████  " >> ${OUTPUT}
+  echo "                               ░░░░░░   " >> ${OUTPUT}
+  ESUBJ="can't sleep, busy @ ${SDATE}"
+  export ESUBJ
+  echo "" >> ${OUTPUT}
+  echo "// some processes preventing sleep:" >> ${OUTPUT}
+  echo "" >> ${OUTPUT}
+  cat ${dnqf} >> ${OUTPUT}
+  /usr/bin/python3 /Users/shughey/Dropbox/bin/send_status_mail3.py
+else
+  echo "         ████                              ███" >> ${OUTPUT}
+  echo "        ░░███                             ░███" >> ${OUTPUT}
+  echo "  █████  ░███   ██████   ██████  ████████ ░███" >> ${OUTPUT}
+  echo " ███░░   ░███  ███░░███ ███░░███░░███░░███░███" >> ${OUTPUT}
+  echo "░░█████  ░███ ░███████ ░███████  ░███ ░███░███" >> ${OUTPUT}
+  echo " ░░░░███ ░███ ░███░░░  ░███░░░   ░███ ░███░░░ " >> ${OUTPUT}
+  echo " ██████  █████░░██████ ░░██████  ░███████  ███" >> ${OUTPUT}
+  echo "░░░░░░  ░░░░░  ░░░░░░   ░░░░░░   ░███░░░  ░░░ " >> ${OUTPUT}
+  echo "                                 ░███         " >> ${OUTPUT}
+  echo "                                 █████        " >> ${OUTPUT}
+  echo "                                ░░░░░         " >> ${OUTPUT}
+  echo "" >> ${OUTPUT}
+  echo "// sleep at ${FULLDATE}" >> ${OUTPUT}
+  /usr/bin/python3 /Users/shughey/Dropbox/bin/send_status_mail3.py
+  DURATION=$[ $(date +%s) - ${START} ]
+  #cat /tmp/wakemaints.txt | fgrep "Wake reason"
+  rm ${OUTPUT}
+  sleep 15
+  # Sleep now
+  /usr/bin/pmset sleepnow
+fi
+
diff --git a/snmap b/snmap
new file mode 100755
index 0000000..419ef5f
--- /dev/null
+++ b/snmap
@@ -0,0 +1,2 @@
+#!/bin/sh
+sudo nmap -O -v $1
diff --git a/subl b/subl
new file mode 100755
index 0000000..ef6068f
Binary files /dev/null and b/subl differ
diff --git a/subl (Symlink Backup Copy) b/subl (Symlink Backup Copy)
new file mode 100755
index 0000000..075a971
Binary files /dev/null and b/subl (Symlink Backup Copy) differ
diff --git a/subl3 b/subl3
new file mode 100755
index 0000000..90ba2f8
Binary files /dev/null and b/subl3 differ
diff --git a/tc1 b/tc1
new file mode 100755
index 0000000..5c60bd1
--- /dev/null
+++ b/tc1
@@ -0,0 +1,14 @@
+#!/bin/bash
+maxweb=1
+echo "** tarte clear caches"
+for i in `seq 1 $maxweb`;
+do
+  printf "   web$i: "
+  curl -s --insecure --basic --user "autoproc:YnFZurWVwiM9ov3yKHgo" "https://web$i.tartecosmetics.com/admin/clearcache.php" >> /dev/null &2>&1
+  printf "cleared!\n"
+  if [ $i -lt $maxweb ]
+  then 
+    printf "   -- sleep 1 --\n"
+    sleep 1
+  fi
+done
diff --git a/tclear b/tclear
new file mode 100755
index 0000000..a353fcb
--- /dev/null
+++ b/tclear
@@ -0,0 +1,14 @@
+#!/bin/bash
+maxweb=8
+echo "** tarte clear caches"
+for i in `seq 1 $maxweb`;
+do
+  printf "   web$i: "
+  curl -s --insecure --basic --user "autoproc:YnFZurWVwiM9ov3yKHgo" "https://web$i.tartecosmetics.com/admin/clearcache.php" >> /dev/null &2>&1
+  printf "cleared!\n"
+  if [ $i -lt $maxweb ]
+  then 
+    printf "   -- sleep 1 --\n"
+    sleep 1
+  fi
+done
diff --git a/tcp b/tcp
new file mode 100755
index 0000000..088cc57
--- /dev/null
+++ b/tcp
@@ -0,0 +1,10 @@
+#!/bin/bash
+maxweb=8
+echo "** tarte scp"
+for i in `seq 1 $maxweb`;
+do
+  printf "...web$i "
+  scp -P 5963 $1 tarte@web$i.tartecosmetics.com:$2
+  echo "-- copied to web$i"
+done
+
diff --git a/test b/test
new file mode 100755
index 0000000..ea8b63c
--- /dev/null
+++ b/test
@@ -0,0 +1,25 @@
+#!/bin/bash
+export PATH=$PATH:/usr/bin/local
+cname=`scutil --get ComputerName`
+
+echo ""
+echo "Script:"
+echo "presleep_quitapps"
+echo "------------------------------------------------------------------------"
+echo "Machine:" $cname
+echo `date`
+echo ""
+
+# machine specific: Angus && Petula, turn off HomeKit stuff
+if [[ $cname = "Angus" || $cname = "Petula" ]];
+then
+  echo "** Machine Specific: $cname"
+  echo $'\t' "this works test"
+
+fi
+
+
+
+
+echo "------------------------------------------------------------------------"
+echo `date`
diff --git a/test-caffeinate.txt b/test-caffeinate.txt
new file mode 100644
index 0000000..3da63d7
--- /dev/null
+++ b/test-caffeinate.txt
@@ -0,0 +1,7 @@
+Listed by owning process:
+   pid 30456(caffeinate): [0x00004a4700018c74] 15:16:59 PreventUserIdleSystemSleep named: "caffeinate command-line tool"
+	Details: caffeinate asserting on behalf of '/Users/shughey/Dropbox/bin/presleep' (pid 30455)
+	Localized=THE CAFFEINATE TOOL IS PREVENTING SLEEP.
+   pid 30456(caffeinate): [0x00004a4700078c77] 15:16:59 PreventSystemSleep named: "caffeinate command-line tool"
+	Details: caffeinate asserting on behalf of '/Users/shughey/Dropbox/bin/presleep' (pid 30455)
+	Localized=THE CAFFEINATE TOOL IS PREVENTING SLEEP.
diff --git a/test.sh b/test.sh
new file mode 100755
index 0000000..50ce6b1
--- /dev/null
+++ b/test.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+export PATH=$PATH:/usr/bin/local
+cname=`scutil --get ComputerName`
+SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
+dtst=`date +"%Y%m%d-%H.%M"`
+
+lines=3
+
+if [[ "$lines" -gt 1 ||  "$line2" -gt 1 ]]
+then
+  echo "fuck yes!"
+fi
+
+echo ""
+echo "██╗██████╗ ██╗     ███████╗ ██████╗██╗  ██╗███████╗ ██████╗██╗  ██╗"
+echo "██║██╔══██╗██║     ██╔════╝██╔════╝██║  ██║██╔════╝██╔════╝██║ ██╔╝"
+echo "██║██║  ██║██║     █████╗  ██║     ███████║█████╗  ██║     █████╔╝ "
+echo "██║██║  ██║██║     ██╔══╝  ██║     ██╔══██║██╔══╝  ██║     ██╔═██╗ "
+echo "██║██████╔╝███████╗███████╗╚██████╗██║  ██║███████╗╚██████╗██║  ██╗"
+echo "╚═╝╚═════╝ ╚══════╝╚══════╝ ╚═════╝╚═╝  ╚═╝╚══════╝ ╚═════╝╚═╝  ╚═╝"
+echo ""
+echo "// presleep_quitapps"
+echo "  " `date`
+echo "   Machine: ${cname}"
+echo "  " `/usr/bin/sw_vers`
+echo "  " `sysctl kern.version`
+echo "  " `sysctl kern.ostype`
+echo "  " `sysctl kern.osrelease`
+echo "  " `sysctl kern.osrevision`
+echo "-------------------------------------------------------------------"
+echo ""
diff --git a/tivodecode b/tivodecode
new file mode 100755
index 0000000..29b9d09
Binary files /dev/null and b/tivodecode differ
diff --git a/unmount-cli.app/Contents/Info.plist b/unmount-cli.app/Contents/Info.plist
new file mode 100644
index 0000000..ac2b305
--- /dev/null
+++ b/unmount-cli.app/Contents/Info.plist
@@ -0,0 +1,76 @@
+
+
+
+
+	CFBundleAllowMixedLocalizations
+	
+	CFBundleDevelopmentRegion
+	en
+	CFBundleExecutable
+	applet
+	CFBundleIconFile
+	applet
+	CFBundleIdentifier
+	com.apple.ScriptEditor.id.unmount-cli
+	CFBundleInfoDictionaryVersion
+	6.0
+	CFBundleName
+	unmount-cli
+	CFBundlePackageType
+	APPL
+	CFBundleShortVersionString
+	1.0
+	CFBundleSignature
+	aplt
+	LSMinimumSystemVersionByArchitecture
+	
+		x86_64
+		10.6
+	
+	LSRequiresCarbon
+	
+	NSAppleEventsUsageDescription
+	This script needs to control other applications to run.
+	NSAppleMusicUsageDescription
+	This script needs access to your music to run.
+	NSCalendarsUsageDescription
+	This script needs access to your calendars to run.
+	NSCameraUsageDescription
+	This script needs access to your camera to run.
+	NSContactsUsageDescription
+	This script needs access to your contacts to run.
+	NSHomeKitUsageDescription
+	This script needs access to your HomeKit Home to run.
+	NSMicrophoneUsageDescription
+	This script needs access to your microphone to run.
+	NSPhotoLibraryUsageDescription
+	This script needs access to your photos to run.
+	NSRemindersUsageDescription
+	This script needs access to your reminders to run.
+	NSSiriUsageDescription
+	This script needs access to Siri to run.
+	NSSystemAdministrationUsageDescription
+	This script needs access to administer this system to run.
+	OSAAppletShowStartupScreen
+	
+	WindowState
+	
+		bundleDividerCollapsed
+		
+		bundlePositionOfDivider
+		0.0
+		dividerCollapsed
+		
+		eventLogLevel
+		2
+		name
+		ScriptWindowState
+		positionOfDivider
+		639
+		savedFrame
+		1632 400 631 898 0 0 3008 1667 
+		selectedTab
+		result
+	
+
+
diff --git a/unmount-cli.app/Contents/MacOS/applet b/unmount-cli.app/Contents/MacOS/applet
new file mode 100755
index 0000000..9f25ac6
Binary files /dev/null and b/unmount-cli.app/Contents/MacOS/applet differ
diff --git a/unmount-cli.app/Contents/PkgInfo b/unmount-cli.app/Contents/PkgInfo
new file mode 100644
index 0000000..3253614
--- /dev/null
+++ b/unmount-cli.app/Contents/PkgInfo
@@ -0,0 +1 @@
+APPLaplt
\ No newline at end of file
diff --git a/unmount-cli.app/Contents/Resources/Scripts/main.scpt b/unmount-cli.app/Contents/Resources/Scripts/main.scpt
new file mode 100644
index 0000000..89d972a
Binary files /dev/null and b/unmount-cli.app/Contents/Resources/Scripts/main.scpt differ
diff --git a/unmount-cli.app/Contents/Resources/applet.icns b/unmount-cli.app/Contents/Resources/applet.icns
new file mode 100644
index 0000000..0cdd170
Binary files /dev/null and b/unmount-cli.app/Contents/Resources/applet.icns differ
diff --git a/unmount-cli.app/Contents/Resources/applet.rsrc b/unmount-cli.app/Contents/Resources/applet.rsrc
new file mode 100644
index 0000000..9bc575b
Binary files /dev/null and b/unmount-cli.app/Contents/Resources/applet.rsrc differ
diff --git a/unmount-cli.app/Contents/_CodeSignature/CodeResources b/unmount-cli.app/Contents/_CodeSignature/CodeResources
new file mode 100644
index 0000000..7da8e0a
--- /dev/null
+++ b/unmount-cli.app/Contents/_CodeSignature/CodeResources
@@ -0,0 +1,177 @@
+
+
+
+
+	files
+	
+		Resources/Scripts/main.scpt
+		
+		8bdcRjVCfMUYnXGGGAwhDQxiXfo=
+		
+		Resources/applet.icns
+		
+		sINd6lbiqHD5dL8c6u79cFvVXhw=
+		
+		Resources/applet.rsrc
+		
+		jM3521OpDD9u1bnvloXu/XrCY0M=
+		
+		Resources/description.rtfd/TXT.rtf
+		
+		j/ujZuIb/J+ljq2po6fnklpuxCQ=
+		
+	
+	files2
+	
+		Resources/Scripts/main.scpt
+		
+			hash
+			
+			8bdcRjVCfMUYnXGGGAwhDQxiXfo=
+			
+			hash2
+			
+			tVb48kHY4dr/2mX4ldQFCYvftGxjBsyLcWYAyWXWnQI=
+			
+		
+		Resources/applet.icns
+		
+			hash
+			
+			sINd6lbiqHD5dL8c6u79cFvVXhw=
+			
+			hash2
+			
+			J7weZ6vlnv9r32tS5HFcyuPXl2StdDnfepLxAixlryk=
+			
+		
+		Resources/applet.rsrc
+		
+			hash
+			
+			jM3521OpDD9u1bnvloXu/XrCY0M=
+			
+			hash2
+			
+			tVx3lZc44FM0eW9kaf/SgJ0jObOEVdyayh6jus5XmrA=
+			
+		
+		Resources/description.rtfd/TXT.rtf
+		
+			hash
+			
+			j/ujZuIb/J+ljq2po6fnklpuxCQ=
+			
+			hash2
+			
+			+WN4+1l96YqWzSn6BQ3C/zCuJ9/anI2lThNtUgqkDeo=
+			
+		
+	
+	rules
+	
+		^Resources/
+		
+		^Resources/.*\.lproj/
+		
+			optional
+			
+			weight
+			1000
+		
+		^Resources/.*\.lproj/locversion.plist$
+		
+			omit
+			
+			weight
+			1100
+		
+		^Resources/Base\.lproj/
+		
+			weight
+			1010
+		
+		^version.plist$
+		
+	
+	rules2
+	
+		.*\.dSYM($|/)
+		
+			weight
+			11
+		
+		^(.*/)?\.DS_Store$
+		
+			omit
+			
+			weight
+			2000
+		
+		^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/
+		
+			nested
+			
+			weight
+			10
+		
+		^.*
+		
+		^Info\.plist$
+		
+			omit
+			
+			weight
+			20
+		
+		^PkgInfo$
+		
+			omit
+			
+			weight
+			20
+		
+		^Resources/
+		
+			weight
+			20
+		
+		^Resources/.*\.lproj/
+		
+			optional
+			
+			weight
+			1000
+		
+		^Resources/.*\.lproj/locversion.plist$
+		
+			omit
+			
+			weight
+			1100
+		
+		^Resources/Base\.lproj/
+		
+			weight
+			1010
+		
+		^[^/]+$
+		
+			nested
+			
+			weight
+			10
+		
+		^embedded\.provisionprofile$
+		
+			weight
+			20
+		
+		^version\.plist$
+		
+			weight
+			20
+		
+	
+
+
diff --git a/unmountvol b/unmountvol
new file mode 100755
index 0000000..f31cef9
--- /dev/null
+++ b/unmountvol
@@ -0,0 +1,11 @@
+#!/bin/sh
+export PATH=$PATH:/usr/bin/local
+echo "Looking for $1"
+_MYDISK=`diskutil list | grep -w "$1" | awk '{print $6}'`
+if [ $_MYDISK = 'TB' ]; then
+  _MYDISK=`diskutil list | grep -w "$1" | awk '{print $7}'`
+elif [ $_MYDISK = 'GB' ]; then
+  _MYDISK=`diskutil list | grep -w "$1" | awk '{print $7}'`
+fi
+echo "Unmounting $_MYDISK"
+diskutil unmount force /dev/$_MYDISK
diff --git a/unmountvol-all b/unmountvol-all
new file mode 100755
index 0000000..707dfa7
--- /dev/null
+++ b/unmountvol-all
@@ -0,0 +1,6 @@
+#!/bin/sh
+export PATH=$PATH:/usr/bin/local
+echo "Looking for $1"
+_MYDISK=`diskutil list | grep "$1" | awk '{print $6}'`
+echo "Unmounting $_MYDISK"
+diskutil unmount force /dev/$_MYDISK
diff --git a/update_vidm4v b/update_vidm4v
new file mode 100755
index 0000000..92e412f
--- /dev/null
+++ b/update_vidm4v
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+gem update --install-dir /usr/local/bin video_transcoding
diff --git a/vbox-fix b/vbox-fix
new file mode 100755
index 0000000..749a538
--- /dev/null
+++ b/vbox-fix
@@ -0,0 +1,2 @@
+#!/bin/sh
+sudo /Library/StartupItems/VirtualBox/VirtualBox restart
diff --git a/vid-docker b/vid-docker
new file mode 100755
index 0000000..4e3208b
--- /dev/null
+++ b/vid-docker
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+echo ""
+echo "** cd to Movies directory                         **"
+echo "** transcode-video --m4v --crop detect  **"
+echo ""
+cd ~/Movies
+docker run -itv "`pwd`":/data ntodd/video-transcoding
diff --git a/vidm4v b/vidm4v
new file mode 100755
index 0000000..eb0f57a
--- /dev/null
+++ b/vidm4v
@@ -0,0 +1,4 @@
+#!/bin/sh
+echo "transcode-video --m4v --crop detect $1"
+transcode-video --m4v --crop detect $1
+
diff --git a/vpn-toggle b/vpn-toggle
new file mode 100755
index 0000000..d88543d
--- /dev/null
+++ b/vpn-toggle
@@ -0,0 +1,45 @@
+#!/bin/bash
+DEFAULT_VPN_NAME="AlgoVPN algo3"
+
+
+
+
+
+
+
+
+
+
+
+
+export PATH=$PATH:/usr/bin/local
+
+VPN_NAME=$1
+if [[ $VPN_NAME = "" ]];
+then
+  VPN_NAME=$DEFAULT_VPN_NAME
+fi
+
+curStatus=$( /usr/sbin/networksetup -showpppoestatus "${VPN_NAME}" )
+dtst=`date +"%Y%m%d-%H.%M"`
+
+echo ""
+echo "Script:"
+echo "vpn flip for ${VPN_NAME}"
+echo "------------------------------------------------------------------------"
+echo "Machine:" $cname
+/usr/bin/sw_vers
+sysctl kern.version
+sysctl kern.ostype
+sysctl kern.osrelease
+sysctl kern.osrevision
+echo ""
+
+if [[ $curStatus = "disconnected" ]];
+then
+  echo "Currently disconnected, connecting..."
+  /usr/sbin/networksetup -connectpppoeservice "${VPN_NAME}"
+else
+  echo "Currently connected, disconnecting..."
+  /usr/sbin/networksetup -disconnectpppoeservice "${VPN_NAME}"
+fi
diff --git a/wake b/wake
new file mode 100755
index 0000000..0893d9a
--- /dev/null
+++ b/wake
@@ -0,0 +1,5 @@
+#!/bin/sh
+/usr/bin/python3 $HOME/Dropbox/bin/send_sleep_mail3.py
+sleep 10
+/usr/bin/pmset sleepnow
+
diff --git a/wakelogend b/wakelogend
new file mode 100755
index 0000000..78c08fa
--- /dev/null
+++ b/wakelogend
@@ -0,0 +1,7 @@
+#!/bin/sh
+echo "" >> /tmp/wakereasons.txt
+echo "" >> /tmp/wakereasons.txt
+echo "" >> /tmp/wakereasons.txt
+echo `date` >> /tmp/wakereasons.txt
+echo "====================================================================================" >> /tmp/wakereasons.txt
+#rm /tmp/wakereasons.txt
diff --git a/wakelogstart b/wakelogstart
new file mode 100755
index 0000000..82d30ea
--- /dev/null
+++ b/wakelogstart
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+cname=`scutil --get ComputerName`
+export CNAME=$cname
+
+echo "" > /tmp/wakereasons.txt
+echo "// wakelog" >> /tmp/wakereasons.txt
+echo "  " `date` >> /tmp/wakereasons.txt
+echo "   machine: ${cname}" >> /tmp/wakereasons.txt
+echo "-------------------------------------------------------------------"
diff --git a/wakemaints.txt b/wakemaints.txt
new file mode 100644
index 0000000..e69de29
diff --git a/wakenotify b/wakenotify
new file mode 100755
index 0000000..c288bc4
--- /dev/null
+++ b/wakenotify
@@ -0,0 +1,168 @@
+#!/bin/sh
+echo "Wake Log Collecting..."
+DBIN=$HOME/Dropbox/bin/
+export DBIN
+ESUBJ="$KMINFO_MacroName"
+export ESUBJ
+cname=`scutil --get ComputerName`
+script=`basename $0`
+
+
+echo "${DBIN}wakelogstart"
+${DBIN}wakelogstart
+
+#echo "// wake report" >> /tmp/wakereasons.txt
+#echo "  " `date` >> /tmp/wakereasons.txt
+#echo "   machine: ${cname}" >> /tmp/wakereasons.txt
+echo "   script: ${script}" >> /tmp/wakereasons.txt
+echo "  " `/usr/bin/sw_vers` >> /tmp/wakereasons.txt
+echo "  " `sysctl kern.version` >> /tmp/wakereasons.txt
+echo "  " `sysctl kern.ostype` >> /tmp/wakereasons.txt
+echo "  " `sysctl kern.osrelease` >> /tmp/wakereasons.txt
+echo "  " `sysctl kern.osrevision` >> /tmp/wakereasons.txt
+echo "" >> /tmp/wakereasons.txt
+echo "" >> /tmp/wakereasons.txt
+echo "" >> /tmp/wakereasons.txt
+echo "                       █████               ███" >> /tmp/wakereasons.txt
+echo "                      ░░███               ░███" >> /tmp/wakereasons.txt
+echo " █████ ███ ███████████ ░███ █████  ██████ ░███" >> /tmp/wakereasons.txt
+echo "░░███ ░███░░███░░░░░███░███░░███  ███░░███░███" >> /tmp/wakereasons.txt
+echo " ░███ ░███ ░███ ███████░██████░  ░███████ ░███" >> /tmp/wakereasons.txt
+echo " ░░███████████ ███░░███░███░░███ ░███░░░  ░░░ " >> /tmp/wakereasons.txt
+echo "  ░░████░████ ░░███████████ █████░░██████  ███" >> /tmp/wakereasons.txt
+echo "   ░░░░ ░░░░   ░░░░░░░░░░░ ░░░░░  ░░░░░░  ░░░ " >> /tmp/wakereasons.txt
+
+divLine() {
+  echo "---------------------------------------------" >> /tmp/wakereasons.txt
+}
+
+
+echo "" >> /tmp/wakereasons.txt
+echo "Sleep Quick Status" >> /tmp/wakereasons.txt
+divLine
+pmset -g log|grep -e " Sleep  " -e " Wake  " | tail -n 2 > /tmp/pmsetlog.tmp
+
+sleeptm=$(cat /tmp/pmsetlog.tmp | awk '{print $1,$2}' | head -n 1)
+waketm=$(cat /tmp/pmsetlog.tmp | awk '{print $1,$2}' | tail -n 1)
+sleepsec=$(date -j -f "%Y-%m-%d %H:%M:%S" "${sleeptm}" "+%s")
+wakesec=$(date -j -f "%Y-%m-%d %H:%M:%S" "${waketm}" "+%s")
+#echo "sleepsec: " ${sleepsec}
+#echo "wakesec: " ${wakesec}
+timedelta=$(( ((wakesec-sleepsec)/60)/60 ))
+ftimedelta=$(bc <<< "scale=2; ((${wakesec}-${sleepsec})/60)/60")
+echo "Sleep Time:" ${sleeptm} >> /tmp/wakereasons.txt
+echo "Wake Time:" ${waketm} >> /tmp/wakereasons.txt
+printf "Sleep Duration: %0.2f hours\n" $ftimedelta >> /tmp/wakereasons.txt
+echo "" >> /tmp/wakereasons.txt
+cat /tmp/pmsetlog.tmp >> /tmp/wakereasons.txt 
+#echo `date` > /tmp/wakenotify.txt
+
+echo "" >> /tmp/wakereasons.txt
+echo "" >> /tmp/wakereasons.txt
+echo "pmset -g stats" >> /tmp/wakereasons.txt
+divLine
+pmset -g stats >> /tmp/wakereasons.txt
+
+echo "" >> /tmp/wakereasons.txt
+echo "" >> /tmp/wakereasons.txt
+echo "log show --style syslog --last 3h | fgrep \"Wake reason\"" >> /tmp/wakereasons.txt
+divLine
+log show --style syslog --last 3h | fgrep "Wake reason" >> /tmp/wakereasons.txt
+
+echo "" >> /tmp/wakereasons.txt
+echo "" >> /tmp/wakereasons.txt
+echo "pmset -g log | grep -e \"due to\" | tail -n 50" >> /tmp/wakereasons.txt
+divLine
+pmset -g log | grep -e "due to" | tail -n 50 >> /tmp/wakereasons.txt
+
+echo "" >> /tmp/wakereasons.txt
+echo "" >> /tmp/wakereasons.txt
+echo "" >> /tmp/wakereasons.txt
+echo "pmset -g sched" >> /tmp/wakereasons.txt
+divLine
+pmset -g sched >> /tmp/wakereasons.txt
+
+echo "" >> /tmp/wakereasons.txt
+echo "" >> /tmp/wakereasons.txt
+echo "" >> /tmp/wakereasons.txt
+echo "pmset -g log | grep \"Wake Requests\" | tail -n 25" >> /tmp/wakereasons.txt
+divLine
+pmset -g log | grep "Wake Requests" | tail -n 25 >> /tmp/wakereasons.txt
+
+echo "" >> /tmp/wakereasons.txt
+echo "" >> /tmp/wakereasons.txt
+echo "" >> /tmp/wakereasons.txt
+echo "sysctl -a | grep -iE \"dark|wake\"" >> /tmp/wakereasons.txt
+divLine
+sysctl -a | grep -iE "dark|wake"  >> /tmp/wakereasons.txt
+
+echo "" >> /tmp/wakereasons.txt
+echo "" >> /tmp/wakereasons.txt
+echo "" >> /tmp/wakereasons.txt
+echo "pmset -g assertions" >> /tmp/wakereasons.txt
+divLine
+pmset -g assertions >> /tmp/wakereasons.txt
+
+
+echo "" >> /tmp/wakereasons.txt
+echo "" >> /tmp/wakereasons.txt
+echo "" >> /tmp/wakereasons.txt
+echo "pmset -g log | grep DarkWake | tail -n 25" >> /tmp/wakereasons.txt
+divLine
+pmset -g log | grep DarkWake | tail -n 25 >> /tmp/wakereasons.txt
+
+
+echo "" >> /tmp/wakereasons.txt
+echo "" >> /tmp/wakereasons.txt
+echo "" >> /tmp/wakereasons.txt
+echo "log show --last 1h --style syslog | fgrep \"system wake events\"" >> /tmp/wakereasons.txt
+divLine
+log show --last 1h --style syslog | fgrep "system wake events" >> /tmp/wakereasons.txt
+
+echo "" >> /tmp/wakereasons.txt
+echo "" >> /tmp/wakereasons.txt
+echo "" >> /tmp/wakereasons.txt
+echo "pmset -g log|grep -e \" Sleep \" -e \" Wake \" | tail -n 100" >> /tmp/wakereasons.txt
+divLine
+pmset -g log|grep -e " Sleep " -e " Wake " | tail -n 100 >> /tmp/wakereasons.txt
+
+#echo "" >> /tmp/wakereasons.txt
+#echo "" >> /tmp/wakereasons.txt
+#echo "" >> /tmp/wakereasons.txt
+#echo "pmset -g everything" >> /tmp/wakereasons.txt
+#divLine
+#pmset -g everything >> /tmp/wakereasons.txt
+
+echo "" >> /tmp/wakereasons.txt
+echo "" >> /tmp/wakereasons.txt
+echo "" >> /tmp/wakereasons.txt
+echo "Process list (ps auxc -r)" >> /tmp/wakereasons.txt
+divLine
+ps auxc -r >> /tmp/wakereasons.txt
+
+echo "" >> /tmp/wakereasons.txt
+echo "" >> /tmp/wakereasons.txt
+echo "" >> /tmp/wakereasons.txt
+echo "Adjust Sleep Settings to Avoid Wakes"  >> /tmp/wakereasons.txt
+divLine
+echo "sudo -S pmset schedule cancelall"  >> /tmp/wakereasons.txt
+# more /etc/sudoers.d/shughey
+# shughey ALL=(ALL) NOPASSWD: /usr/bin/pmset
+sudo -S pmset schedule cancelall
+sudo pmset repeat cancel
+# echo "sudo pmset -a hibernatemode 0"
+# sudo pmset -a hibernatemode 0
+echo "sudo pmset -a autopoweroff 0" >> /tmp/wakereasons.txt
+sudo pmset -a autopoweroff 0
+echo "sudo pmset -a standby 0" >> /tmp/wakereasons.txt
+sudo pmset -a standby 0
+echo "sudo pmset -a tcpkeepalive 0" >> /tmp/wakereasons.txt
+sudo pmset -a tcpkeepalive 0
+echo "sudo pmset -a powernap 0" >> /tmp/wakereasons.txt
+sudo pmset -a powernap 0
+
+${DBIN}wakelogend
+python3 $HOME/Dropbox/bin/send_wake_mail3.py
+echo "Done!"
+rm /tmp/wakereasons.txt
+
diff --git a/whos-connected b/whos-connected
new file mode 100755
index 0000000..2c7a50b
--- /dev/null
+++ b/whos-connected
@@ -0,0 +1,2 @@
+#!/bin/sh
+netstat -a -p tcp | grep afp | grep ESTABLISHED
diff --git a/wol-benoit b/wol-benoit
new file mode 100755
index 0000000..9870b09
--- /dev/null
+++ b/wol-benoit
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+wakeonlan -i benoit.nas 24:5e:be:80:3b:14
diff --git a/xld b/xld
new file mode 100755
index 0000000..9f636d3
--- /dev/null
+++ b/xld
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+#Edit this line to define a path to XLD.app
+XLD_APP="/Applications/XLD.app"
+
+if [ ! -d "${XLD_APP}" ] ; then
+	echo "XLD.app not found"
+	exit;
+fi
+
+"${XLD_APP}/Contents/MacOS/XLD" --cmdline "$@"