This is outdated information, though the concepts are valid. A script implmenting these concepts for OpenConnect 8 on Ubuntu 18 (bionic) and 19 (eoan) is available
The steps in this guide are available as an autobuild shell script
#!/usr/bin/env bash | |
git clone https://github.com/Nyr/openvpn-install.git | |
cd openvpn-install/ | |
chmod +x openvpn-install.sh | |
# interactive! But also logs stdout/stderr to a log file for later review | |
sudo ./openvpn-install.sh 2>&1 |tee openvpn-install.log |
# requires: brew install librsvg | |
# inspired by: https://superuser.com/a/723031 | |
# change 1.0 to a zoom factor you want for clean zoom. Exact pixels possible, read man page | |
rsvg-convert -z 1.0 file.svg > file.png |
-- in iTerm2, create a profile named 'Alfred' with the settings you want | |
-- this script will create a new bash login environment using that profile and run the Alfred commands | |
-- in Alfred's preferences, go to Terminal, select Custom, and paste this script in | |
on alfred_script(q) | |
set text item delimiters to " " | |
set cmdline to q as text | |
tell application "iTerm" | |
create window with profile "Alfred" command "bash -lc " & quoted form of cmdline |
-- convert an AppleScript Date object to a POSIX date CCYYMMDDHHmm.SS | |
on posixDate(datetime) | |
-- date -j -f "%A, %B %e, %Y at %I:%M:%S %p" "Tuesday, September 1, 2015 at 11:00:00 AM" +%Y%m%d%H%M | |
set command to "date -j -f '%A, %B %e, %Y at %I:%M:%S %p' '" & datetime & "'" | |
set command to command & " +%Y%m%d%H%M.%S" | |
set thePosixDate to do shell script command | |
return thePosixDate | |
end posixDate |
#!/usr/bin/env bash | |
set -eu -o pipefail | |
## based on work by Mr. Macintosh: https://mrmacintosh.com/how-to-enable-the-mac-startup-chime-on-your-2016-macbook-pro/ | |
## hattip DaringFireball: https://daringfireball.net/linked/2020/02/25/mac-startup-chime | |
##======================================================================== | |
## To the extent possible under law, Darren Meyer has waived all copyright | |
## and related or neighboring rights to setchime.sh | |
##======================================================================== |
#!/usr/bin/env bash | |
## NOTE! OpenConnect is now on Version 8, and this is only for historical use | |
## See https://gist.github.com/darrenpmeyer/1a56d0d4817352998fe9d7cfe5a79684 for new script | |
oc_ver="7.08" | |
echo "Autobuild OpenConnect $oc_ver" | |
echo " " | |
echo "This script uses apt-get and make install via sudo rights" | |
echo "To simplify this, we're going to use sudo -v to pre-authenticate you" |
This is outdated information, though the concepts are valid. A script implmenting these concepts for OpenConnect 8 on Ubuntu 18 (bionic) and 19 (eoan) is available
The steps in this guide are available as an autobuild shell script
from __future__ import print_function | |
# the string to check is in 'candidate' | |
if isinstance(candidate, type(u"")): | |
print("This is a unicode string") | |
else: | |
# if it's a Py2 'str' or a Py3 'bytes' object, this will convert | |
# otherwise it'll raise an exception | |
candidate = candidate.decode('utf8') | |
function FindProxyForURL(url, host) { | |
if (dnsDomainIs(host, ".i2p")) { return "HTTP localhost:4444"; } | |
if (dnsDomainIs(host, ".onion")) { return "SOCKS localhost:9050"; } | |
return "DIRECT"; | |
} |
NOTE the cron
command scheduler is considered deprecated by Apple,
in favor of using Launch Agents along with launchd
. There is a decent
launchd tutorial at launchd.info if you want to
do that instead.
Cron jobs usually need to work outside of the macOS "sandbox", accessing scripts and files across the filesystem. macOS supports Unix filesystem permissions, but there's an additional safety gate that's evaluated