You know how macOS Safari has that great feature (I believe credit goes to other browsers, for getting it earlier), where when you quit the app (or restart or it crashes), and when you start it up again, all your windows are right back where they were? And what a huge weight off your mind that is?
My Mac just had a Kernel Panic, and when I restarted, all the windows were gone - what a feeling of letdown and loss.
Luckily, I remembered another feature - which is apparently built on the same saved data:
History -> Reopen Last Closed Window
(If you like command-key shortcuts: shift - command - T)
And - faith restored: It saves a _bunch_ of them; just keep hitting it, to open the N last closed windows.
I don't know what the max of N is, but I did about 30, no sweat.
Phew!
2019/11/22
2019/02/07
more about delight in the Apple Human Interface
Cool; I just used the "Back" function in Apple's Safari web browser - and happened to be paying attention enough, to see that what it actually did, was what I _wanted_, rather than what I asked for:
I happened to be in a tab created by a command-click of a URL in the previous tab; there was no "back" in this case - so it did _exactly_ the right thing - it closed the tab and returned me to the previous tab.
This is precisely the thoughtful design that Apple is known for:
A delight if you will - which is actually an explicit part of the official Apple Human Interface Guidelines.
That's a lot of hard work, which is usually (by design!) unnoticed - the point is not the device, but what _you_ want to do with it.
Although, every once in awhile, it's nice to appreciate - thanks, folks!
I happened to be in a tab created by a command-click of a URL in the previous tab; there was no "back" in this case - so it did _exactly_ the right thing - it closed the tab and returned me to the previous tab.
This is precisely the thoughtful design that Apple is known for:
- Some of us (developers) know it directly, and know how much work it takes.
- And the rest of us who use a Mac, iPhone, iPad, etc., know it simply because, when the interface surprises us, it's usually a pleasant surprise.
A delight if you will - which is actually an explicit part of the official Apple Human Interface Guidelines.
That's a lot of hard work, which is usually (by design!) unnoticed - the point is not the device, but what _you_ want to do with it.
Although, every once in awhile, it's nice to appreciate - thanks, folks!
2019/01/03
Delving Into Outlook / Exchange Server-Side Rules
Got a lot of rules?
Tired of paging through the GUI, trying to find just which rule is (mis)handling those emails?
Here's how to get the "code" for the rules, as text:
Manual navigation (if the above URL doesn't work):
The file most people will be interested in, is "InBoxRules.txt"; here are some highlights from one:
Notes:
Tired of paging through the GUI, trying to find just which rule is (mis)handling those emails?
Here's how to get the "code" for the rules, as text:
Use OWA - something like this, modified for your realm:
https://outlook.office.com/owa/?realm=YOUR-REALM-HERE&path=/options/inboxrulesManual navigation (if the above URL doesn't work):
- InBox Rules (under Options > Mail > Automatic Processing - or use Help)
- At page bottom: "click here to generate a diagnostic report"
The file most people will be interested in, is "InBoxRules.txt"; here are some highlights from one:
- Name="the name you gave your rule"
- ExecutionSequence="101" <-- important; rules are executed in order
- StateFlags="Enabled, ExitAfterExecution" <-- no further rules will be used
- <Restriction
- SubType="RecipientRestriction" <-- this rule is based on recipient
- <Action…
- Type="OP_MOVE"
- FolderName="Deleted Items" <-- and the action is to delete the msg
Notes:
- An XML browser helps a lot; I use BBEdit.
- Yes; this is read-only - you do have to go back to the GUI to make any changes.
- Since this web UI shows the contents of rules as text, it may be enough to use it directly (ex: using the browser's "Find" function) - with the added benefit of being able to make any desired changes directly. It is however, necessary to click through each rule, to see the full definition...
- My previous post may also be helpful: How-To recover / export Outlook for Mac "Smart Folder" AKA "Saved Search" configs
2018/12/10
How-To recover / export Outlook for Mac "Smart Folder" AKA "Saved Search" configs
Apparently there's no way to export this part of the Outlook config directly. :/
However there are some strings to pull on, which can help:
There are "links" to the config data, in a sqlite DB, which can be seen like so:
(The "UBF8T346G9" above, may vary?)
Even better, the "Smart Folder" configs (including, apparently, those that have been deleted?) are stored in this directory (for recent versions of Outlook for Mac):
Interesting note: This exposes the "Raw Query" syntax (leveraging Spotlight / mdfind), which can be a learning opportunity, for creating more interesting searches (since Raw Query docs are a wee bit sparse).
However there are some strings to pull on, which can help:
There are "links" to the config data, in a sqlite DB, which can be seen like so:
sqlite3 ~/'Library/Group Containers/UBF8T346G9.Office/Outlook/Outlook 15 Profiles/Main Profile/Data/Outlook.sqlite' 'select * from SavedSpotlightSearch'
(The "UBF8T346G9" above, may vary?)
Even better, the "Smart Folder" configs (including, apparently, those that have been deleted?) are stored in this directory (for recent versions of Outlook for Mac):
~/'Library/Group Containers/UBF8T346G9.Office/Outlook/Outlook 15 Profiles/Main Profile/Data/Saved Searches/'
As a cheap hack, here's what I did, to recover the searches from one Mac, and implement on another:
- Dump the data; ex:
find ~/'Library/Group Containers/UBF8T346G9.Office/Outlook/Outlook 15 Profiles/Main Profile/Data/Saved Searches' -type f | while read -r thePath; do echo; echo; ls -ld "$thePath"; cat "$thePath" | tr -d '\000' | tr -cs "[:print:]" '\n' | egrep -v '^[[:blank:]]*$' | sed 's/\([^ (]\)(/\1\'$'\n(''/g' | sed 's/)\([^ )]\)/)\'$'\n''\1/g'; done(Removes NULLs; translates non-printing chars to LFs; removes extraneous LFs; puts "sections" on separate lines - a bit hacky, since there's no docs that I can find, for this file format.) - Interpret the needed bits; more info below.
- The data is apparently in two-byte characters - the above is a cheap hack which works in ASCII anyway. :/
- Near the top, is some definitory info, like the
com_microsoft_outlook_folderIDto search in. (You may be able to deduce the correct folders, without having to figure out how to determine which folder corresponds to which ID.) - Then the "Smart Folder" name.
- Then, finally, the search / query itself - there's a bit "encoding" here too, so not quite "cut and paste". :/
And since (on a Mac) these are stored in the "Raw Query" format, which uses the underlying Spotlight metadata, here's the official Apple doc on the File Metadata Query Expression Syntax.
2018/10/26
git-crypt works smoothly - until it doesn't
Some repos use git-crypt to encrypt secrets; they are committed in encrypted form, and decrypted locally, auto-magically, using GPG keys.
This magic is, shall we say, simple until it's not -- in "interesting" ways.This is written from the point-of-view of someone inheriting an existing config - which broke, due to multiple keys.
In the hope of saving someone else their sanity, here are a few learnings.
(Which are hopefully even correct.)
We'll start with the easy stuff; then, well, Buckle up...
How to get started as a new collaborator:
- brew install git-crypt
- install the "GPG Suite"
- generate a key pair
- upload your new public key to the interwebs
- give public key to an existing collaborator, who must:
- add the new user to their GPG keychain
- sign the new user's key
git-crypt add-gpg-user --trusted USER_ID- Use '--trusted' to avoid dependency of public "Web of Trust"
- (Yes; this is potentially less secure.)
- The USER_ID above is usually the email address that the user configured their GPG keypair with
- add-gpg-user should result in output like this:
[master 30babf07] Add 1 git-crypt collaborator
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 .git-crypt/keys/default/0/72E278AE2FB3...8F90BB21B36FD67.gpg
How was git-crypt set up in the first place?
(See above for a bit more detail on some of these steps, such as expected output.)- brew install git-crypt
- navigate to the repo you want to use git-crypt with
git-crypt init- Note: This creates a symmetric key.
- add the first GPG user:
git-crypt add-gpg-user --trusted ADMIN-USER_ID- This user must exit already in GPG.
- You might consider this the "admin" user; they'll be the only one to be able to decrypt secrets, add more users, etc. - until other users are added.
- Why yes; it would be a good idea to add more people - say, if this person leaves the organization.
- unlock, using new GPG key (will prompt for that key's passphrase):
git-crypt unlock - config a
.gitattributesfile with contents likesecretfile* filter=git-crypt diff=git-crypt- the
.gitattributesfile defines which files are to be encrypted - And must be in place BEFORE adding a file that must be encrypted.
- the
git add .gitattributes- commit and push:
git commit -m 'your comment here'; git push
A few notes:
- what causes the encryption to actually take place?
- See the notes on the
.gitattributesfile, above.
- See the notes on the
- check encryption status (for
encrypted files, GITCRYPTshows at the top): git-crypt status -e | awk '{print $2}' | while read thePath; do echo $thePath\: $(cat $thePath | xxd -l 9); done- Warning: You could push the change and confirm it's encrypted in the web UI - except if it's not, that secret is now forever* ensconced in your repo. (*How to remove secrets from a repo - AKA: It's too late.)
- GPG items in MacOS keychain, are not named with "GPG", but with "GnuPG"
- we're using GPG here (not PGP); it makes little difference to the procedure (ex: a GPG fingerprint is not for GPG only)
- if freshly cloned, need to
git-crypt unlockagain (default state is locked) - who's got access?
ls -l .git-crypt/keys- each filename contains a user's fingerprint (look that up, on a keyserver)
- Trouble getting file to actually encrypt?
git-crypt status -fgit-crypt lock --force- "Touching the file and re-committing it forces git-crypt to re-encrypt it"
- Seeing errs like: "
still unencrypted even after staging" OR "encrypted file has been tampered with" OR "Warning: one or more files is marked for encryption via .gitattributes but was staged and/or committed before the .gitattributes file was in effect" ?- unstage (ex:
git reset HEAD secrets.yml) - redo the dance with
git-crypt status -fandgit-crypt lock --force - maybe start from a fresh clone - and save aside, any files that are unencrypted
- be certain the file is really encrypted before using
git add filename
- unstage (ex:
- But
git-crypt status -esays the files are encrypted! - NO; it's only saying that those files are configured to be encrypted
- check the contents to confirm if it's actually encrypted (see "check encryption status" above)
- getting an err like ERROR! Unexpected Exception: 'utf8' codec can't decode byte 0xd0 in position 11: invalid continuation byte ?
- Check your git-crypt config; if that's OK, reclone the repo (the git-crypt status may be hosed.)
How to reset the encryption on a repo:
Here be dragons; this should be avoided, but if you have to...- list files that have been encrypted:
git-crypt status -e | awk '{print $2}' > encrypted-files - make sure repo is in UNlocked state:
git-crypt unlock - save decrypted copies of all encrypted files; ex:
git-crypt unlock; tar czf ../saved.tgz ./ - if you don't have unencrypted copies anymore?
- get them from another collaborator, old unlocked copy of the repo, ...
- there is no known way to recover them otherwise
- remove all encrypted files; ex:
cat encrypted-files | xargs -t -n1 rm - remove all git-crypt files:
rm -rf .git-crypt .git/git-crypt - ? may be necessary to save & remove the
.gitattributesfile too? (doubtful) - commit:
git commit -a -m 'your comment here' - re-config git-crypt:
git-crypt init- Note that this creates a new symmetric key, stranding files encrypted with any other key.
- add the first AKA "admin" user:
git-crypt add-gpg-user --trusted ADMIN-USER_ID - unlock, using new GPG key:
git-crypt unlock - add any addtl users:
git-crypt add-gpg-user --trusted ONCE-PER-ADDTL-USER_ID - if you removed the
.gitattributesfile above, copy it (or its contents) back- the
.gitattributesfile must be in place BEFORE adding a file that must be encrypted.
- the
- copy decrypted files back in
- confirm files are decrypted:
git-crypt status -e | awk '{print $2}' | while read thePath; do echo $thePath\: $(cat $thePath | xxd -l 9); done- It may be helpful to make the files different (ex: add a comment) to help force encryption with new key...
- some extra git-crypt magic:
git-crypt status -f - make sure repo is in UNlocked state:
git-crypt unlock - force encryption:
git-crypt lock --force - CONFIRM FILES ARE ENCRYPTED (they'll show
GITCRYPT): git-crypt status -e | awk '{print $2}' | while read thePath; do echo $thePath\: $(cat $thePath | xxd -l 9); done- if not, see notes above - it will be messy if you add (or worse commit) unencrypted info
for each of the encrypted files: git add ...- commit & push:
git commit -a -m 'your comment here'; git push - you probably want to unlock again:
git-crypt unlock - after keys are reset, a possible solution to: checkout (ex: of a branch) fails with "encrypted file has been tampered with":
- make a fresh clone of the repo
- leave it locked
- checkout branch (ex: keys were reset on master, but old keys are left on your branch)
- cherry-pick the commits for the new keys & newly-encrypted files (in chron order?)
- then unlock
- a fresh clone is best; otherwise, something like this might help:
git-crypt lock --force; git stash; git pull
WHY would you ever want to reset the encryption on a repo??
- You somehow got secrets committed, with multiple symmetric keys (ex: ran
git crypt initmore than once). - You want to be safe, after a collaborator has left the project.
References:
2018/03/02
is your Mac waking on its own, draining battery and then just plain powering down?
I've twiddled every setting I can find, and this still happens:
- I close the lid of my MacBook,
- Carefully listen for the fan to stop...
- (Wish they'd kept the pulsing LED; that was an excellent design.)
- And only _then_ do I put it in my bag.
- Some time later, I pull it out - to find it hot and/or powered off. Yuck. :(
(Kudos to Apple for constructing macOS so solidly, that even when it powers down unexpectedly (still sub-optimal), it actually does come back quickly - even with unsaved work, ready to pick up where you left off. Nice.)
Recently, I've been watching this strange sleep behavior even more closely, and several times have witnessed this sequence:
- Close lid & listen for fan to stop...
- Keep listening; after a few more moments, the fan starts again!
- This sequence repeats
This seems to be new-ish behavior; as of the last few releases of macOS.
I've done everything I can find (details below), to get it to _stay_ asleep, but to no avail.
However I just found something new; from the man page of the pmset command:
ttyskeepawake - prevent idle system sleep when any tty (e.g. remote login session) is 'active'. A tty is 'inactive' only when its idle time exceeds the system sleep timer.
Yes; if I've got an ssh connection open to a remote host, for a command-line, I do indeed not want it to sleep - _except_ here's the new (to me) part:
ttyskeepawake is apparently for _any_ TTY - _not_ just those open via Terminal, as one might think; see the output, as a result of turning ttyskeepawake off:
Warning: This option disables TCP Keep Alive mechanism when sytem is sleeping. This will result in some critical features like 'Find My Mac' not to function properly.
Example command to turn it off (for all power sources):
pmset -a tcpkeepalive 0
I'll try this over some time, to see if my MacBook finally does stay asleep, safely...
Feedback / suggestions welcome!
3/12 update: Apparently the "sudo pmset -a standbydelay 259200" setting must be performed _while on battery_; if done while on AC / wall power, the on-battery setting is not affected. :/
3/12 update: Apparently the "sudo pmset -a standbydelay 259200" setting must be performed _while on battery_; if done while on AC / wall power, the on-battery setting is not affected. :/
- - -
Other settings I use (each on a single line), to try to make it sleep quickly, _and_ stay asleep:
sudo pmset -a hibernatemode 0 # do NOT use Safe Sleep; saving time to sleep (and save disk space), by not writing /var/vm/sleepimage
sudo pmset -a standbydelay 259200 # 3 days of sleep, before moving from sleep to hibernate - MUST BE DONE WHILE ON BATTERY
sudo nvram boot-args="darkwake=0" # disable "Dark Wake" (requires reboot)
sudo pmset -a womp 0 # disable "Wake On Magic Packet" (AKA "Wake-on-LAN", AKA "Wake for Wi-Fi Network Access" on recent MacBooks; also seen in the Energy Saver pane in System Preferences)
Also: A command line that I use, to see what the pmset log has, since the most recent sleep event:
telltale='Entering Sleep state'; lastSleep=$(pmset -g log | fgrep -i -e "$telltale" | tail -1 | sed "s/${telltale}.*/$telltale/"); if [ "$lastSleep" ] ; then pmset -g log | sed -n "/$lastSleep/,\$p"; else echo '[WARN: Did not find a Sleep event]'; fi
2017/11/13
Why did Skype hijack my phone?
I installed "Skype for Business" recently (required by my org) and everything seemed fine.
Some time later, I clicked on a phone number and selected "Call 888-555-1212using iPhone" from the contextual popup as usual - and Skype came up. Yuck.
After a _great_ deal of searching, I found that reverting to the default behavior (of actually calling with my iPhone...) is as simple as:
Some time later, I clicked on a phone number and selected "Call 888-555-1212
- Open the FaceTime app.
- Open its Preferences.
- Look for the "Default for calls" popup, at the bottom.
- Select "FaceTime".
2017/06/23
Stale NFS mounts
Think you've got a stale NFS mount, gumming up the works?
Maybe several mounts, you're not sure which is the problem, and your usual tools are not working (ex: they just hang)?
Try this one-liner (sudo / root is required for "lsof"):
Which should ID the culprit, and give you some info to help determine how to handle.
Notes:
- This unfortunately cannot simply be single-quoted, and executed via ansible. There's probably a way to add another level of quoting to address that, however I simply dropped the code in a file in my homedir, then ansible'd that.
- The "-b" option to "lsof" is essential, since it avoids blocking, which is almost certain in this circumstance.
- The "lsof" gives a simple count; if there are any, you may wish to repeat the "lsof" to actually show the open files.
- The mount's line from /etc/mtab should show some useful info, such as the IP address where the mount at least was, when it was made.
2016/10/12
Mac windows moved mostly off-screen when switching displays
Strange new behavior (to me anyway) since upgrading to macOS Sierra (10.12):
When I move between using my MacBook with a Thunderbolt display (only), and using it on with only the built-in display, it frequently leaves windows almost entirely off the side of the display. :/
(If it matters, this is with a sleep, between mode switches - like when moving between home and office.)
At no time was I using an extended desktop (multiple displays at once) - though it looks as if it somehow thinks it's in that mode. Though a trip to the Displays preference pane, shows that it is indeed using only only display.
(More than once, I've also seen this: Upon wake, I see the Desktop - but no menubar. Perhaps another indication that it's confused and thinks there's another display - which has the menubar.)
I found some interesting suggestions on this SuperUser thread though none of those worked for me, and I just created a new account there (coulda sworn I had one, but whatever), so couldn't post there yet :/ - hopefully this link helps.
What _did_ work for me: Simply "Hide" (in the app menu, just to the right of the Apple menu) any app with windows off-screen; when the app was shown again, the windows were moved back onto the current (only) screen.
In the process I also discovered the missing "Detect Displays" button, which was removed from the Displays preference pane at some point - press (and hold) the Option key. It had no effect on this issue, though maybe handy to know.
(I have heard of folks seeing this issue on other releases like "El Capitan" (10.11) - hope this helps!)
When I move between using my MacBook with a Thunderbolt display (only), and using it on with only the built-in display, it frequently leaves windows almost entirely off the side of the display. :/
(If it matters, this is with a sleep, between mode switches - like when moving between home and office.)
At no time was I using an extended desktop (multiple displays at once) - though it looks as if it somehow thinks it's in that mode. Though a trip to the Displays preference pane, shows that it is indeed using only only display.
(More than once, I've also seen this: Upon wake, I see the Desktop - but no menubar. Perhaps another indication that it's confused and thinks there's another display - which has the menubar.)
I found some interesting suggestions on this SuperUser thread though none of those worked for me, and I just created a new account there (coulda sworn I had one, but whatever), so couldn't post there yet :/ - hopefully this link helps.
What _did_ work for me: Simply "Hide" (in the app menu, just to the right of the Apple menu) any app with windows off-screen; when the app was shown again, the windows were moved back onto the current (only) screen.
In the process I also discovered the missing "Detect Displays" button, which was removed from the Displays preference pane at some point - press (and hold) the Option key. It had no effect on this issue, though maybe handy to know.
(I have heard of folks seeing this issue on other releases like "El Capitan" (10.11) - hope this helps!)
2015/04/08
SEO (search engine optimization) musings
i just did a web search for a topic where i don't have very much context to judge how relevant / reliable the results are
of course i reflexively ignored the paid results
for the "organic" results, if it's a topic i am familiar with, i may glance briefly at the top results - mostly for entertainment value, at the ridiculous junk that manipulated its way to the top
however, with something unfamiliar, i hovered briefly over the top "organic" result, wondering if it was worth the effort to click through to see how useful it might be
given the rampant manipulation behind high ranking, i wonder how many of us also reflexively ignore the top N organic results
of course i reflexively ignored the paid results
for the "organic" results, if it's a topic i am familiar with, i may glance briefly at the top results - mostly for entertainment value, at the ridiculous junk that manipulated its way to the top
however, with something unfamiliar, i hovered briefly over the top "organic" result, wondering if it was worth the effort to click through to see how useful it might be
given the rampant manipulation behind high ranking, i wonder how many of us also reflexively ignore the top N organic results
Labels:
coping,
search,
SEO,
social engineering
Subscribe to:
Posts (Atom)