document my macOS scripts
- ID
c46be2e- date
2023-05-02 18:38:28+00:00- author
Alex Chan <alex@alexwlchan.net>- parent
30e916b- message
document my macOS scripts- changed files
6 files, 64 additions, 53 deletions
Changed files
macos/README.md (0) → macos/README.md (1628)
diff --git a/macos/README.md b/macos/README.md
new file mode 100644
index 0000000..e53b78d
--- /dev/null
+++ b/macos/README.md
@@ -0,0 +1,62 @@
+# macos
+
+These scripts are all for doing stuff on macOS.
+They rely on Mac-specific stuff and are unlikely to be useful on non-Mac systems.
+
+## The individual scripts
+
+<dl>
+ <dt>
+ <a href="https://github.com/alexwlchan/scripts/blob/main/macos/battery">
+ <code>battery</code>
+ </a>
+ </dt>
+ <dd>
+ alias for <code>pmset -g batt</code>; reports the current battery level
+ </dd>
+
+ <dt>
+ <a href="https://github.com/alexwlchan/scripts/blob/main/macos/find_processes_using_secure_input">
+ <code>find_processes_using_secure_input</code>
+ </a>
+ </dt>
+ <dd>
+ lists any processes using Secure Input, which can block apps like TextExpander
+ </dd>
+
+ <dt>
+ <a href="https://github.com/alexwlchan/scripts/blob/main/macos/get_all_live_text">
+ <code>get_all_live_text [directory]</code>
+ </a>
+ </dt>
+ <dd>
+ get OCR'd text for all the images in a directory using Live Text
+ </dd>
+
+ <dt>
+ <a href="https://github.com/alexwlchan/scripts/blob/main/macos/get_focus_mode">
+ <code>get_focus_mode [directory]</code>
+ </a>
+ </dt>
+ <dd>
+ returns the current Focus mode
+ </dd>
+
+ <dt>
+ <a href="https://github.com/alexwlchan/scripts/blob/main/macos/get_live_text">
+ <code>get_live_text [image]</code>
+ </a>
+ </dt>
+ <dd>
+ get OCR'd text for a single image using Live Text
+ </dd>
+
+ <dt>
+ <a href="https://github.com/alexwlchan/scripts/blob/main/macos/set_accent_colour">
+ <code>set_accent_colour (red|orange|yellow|green|blue|purple|pink|graphite)</code>
+ </a>
+ </dt>
+ <dd>
+ set the accent colour, as configured in the Appearance settings
+ </dd>
+</dl>
macos/find_processes_using_secure_input (3069) → macos/find_processes_using_secure_input (3066)
diff --git a/macos/find_processes_using_secure_input b/macos/find_processes_using_secure_input
index f738fa6..f519dcb 100755
--- a/macos/find_processes_using_secure_input
+++ b/macos/find_processes_using_secure_input
@@ -22,7 +22,7 @@ It relies on two interesting commands:
prints the executable name associated with a process ID (pid), which is
used for the output
-See https://alexwlchan.net/2021/04/secure-input/
+See https://alexwlchan.net/2021/secure-input/
"""
macos/get_all_live_text (2341) → macos/get_all_live_text (2338)
diff --git a/macos/get_all_live_text b/macos/get_all_live_text
index 2b70176..e37f715 100755
--- a/macos/get_all_live_text
+++ b/macos/get_all_live_text
@@ -2,7 +2,7 @@
"""
Get OCR'd text for all the images in a directory using Live Text.
-See https://alexwlchan.net/2022/12/live-text-script/
+See https://alexwlchan.net/2022/live-text-script/
== Usage ==
macos/record_icloud_usage (164) → macos/record_icloud_usage (0)
diff --git a/macos/record_icloud_usage b/macos/record_icloud_usage
deleted file mode 100755
index 85958d2..0000000
--- a/macos/record_icloud_usage
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/usr/bin/env bash
-
-set -o errexit
-set -o nounset
-
-CAPACITY="$1"
-AVAILABLE="$2"
-
-echo "$(date +"%Y-%m-%dT%H:%M:%S %z"),$CAPACITY,$AVAILABLE" >> ~/iCloud/usage.csv
macos/show_icloud_usage (601) → macos/show_icloud_usage (0)
diff --git a/macos/show_icloud_usage b/macos/show_icloud_usage
deleted file mode 100755
index 81da1e5..0000000
--- a/macos/show_icloud_usage
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/usr/bin/env python3
-
-import csv
-import os
-
-import dateparser
-import matplotlib.pyplot as plt
-
-
-if __name__ == '__main__':
- csv_path = os.path.join(os.environ['HOME'], 'iCloud', 'usage.csv')
-
- with open(csv_path) as infile:
- reader = csv.DictReader(infile)
- rows = [
- (dateparser.parse(r['date']), int(r['capacity']) - float(r['available']))
- for r in reader
- ]
-
- f, ax = plt.subplots(1)
-
- times = [t for (t, _) in rows]
- values = [used_space for (_, used_space) in rows]
-
- ax.plot(times, values)
- # ax.set_ylim(ymin=0)
- plt.show()
macos/temperature (404) → macos/temperature (0)
diff --git a/macos/temperature b/macos/temperature
deleted file mode 100755
index 7dec156..0000000
--- a/macos/temperature
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/usr/bin/env bash
-# This is a simple alias for getting CPU temperature. It prints the
-# current temperature of the CPU:
-#
-# CPU die temperature: 83.66 C
-# CPU die temperature: 80.61 C
-# CPU die temperature: 80.48 C
-#
-# See https://beebom.com/how-check-cpu-temperature-mac/
-# See also: battery
-
-set -o errexit
-set -o nounset
-
-sudo powermetrics --samplers smc |grep -i "CPU die temperature"