macOS tools moving to my git
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.DS_Store
|
||||
3
.nova/Configuration.json
Normal file
3
.nova/Configuration.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"editor.default_syntax" : "shell"
|
||||
}
|
||||
4
Angus/tdarr-bounce
Executable file
4
Angus/tdarr-bounce
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd "/Usres/shughey"
|
||||
killall Tdarr_Node; sleep 5;./Tdarr_Node/Tdarr_Node &
|
||||
6
Angus/tdarr-start
Executable file
6
Angus/tdarr-start
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd /Users/shughey
|
||||
killall Tdarr_Node
|
||||
sleep 3
|
||||
./Tdarr_Node/Tdarr_Node &
|
||||
111
allow_sleep.php
Normal file
111
allow_sleep.php
Normal file
@@ -0,0 +1,111 @@
|
||||
<?php
|
||||
$tmpPath = "/tmp/";
|
||||
$killLog = "/Users/shughey/Dropbox/FirefoxKillLog.log";
|
||||
|
||||
$output = shell_exec("/usr/bin/pmset -g assertions");
|
||||
$lines = explode("\n", $output);
|
||||
// print $output;
|
||||
|
||||
$userIsActive = false;
|
||||
$x = 0;
|
||||
$preventSleep = false;
|
||||
$isFirefox = false;
|
||||
$firefoxProc = [];
|
||||
|
||||
while ($x < count($lines)) {
|
||||
$thisLine = $lines[$x];
|
||||
if (strpos($thisLine, "UserIsActive 1") != false) $userIsActive = true;
|
||||
if (strpos($thisLine, "PreventUserIdleSystemSleep named") != false) {
|
||||
$preventSleep = true;
|
||||
echo "Prevent sleep!\n{$thisLine}\n" . $lines[$x+1] . "\n";
|
||||
preg_match("/Created for PID: ([0-9]{1,7})/", $lines[$x+1], $gr);
|
||||
// print_r($gr);
|
||||
if (is_array($gr)) {
|
||||
$proc = $gr[1];
|
||||
if ($proc) {
|
||||
$psout = shell_exec("/bin/ps -p{$proc}" );
|
||||
if (strpos($psout, "Firefox.app") != false) {
|
||||
echo "Firefox process ID: {$proc}\n";
|
||||
$isFirefox = true;
|
||||
$firefoxProc[] = $proc;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (strpos($thisLine, "SystemIsActive named: \"News") != false) {
|
||||
$preventSleep = true;
|
||||
echo "Prevent sleep!\n{$thisLine}\n" . $lines[$x+1] . "\n";
|
||||
preg_match("/Created for PID: ([0-9]{1,7})/", $lines[$x+1], $gr);
|
||||
// print_r($gr);
|
||||
if (is_array($gr)) {
|
||||
$proc = $gr[1];
|
||||
if ($proc) {
|
||||
$psout = shell_exec("/bin/ps -p{$proc}" );
|
||||
if (strpos($psout, "News.app") != false) {
|
||||
echo "News process ID: {$proc}\n";
|
||||
$isFirefox = true;
|
||||
$firefoxProc[] = $proc;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (strpos($thisLine, "NoIdleSleepAssertion named: \"Playing audio") != false) {
|
||||
$preventSleep = true;
|
||||
echo "Prevent sleep!\n{$thisLine}\n" . $lines[$x+1] . "\n";
|
||||
preg_match("/Created for PID: ([0-9]{1,7})/", $lines[$x+1], $gr);
|
||||
// print_r($gr);
|
||||
if (is_array($gr)) {
|
||||
$proc = $gr[1];
|
||||
if ($proc) {
|
||||
$psout = shell_exec("/bin/ps -p{$proc}" );
|
||||
if (strpos($psout, "Vivaldi.app") != false) {
|
||||
echo "Vivaldi process ID: {$proc}\n";
|
||||
$isFirefox = true;
|
||||
$firefoxProc[] = $proc;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$x++;
|
||||
}
|
||||
|
||||
// TESTING
|
||||
// $userIsActive = false;
|
||||
|
||||
$file = "{$tmpPath}sleep-mon-{$firefoxProc}";
|
||||
|
||||
if ($userIsActive) {
|
||||
echo "User is active!\n";
|
||||
if (file_exists($file)) unlink($file);
|
||||
}
|
||||
|
||||
|
||||
if (!$userIsActive && $preventSleep && $isFirefox) {
|
||||
foreach($firefoxProc as $thisProc) {
|
||||
$file = "{$tmpPath}sleep-mon-{$thisProc}";
|
||||
if (file_exists($file)) {
|
||||
if (time() - filemtime($file) > (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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
21
arc-export/LICENSE
Normal file
21
arc-export/LICENSE
Normal file
@@ -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.
|
||||
85
arc-export/README.md
Normal file
85
arc-export/README.md
Normal file
@@ -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`
|
||||
|
||||

|
||||
|
||||
## 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!
|
||||
|
||||
<a href="https://www.buymeacoffee.com/ivnvxd" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a>
|
||||
|
||||
And do not forget to give the project a star if you like it! :star:
|
||||
|
||||
## License
|
||||
|
||||
This project is licensed under the MIT License.
|
||||
BIN
arc-export/example.gif
Normal file
BIN
arc-export/example.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 112 KiB |
311
arc-export/main.py
Executable file
311
arc-export/main.py
Executable file
@@ -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 = """<!DOCTYPE NETSCAPE-Bookmark-file-1>
|
||||
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
|
||||
<TITLE>Bookmarks</TITLE>
|
||||
<H1>Bookmarks</H1>
|
||||
<DL><p>"""
|
||||
|
||||
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}<DT><H3>{item["title"]}</H3>'
|
||||
html_str += f"\n{indent}<DL><p>"
|
||||
html_str = traverse_dict(item["children"], html_str, level + 1)
|
||||
html_str += f"\n{indent}</DL><p>"
|
||||
elif item["type"] == "bookmark":
|
||||
html_str += f'\n{indent}<DT><A HREF="{item["url"]}">{item["title"]}</A>'
|
||||
return html_str
|
||||
|
||||
html_str = traverse_dict(bookmarks["bookmarks"], html_str, 1)
|
||||
html_str += "\n</DL><p>"
|
||||
|
||||
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()
|
||||
44
bootableBigSur.sh
Executable file
44
bootableBigSur.sh
Executable file
@@ -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 <filename>" 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
|
||||
|
||||
4
control-console-windowmanager.sh
Normal file
4
control-console-windowmanager.sh
Normal file
@@ -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"
|
||||
21
dactoggle
Executable file
21
dactoggle
Executable file
@@ -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
|
||||
2
digall
Executable file
2
digall
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
dig +nocmd $1 any +multiline +noall +answer
|
||||
BIN
displaycount (Callum.local's conflicted copy 2024-10-30).scpt
Normal file
BIN
displaycount (Callum.local's conflicted copy 2024-10-30).scpt
Normal file
Binary file not shown.
BIN
displaycount (Callum.local's conflicted copy 2025-03-11).scpt
Normal file
BIN
displaycount (Callum.local's conflicted copy 2025-03-11).scpt
Normal file
Binary file not shown.
Binary file not shown.
BIN
displaycount.scpt
Normal file
BIN
displaycount.scpt
Normal file
Binary file not shown.
67
dropkick
Executable file
67
dropkick
Executable file
@@ -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 <WIRELESS NIC> <BSSID OF ACCESS POINT>
|
||||
|
||||
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
|
||||
|
||||
6
fixhostname
Executable file
6
fixhostname
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
hostname=`hostname`
|
||||
if [ "$hostname" == "Unknown.domain" ]
|
||||
then
|
||||
sudo hostname Go-Sharks.local
|
||||
fi
|
||||
12
hatari-modem
Executable file
12
hatari-modem
Executable file
@@ -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
|
||||
56
idlecheck
Executable file
56
idlecheck
Executable file
@@ -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
|
||||
78
idlecheck_caffeinatestuck
Executable file
78
idlecheck_caffeinatestuck
Executable file
@@ -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
|
||||
75
idlecheck_quitaudiolock
Executable file
75
idlecheck_quitaudiolock
Executable file
@@ -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
|
||||
51
idlecheck_quitaudioprevent
Executable file
51
idlecheck_quitaudioprevent
Executable file
@@ -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
|
||||
56
idlecheck_quitvideowake
Executable file
56
idlecheck_quitvideowake
Executable file
@@ -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
|
||||
35
idlecheck_tasks
Executable file
35
idlecheck_tasks
Executable file
@@ -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
|
||||
153
imgcat
Executable file
153
imgcat
Executable file
@@ -0,0 +1,153 @@
|
||||
#!/bin/bash
|
||||
|
||||
# tmux requires unrecognized OSC sequences to be wrapped with DCS tmux;
|
||||
# <sequence> ST, and for all ESCs in <sequence> 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
|
||||
25
install-nginx.sh
Executable file
25
install-nginx.sh
Executable file
@@ -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
|
||||
30
kbm-mountNAS.sh
Executable file
30
kbm-mountNAS.sh
Executable file
@@ -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
|
||||
3
log-quieter.sh
Executable file
3
log-quieter.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
PID=`pgrep WindowServer`
|
||||
sudo log config --process="${PID}" --mode "level:off"
|
||||
echo "log stream --predicate '(process == \"WindowServer\")' --debug"
|
||||
88
maintwakes
Executable file
88
maintwakes
Executable file
@@ -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}
|
||||
35
maintwakes-halt
Executable file
35
maintwakes-halt
Executable file
@@ -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
|
||||
15
makeicns
Executable file
15
makeicns
Executable file
@@ -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
|
||||
|
||||
6
mountvol
Executable file
6
mountvol
Executable file
@@ -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
|
||||
4
myip
Executable file
4
myip
Executable file
@@ -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}'
|
||||
|
||||
2
pikvm
Executable file
2
pikvm
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
/Applications/Vivaldi.app/Contents/MacOS/Vivaldi --app="https://pikvm.loc/"
|
||||
2
pikvm2
Executable file
2
pikvm2
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
/Applications/Vivaldi.app/Contents/MacOS/Vivaldi --app="https://pikvm2.loc/"
|
||||
14
presleep
Executable file
14
presleep
Executable file
@@ -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
|
||||
216
presleep_quitapps
Executable file
216
presleep_quitapps
Executable file
@@ -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 <true/> to <false/>
|
||||
# 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
|
||||
|
||||
7
proxtun
Executable file
7
proxtun
Executable file
@@ -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
|
||||
76
quit-app.app/Contents/Info.plist
Normal file
76
quit-app.app/Contents/Info.plist
Normal file
@@ -0,0 +1,76 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleAllowMixedLocalizations</key>
|
||||
<true/>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>applet</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>applet</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.apple.ScriptEditor.id.quit-app</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>quit-app</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>aplt</string>
|
||||
<key>LSMinimumSystemVersionByArchitecture</key>
|
||||
<dict>
|
||||
<key>x86_64</key>
|
||||
<string>10.6</string>
|
||||
</dict>
|
||||
<key>LSRequiresCarbon</key>
|
||||
<true/>
|
||||
<key>NSAppleEventsUsageDescription</key>
|
||||
<string>This script needs to control other applications to run.</string>
|
||||
<key>NSAppleMusicUsageDescription</key>
|
||||
<string>This script needs access to your music to run.</string>
|
||||
<key>NSCalendarsUsageDescription</key>
|
||||
<string>This script needs access to your calendars to run.</string>
|
||||
<key>NSCameraUsageDescription</key>
|
||||
<string>This script needs access to your camera to run.</string>
|
||||
<key>NSContactsUsageDescription</key>
|
||||
<string>This script needs access to your contacts to run.</string>
|
||||
<key>NSHomeKitUsageDescription</key>
|
||||
<string>This script needs access to your HomeKit Home to run.</string>
|
||||
<key>NSMicrophoneUsageDescription</key>
|
||||
<string>This script needs access to your microphone to run.</string>
|
||||
<key>NSPhotoLibraryUsageDescription</key>
|
||||
<string>This script needs access to your photos to run.</string>
|
||||
<key>NSRemindersUsageDescription</key>
|
||||
<string>This script needs access to your reminders to run.</string>
|
||||
<key>NSSiriUsageDescription</key>
|
||||
<string>This script needs access to Siri to run.</string>
|
||||
<key>NSSystemAdministrationUsageDescription</key>
|
||||
<string>This script needs access to administer this system to run.</string>
|
||||
<key>OSAAppletShowStartupScreen</key>
|
||||
<false/>
|
||||
<key>WindowState</key>
|
||||
<dict>
|
||||
<key>bundleDividerCollapsed</key>
|
||||
<true/>
|
||||
<key>bundlePositionOfDivider</key>
|
||||
<real>0.0</real>
|
||||
<key>dividerCollapsed</key>
|
||||
<false/>
|
||||
<key>eventLogLevel</key>
|
||||
<integer>2</integer>
|
||||
<key>name</key>
|
||||
<string>ScriptWindowState</string>
|
||||
<key>positionOfDivider</key>
|
||||
<real>371</real>
|
||||
<key>savedFrame</key>
|
||||
<string>2226 330 700 678 0 0 3008 1667 </string>
|
||||
<key>selectedTab</key>
|
||||
<string>description</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
BIN
quit-app.app/Contents/MacOS/applet
Executable file
BIN
quit-app.app/Contents/MacOS/applet
Executable file
Binary file not shown.
1
quit-app.app/Contents/PkgInfo
Normal file
1
quit-app.app/Contents/PkgInfo
Normal file
@@ -0,0 +1 @@
|
||||
APPLaplt
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
quit-app.app/Contents/Resources/Scripts/main.scpt
Normal file
BIN
quit-app.app/Contents/Resources/Scripts/main.scpt
Normal file
Binary file not shown.
BIN
quit-app.app/Contents/Resources/applet.icns
Normal file
BIN
quit-app.app/Contents/Resources/applet.icns
Normal file
Binary file not shown.
BIN
quit-app.app/Contents/Resources/applet.rsrc
Normal file
BIN
quit-app.app/Contents/Resources/applet.rsrc
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 362 B |
BIN
quit-app.scpt
Normal file
BIN
quit-app.scpt
Normal file
Binary file not shown.
28
quit_browsers
Executable file
28
quit_browsers
Executable file
@@ -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
|
||||
33
rsync2mini.sh
Executable file
33
rsync2mini.sh
Executable file
@@ -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 ""
|
||||
7
sendSuperDuperCompleteEmail
Executable file
7
sendSuperDuperCompleteEmail
Executable file
@@ -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
|
||||
|
||||
38
send_quitbrowsers_mail.py
Executable file
38
send_quitbrowsers_mail.py
Executable file
@@ -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()
|
||||
59
send_quitbrowsers_mail3.py
Executable file
59
send_quitbrowsers_mail3.py
Executable file
@@ -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
|
||||
3
send_sleep_email.sh
Executable file
3
send_sleep_email.sh
Executable file
@@ -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
|
||||
41
send_sleep_mail.py
Normal file
41
send_sleep_mail.py
Normal file
@@ -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()
|
||||
64
send_sleep_mail3.py
Normal file
64
send_sleep_mail3.py
Normal file
@@ -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
|
||||
52
send_status_mail.py
Normal file
52
send_status_mail.py
Normal file
@@ -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()
|
||||
82
send_status_mail3.py
Normal file
82
send_status_mail3.py
Normal file
@@ -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 = '<html><body style="font-size: 0.6em"><pre>' + data + '</body></html>'
|
||||
|
||||
|
||||
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
|
||||
4
send_wake_email.sh
Executable file
4
send_wake_email.sh
Executable file
@@ -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
|
||||
53
send_wake_mail.py
Normal file
53
send_wake_mail.py
Normal file
@@ -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()
|
||||
82
send_wake_mail3.py
Normal file
82
send_wake_mail3.py
Normal file
@@ -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 = '<html><body style="font-size: 0.6em"><pre>' + data + '</body></html>'
|
||||
|
||||
|
||||
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
|
||||
23
shutdown_safe
Executable file
23
shutdown_safe
Executable file
@@ -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'
|
||||
74
sleep
Executable file
74
sleep
Executable file
@@ -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
|
||||
|
||||
BIN
subl (Symlink Backup Copy)
Executable file
BIN
subl (Symlink Backup Copy)
Executable file
Binary file not shown.
14
tc1
Executable file
14
tc1
Executable file
@@ -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
|
||||
14
tclear
Executable file
14
tclear
Executable file
@@ -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
|
||||
10
tcp
Executable file
10
tcp
Executable file
@@ -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
|
||||
|
||||
25
test
Executable file
25
test
Executable file
@@ -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`
|
||||
7
test-caffeinate.txt
Normal file
7
test-caffeinate.txt
Normal file
@@ -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.
|
||||
31
test.sh
Executable file
31
test.sh
Executable file
@@ -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 ""
|
||||
BIN
tivodecode
Executable file
BIN
tivodecode
Executable file
Binary file not shown.
76
unmount-cli.app/Contents/Info.plist
Normal file
76
unmount-cli.app/Contents/Info.plist
Normal file
@@ -0,0 +1,76 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleAllowMixedLocalizations</key>
|
||||
<true/>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>applet</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>applet</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.apple.ScriptEditor.id.unmount-cli</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>unmount-cli</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>aplt</string>
|
||||
<key>LSMinimumSystemVersionByArchitecture</key>
|
||||
<dict>
|
||||
<key>x86_64</key>
|
||||
<string>10.6</string>
|
||||
</dict>
|
||||
<key>LSRequiresCarbon</key>
|
||||
<true/>
|
||||
<key>NSAppleEventsUsageDescription</key>
|
||||
<string>This script needs to control other applications to run.</string>
|
||||
<key>NSAppleMusicUsageDescription</key>
|
||||
<string>This script needs access to your music to run.</string>
|
||||
<key>NSCalendarsUsageDescription</key>
|
||||
<string>This script needs access to your calendars to run.</string>
|
||||
<key>NSCameraUsageDescription</key>
|
||||
<string>This script needs access to your camera to run.</string>
|
||||
<key>NSContactsUsageDescription</key>
|
||||
<string>This script needs access to your contacts to run.</string>
|
||||
<key>NSHomeKitUsageDescription</key>
|
||||
<string>This script needs access to your HomeKit Home to run.</string>
|
||||
<key>NSMicrophoneUsageDescription</key>
|
||||
<string>This script needs access to your microphone to run.</string>
|
||||
<key>NSPhotoLibraryUsageDescription</key>
|
||||
<string>This script needs access to your photos to run.</string>
|
||||
<key>NSRemindersUsageDescription</key>
|
||||
<string>This script needs access to your reminders to run.</string>
|
||||
<key>NSSiriUsageDescription</key>
|
||||
<string>This script needs access to Siri to run.</string>
|
||||
<key>NSSystemAdministrationUsageDescription</key>
|
||||
<string>This script needs access to administer this system to run.</string>
|
||||
<key>OSAAppletShowStartupScreen</key>
|
||||
<false/>
|
||||
<key>WindowState</key>
|
||||
<dict>
|
||||
<key>bundleDividerCollapsed</key>
|
||||
<true/>
|
||||
<key>bundlePositionOfDivider</key>
|
||||
<real>0.0</real>
|
||||
<key>dividerCollapsed</key>
|
||||
<false/>
|
||||
<key>eventLogLevel</key>
|
||||
<integer>2</integer>
|
||||
<key>name</key>
|
||||
<string>ScriptWindowState</string>
|
||||
<key>positionOfDivider</key>
|
||||
<real>639</real>
|
||||
<key>savedFrame</key>
|
||||
<string>1632 400 631 898 0 0 3008 1667 </string>
|
||||
<key>selectedTab</key>
|
||||
<string>result</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
BIN
unmount-cli.app/Contents/MacOS/applet
Executable file
BIN
unmount-cli.app/Contents/MacOS/applet
Executable file
Binary file not shown.
1
unmount-cli.app/Contents/PkgInfo
Normal file
1
unmount-cli.app/Contents/PkgInfo
Normal file
@@ -0,0 +1 @@
|
||||
APPLaplt
|
||||
BIN
unmount-cli.app/Contents/Resources/Scripts/main.scpt
Normal file
BIN
unmount-cli.app/Contents/Resources/Scripts/main.scpt
Normal file
Binary file not shown.
BIN
unmount-cli.app/Contents/Resources/applet.icns
Normal file
BIN
unmount-cli.app/Contents/Resources/applet.icns
Normal file
Binary file not shown.
BIN
unmount-cli.app/Contents/Resources/applet.rsrc
Normal file
BIN
unmount-cli.app/Contents/Resources/applet.rsrc
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 362 B |
177
unmount-cli.app/Contents/_CodeSignature/CodeResources
Normal file
177
unmount-cli.app/Contents/_CodeSignature/CodeResources
Normal file
@@ -0,0 +1,177 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>files</key>
|
||||
<dict>
|
||||
<key>Resources/Scripts/main.scpt</key>
|
||||
<data>
|
||||
8bdcRjVCfMUYnXGGGAwhDQxiXfo=
|
||||
</data>
|
||||
<key>Resources/applet.icns</key>
|
||||
<data>
|
||||
sINd6lbiqHD5dL8c6u79cFvVXhw=
|
||||
</data>
|
||||
<key>Resources/applet.rsrc</key>
|
||||
<data>
|
||||
jM3521OpDD9u1bnvloXu/XrCY0M=
|
||||
</data>
|
||||
<key>Resources/description.rtfd/TXT.rtf</key>
|
||||
<data>
|
||||
j/ujZuIb/J+ljq2po6fnklpuxCQ=
|
||||
</data>
|
||||
</dict>
|
||||
<key>files2</key>
|
||||
<dict>
|
||||
<key>Resources/Scripts/main.scpt</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
8bdcRjVCfMUYnXGGGAwhDQxiXfo=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
tVb48kHY4dr/2mX4ldQFCYvftGxjBsyLcWYAyWXWnQI=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Resources/applet.icns</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
sINd6lbiqHD5dL8c6u79cFvVXhw=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
J7weZ6vlnv9r32tS5HFcyuPXl2StdDnfepLxAixlryk=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Resources/applet.rsrc</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
jM3521OpDD9u1bnvloXu/XrCY0M=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
tVx3lZc44FM0eW9kaf/SgJ0jObOEVdyayh6jus5XmrA=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Resources/description.rtfd/TXT.rtf</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
j/ujZuIb/J+ljq2po6fnklpuxCQ=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
+WN4+1l96YqWzSn6BQ3C/zCuJ9/anI2lThNtUgqkDeo=
|
||||
</data>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>rules</key>
|
||||
<dict>
|
||||
<key>^Resources/</key>
|
||||
<true/>
|
||||
<key>^Resources/.*\.lproj/</key>
|
||||
<dict>
|
||||
<key>optional</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>1000</real>
|
||||
</dict>
|
||||
<key>^Resources/.*\.lproj/locversion.plist$</key>
|
||||
<dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>1100</real>
|
||||
</dict>
|
||||
<key>^Resources/Base\.lproj/</key>
|
||||
<dict>
|
||||
<key>weight</key>
|
||||
<real>1010</real>
|
||||
</dict>
|
||||
<key>^version.plist$</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<key>rules2</key>
|
||||
<dict>
|
||||
<key>.*\.dSYM($|/)</key>
|
||||
<dict>
|
||||
<key>weight</key>
|
||||
<real>11</real>
|
||||
</dict>
|
||||
<key>^(.*/)?\.DS_Store$</key>
|
||||
<dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>2000</real>
|
||||
</dict>
|
||||
<key>^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/</key>
|
||||
<dict>
|
||||
<key>nested</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>10</real>
|
||||
</dict>
|
||||
<key>^.*</key>
|
||||
<true/>
|
||||
<key>^Info\.plist$</key>
|
||||
<dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>20</real>
|
||||
</dict>
|
||||
<key>^PkgInfo$</key>
|
||||
<dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>20</real>
|
||||
</dict>
|
||||
<key>^Resources/</key>
|
||||
<dict>
|
||||
<key>weight</key>
|
||||
<real>20</real>
|
||||
</dict>
|
||||
<key>^Resources/.*\.lproj/</key>
|
||||
<dict>
|
||||
<key>optional</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>1000</real>
|
||||
</dict>
|
||||
<key>^Resources/.*\.lproj/locversion.plist$</key>
|
||||
<dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>1100</real>
|
||||
</dict>
|
||||
<key>^Resources/Base\.lproj/</key>
|
||||
<dict>
|
||||
<key>weight</key>
|
||||
<real>1010</real>
|
||||
</dict>
|
||||
<key>^[^/]+$</key>
|
||||
<dict>
|
||||
<key>nested</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>10</real>
|
||||
</dict>
|
||||
<key>^embedded\.provisionprofile$</key>
|
||||
<dict>
|
||||
<key>weight</key>
|
||||
<real>20</real>
|
||||
</dict>
|
||||
<key>^version\.plist$</key>
|
||||
<dict>
|
||||
<key>weight</key>
|
||||
<real>20</real>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
11
unmountvol
Executable file
11
unmountvol
Executable file
@@ -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
|
||||
6
unmountvol-all
Executable file
6
unmountvol-all
Executable file
@@ -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
|
||||
3
update_vidm4v
Executable file
3
update_vidm4v
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
gem update --install-dir /usr/local/bin video_transcoding
|
||||
2
vbox-fix
Executable file
2
vbox-fix
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
sudo /Library/StartupItems/VirtualBox/VirtualBox restart
|
||||
8
vid-docker
Executable file
8
vid-docker
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo ""
|
||||
echo "** cd to Movies directory **"
|
||||
echo "** transcode-video --m4v --crop detect <filename> **"
|
||||
echo ""
|
||||
cd ~/Movies
|
||||
docker run -itv "`pwd`":/data ntodd/video-transcoding
|
||||
4
vidm4v
Executable file
4
vidm4v
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
echo "transcode-video --m4v --crop detect $1"
|
||||
transcode-video --m4v --crop detect $1
|
||||
|
||||
45
vpn-toggle
Executable file
45
vpn-toggle
Executable file
@@ -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
|
||||
5
wake
Executable file
5
wake
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
/usr/bin/python3 $HOME/Dropbox/bin/send_sleep_mail3.py
|
||||
sleep 10
|
||||
/usr/bin/pmset sleepnow
|
||||
|
||||
7
wakelogend
Executable file
7
wakelogend
Executable file
@@ -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
|
||||
10
wakelogstart
Executable file
10
wakelogstart
Executable file
@@ -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 "-------------------------------------------------------------------"
|
||||
0
wakemaints.txt
Normal file
0
wakemaints.txt
Normal file
168
wakenotify
Executable file
168
wakenotify
Executable file
@@ -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
|
||||
|
||||
2
whos-connected
Executable file
2
whos-connected
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
netstat -a -p tcp | grep afp | grep ESTABLISHED
|
||||
3
wol-benoit
Executable file
3
wol-benoit
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
wakeonlan -i benoit.nas 24:5e:be:80:3b:14
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user