Preview in macOS Catalina cannot save some PDFs, #

returning errors like "The document 'foo.pdf' could not be saved as 'bar.pdf'." and "The file couldn't be saved." Previous and succeeding versions of macOS/Preview do not suffer from this bug, saving the same PDF file without complaint, albeit with significant bloat even when simply duplicating:

Preview's "Export as PDF..." or the print dialog's "Save as PDF" are often cited as solutions, but those methods resulted in the largest PDFs of all, at 974KB and 975KB respectively.

Iman Mahmoudinasab's unjustifiably-low-scoring answer on Ask Different contained the necessary clue: "Another common reason for this issue is the PDF file is password protected." Rather than relying on the recommended cloud-based service ("Try 7 days free"), I used qpdf:

% qpdf --show-encryption in.pdf
...
modify document assembly: not allowed
modify other: not allowed
modify anything: not allowed
% qpdf --decrypt in.pdf out.pdf

The resultant PDF (which could be freely duplicated, saved, etc.) was actually smaller than the original, at just 269KB.

While Acrobat PDF owner passwords are easily bypassed as in this case, user passwords require decryption:

The standard security provided by Acrobat PDF consists of two different methods and two different passwords: a user password, which encrypts the file and prevents opening, and an owner password, which specifies operations that should be restricted even when the document is decrypted, which can include modifying, printing, or copying text and graphics out of the document, or adding or modifying text notes and AcroForm fields. The user password encrypts the file, while the owner password does not, instead relying on client software to respect these restrictions. An owner password can easily be removed by software, including some free online services. Thus, the use restrictions that a document author places on a PDF document are not secure, and cannot be assured once the file is distributed; this warning is displayed when applying such restrictions using Adobe Acrobat software to create or edit PDF files.

/mac | Dec 28, 2021

Run Tiger, Leopard, or any Mac OS X PowerPC version on M1 #

posted to the docs section.

/mac | Nov 21, 2021

Drag and drop files onto batch script to add file extension #

Appends ".jpg" to files dragged and dropped onto the saved script's icon:

@echo on
for %%I in (%*) do ren %%I "%%~nI.jpg"
pause

From Microsoft's 'for' documentation:

Simple, but perhaps a trifle cavalier, without any sanity checks or filetype awareness. By leveraging exiftool, we can improve on things a bit:

@echo on
for %%I in (%*) do exiftool.exe "-filename<$filename.$filetypeextension" -r -ext . %%I
pause

H/T:

/windows | Nov 20, 2021

Make your needs few and your wants fewer #

 

/misc | Nov 18, 2021

Excel VBA: Intermittent "PasteSpecial method of Range class failed" error #

Proposed solutions abound for "Run-time error '1004': PasteSpecial method of Range class failed", which, intermittently yet relentlessly, plagued an XLSM spreadsheet when pasting user-selected rows via VBA.

Buried in a previously 0-rated Stack Overflow question and answer pair, PASUMPON V N graciously unveiled the mystery:

Since you are copying large amount of data, you need to clear the memory after...pasting the values.

Please use the below code at the end of pastespecial line

Application.cutcopymode = False
Application.cutcopymode = True

It appears that the second line can, and probably should, be excluded:

Application.CutCopyMode = True either does nothing at all or it does the opposite of what you think it does.

/windows | Oct 28, 2021

Monterey: "A required firmware update could not be installed." #

If you've replaced the Apple SSD in your Mac with a third-party model and attempt to install Monterey, you may receive an error like:

To resolve, reinstall an Apple SSD, install Monterey, reinstall your third-party SSD, and install Monterey:

Updates:

/mac | Oct 27, 2021

Decode hundreds of file formats and convert or extract content #

Deark is a portable command-line utility that can decode certain types of files, and either convert them to a more-modern or more-readable format, or extract embedded files from them. It also has an option (-d) to display detailed information about a file’s contents and metadata. It’s free and open source.

The demo digs through Inception-like layers in fbm-1.2.tgz to identify and convert a Sun raster image to PNG.

~250 formats, from obscure (BMI, TN3, etc.) to common (MP3, PNG, etc.), are supported:

UPDATE: More tools in the same vein:

/nix | Oct 22, 2021

"I have never lied." #

Updates

Related

/misc | Oct 21, 2021

When facts are the enemy #

Researchers say Hawaii Health Department officials have refused to share COVID-19 data

Emphases addded:

Local epidemiologists and researchers say the Hawaii Department of Health has continually rebuffed their requests for data throughout the COVID-19 pandemic and that the department's latest decision to scale back the information it has been releasing to the public daily on COVID-19 deaths is just the latest example of the department's lack of openness.

"All I can tell you is how absolutely frustrated we are," said DeWolfe Miller, an infectious disease epidemiologist and professor at the University of Hawaii.

...

For instance, researchers were hoping to get data on the number of people who were hospitalized with COVID-19 broken down by vaccination status and age, which could help to better calculate the efficacy of the vaccines on different age groups, said Sumner La Croix, a research fellow at the University of Hawaii Economic Research Organization and economics professor at UH Manoa. But he said state health officials have declined to provide it.

"What is really clear to me is that DOH doesn't really want any independent investigators actually looking at the data," said La Croix. "They really don't want anyone second guessing their decisions."

Department of Health officials didn't respond to a request for comment about the criticism, which reached a new height this weekend when the department announced that it would no longer be sending out the detailed information it had been providing for months about COVID-related deaths. A department spokesman, in an email to the media on Sunday, cited the "volume of COVID-19 cases and COVID-19 related deaths" as the reason for no longer sending out the information, even though case counts have declined markedly over the past four weeks.

The daily emails included the age range of the person who died, the county where they died, hospitalization status, gender and whether they had underlying conditions.

Hawaii adopts most extreme open records limits amid pandemic

Hawaii has the lowest COVID-19 infection rate of any state in the nation. It's also a pandemic standout for a more dubious reason: instituting the most extreme restrictions on the public's access to official records.

In March 2020, Hawaii Gov. David Ige issued an emergency proclamation suspending the state's three-decades-old open records law, which aims to protect the public interest by exposing government to scrutiny.

The suspension came just as people were thirsty for information about what the government was doing to respond to the public health crisis, said Brian Black, executive director of the Civil Beat Law Center for the Public Interest.

UPDATE:

The C.D.C. Isn't Publishing Large Portions of the Covid Data It Collects

For more than a year, the Centers for Disease Control and Prevention has collected data on hospitalizations for Covid-19 in the United States and broken it down by age, race and vaccination status. But it has not made most of the information public.

When the C.D.C. published the first significant data on the effectiveness of boosters in adults younger than 65 two weeks ago, it left out the numbers for a huge portion of that population: 18- to 49-year-olds, the group least likely to benefit from extra shots, because the first two doses already left them well-protected.

/misc | Oct 07, 2021

"Seriously, y'all. Trust the science." #

posted to the docs section.

/misc | Oct 04, 2021

"First, they ignore you. Then, they abuse you. Then, they heap you with honors." #

Attributed to Jean Cocteau

  1. Ignored
  2. Abused
  3. Honored

Related

/misc | Oct 03, 2021

Dispatches from Dostoyevsky, Shaw, & Twain to the remnant #

UPDATES:

/misc | Sep 27, 2021

Goodbye, iMessage #

Related

/misc | Sep 07, 2021

Batch download HN comments you've upvoted #

While this post describes how to bulk download comments you've upvoted on Hacker News, the process is virtually identical for upvoted submissions - the URL format is just slightly different, e.g., https://news.ycombinator.com/upvoted?id=miles&p=2 (though there are apparently better ways of downloading upvoted submissions - see Related section below.)

1. Get cURL (complete with cookie) from web browser

  1. Log in to Hacker News and open your profile page

  2. Open the network tab in your web browser's dev tools (e.g., Safari: Develop → Show Web Inspector → Network ⓐ)

  3. Click the "comments (private)" link on your profile page1

  4. In the network tab, right click "upvoted" ⓑ then click "Copy as cURL" ⓒ:
    Safari Network tab

2. Download upvoted comments

Paste cURL command from clipboard into a for loop2 like the one below, making sure to:

  1. specify the desired range of comment pages to download (e.g., 7 to 11)
  2. add --compressed3 to the curl command (if HTTP compression is specified, as below4)
  3. change the single quotes to double quotes around the URL
  4. append &p=${i} to the URL
  5. append -o ${i}.htm to the last line of the cURL command
for i in {7..11}; do
curl --compressed "https://news.ycombinator.com/upvoted?id=miles&comments=t&p=${i}" \
-X 'GET' \
-H 'Cookie: user=miles&XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' \
-H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' \
-H 'Accept-Encoding: gzip, deflate, br' \
-H 'Host: news.ycombinator.com' \
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.2 Safari/605.1.15' \
-H 'Accept-Language: en-us' \
-H 'Referer: https://news.ycombinator.com/' \
-H 'Connection: keep-alive' -o ${i}.htm
; sleep 5; done

Footnotes

  1. The URL for the first page of upvoted comments looks like https://news.ycombinator.com/upvoted?id=miles&comments=t, while subsequent pages have &p=# appended, e.g., https://news.ycombinator.com/upvoted?id=miles&comments=t&p=2.

  2. HN rate limits requests, so throttling is necessary (otherwise, you will receive a "Sorry, we're not able to serve your requests this quickly." response and ultimately your IP address may be banned). While wget offers a --wait=seconds option, the closest curl comes is --limit-rate <speed>, which sadly did not prevent the warning from occurring when sequencing, even at rates as slow as 1000 bytes per second, hence the for loop with delay. See Implement wget's --wait, --random-wait #5406.

  3. Otherwise, files are saved as compressed, necessitating something along the lines of gzip -d -f -S "" * to decompress. [1, 2, 3, 4]

  4. Without -H 'Accept-Encoding: gzip, deflate, br' \, 5-6 times the bandwidth is used to download uncompressed HTML.

Sources

Related

/nix | Sep 05, 2021

When did ivermectin go from "wonder drug" to "horse dewormer"? #

October 2015 - July 2021:

August 2021:

Related

Updates

/misc | Aug 28, 2021

Apple has surpassed Facebook and Google in violating user trust. #

In one fell swoop, Apple destroyed its reputation for privacy and security, surpassing even Facebook and Google in violating user trust:

and then had the temerity to not only blame critics for their "misunderstanding", but also to call the scheme an "advancement" in privacy!

Apple has promised to refuse government demands to expand the surveillance, but their record is not exactly reassuring:

not to mention that the technology itself is fundamentally broken:

inexorably leading to such outcomes as:

As Ars explains:

[T]he system's current design doesn't prevent it from being redesigned and used for other purposes in the future. The new photo-scanning technology itself is a major change for a company that has used privacy as a selling point for years and calls privacy a "fundamental human right."

NebajX pierces to the very heart of the matter:

Do we allow police a daily search of our homes because we have nothing to hide?

It’s now crystal clear why Apple tried to exclude dozens of its own processes from network monitoring last year; to pave the way for total (and leaky and dangerous) control over our digital lives.

Addendum

Topping it all off, the system as currently sold is simply farcical on the face of it:

Updates

/mac | Aug 26, 2021

macOS boots to black screen with black cursor #

(TL;DR: Moved AppleIntelHD4000Graphics.kext out of /System/Library/Extensions/)

After a bit of a tumble, a MacBook Pro (13-inch, Mid 2012) started up to a folder with a flashing question mark. Replaced the internal drive with a new SSD and installed Catalina normally.

On first boot, rather than Setup Assistant, a black screen with a black cursor appeared (though Voice Over instructions could still be heard). Reset SMC and NVRAM to no avail. Repeated clean install with Mojave then Catalina again - same result.

Tried booting into safe mode, which worked (though of course not all features were available). Tried forcing safe mode on every boot (via nvram boot-args="-x" in macOS Recovery), but performance was poor and lack of sound was a show-stopper.

Assuming a problem with the integrated Intel HD Graphics 4000 GPU (unlike the 15" 2012 MacBook Pro, the 13" does not have a discrete GPU), looked for the corresponding kernel extension in /System/Library/Extensions/.

AppleIntelHD4000Graphics.kext sounded promising; booted back into macOS Recovery, disabled SIP, moved the kext into another directory, touched /System/Library/Extensions/ for good measure*, enabled SIP, and rebooted - success! - everything but sleep functioned well.

* According to the kextcache manpage, this is the same as kextcache -i os_volume, which will "rebuild out-of-date caches and update any helper partitions associated with os_volume."

Sources

Related

/mac | Aug 23, 2021

Al-Ma'arri on ahimsa #

If ye unto your sons would prove,
By act how dearly them ye love,
Then every voice of wisdom joins,
To bid you leave them in your loins.

***

Thou art diseased in understanding and religion. Come to me, that thou mayst hear the tidings of sound truth.
Do not unjustly eat what the water has given up [i.e., fish], and do not desire as food the flesh of slaughtered animals,
Or the white (milk) of mothers who intended its pure draught for their young, not for noble ladies.
And do not grieve the unsuspecting birds by taking their eggs; for injustice is the worst of crimes.
And spare the honey which the bees get betimes by their industry from the flowers of fragrant plants;
For they did not store it that it might belong to others, nor did they gather it for bounty and gifts.
I washed my hands of all this; and would that I had perceived my way ere my temples grew hoar!

***

O fools, awake! The rites ye sacred hold
Are but a cheat contrived by men of old,
Who lusted after wealth and gained their lust
And died in baseness—and their law is dust.

Selections from Maʿarrī's poetry found on pages 139, 134, and 173 respectively in Reynold Alleyne Nicholson's Studies in Islamic Poetry. Cambridge: University Press, 1921.

/misc | Aug 23, 2021

The world #

Here's a tanka for today by "Herbert, a retired chemist":

Consumed with anger,
The world is an ugly place.
Bathed in happiness,
The world is a wonderful place.
But, aha! the same world.

— Found on page 203 of Taitetsu Unno's Shin Buddhism : Bits of Rubble Turn to Gold. New York: Doubleday, 2002.

/misc | Jul 17, 2021

Mechanical meditation timers: gongs, cymbals, bells, and bowls #

/misc | Jun 17, 2021

Who exactly are "they"? #

Alexandra David-Néel in The Secret Oral Teachings in Tibetan Buddhist Sects:

In reality, although the well-read among them deny it, some of those who call themselves Buddhists—Mahayanists of the Northern countries as well as Theravadins of the South—have practically remained attached to the belief in a jiva,4 that is to say in an ego, an entity which transmigrates from life to life, forsaking its material body at the moment of death "as one throws away wornout clothing to put on new clothes".5

4 The equivalent of that which Westerners call the soul. Jīvātman is the principle which gives life to the body, and that which, according to the Hindus, is reincarnated. The Jīvātman is, according to the Vedanta, the Paramātman in its individualised form.
5 Bhagavad Gîta II, 22.

This belief is, however, formally and continually denied by the Doctrine of the Buddha, of which Doctrine the negation of the ego is the fundamental article and marks it off from the orthodox Hindu doctrines.

The Buddhist creed, as a matter of fact, consists of two short, incisive statements:

"All aggregates are impermanent"
"All things are devoid of self (atman: "ego" or "soul")".

This means that if we discard the component elements which form that which we call a man, a horse, a tree, a mountain, a star, or no matter what, if we abstract the qualities which make them perceptible to us, we discover nothing which is distinct from these constituent elements, from these qualities, we do not, in any way, find the man, the horse, the mountain in itself. These names apply only to a collection of elements.

...

[I]f from a man you take away the physical form, sensation, perception, mental activity and consciousness, what remains? Where will you find the man existing in himself outside the corporality and mentality?

In the Secret Teachings great importance is attached to propounding this negation of the ego as a fundamental doctrine. Those who lag behind in the belief in an ego, it is said, do not understand the meaning of the Teaching, they are in no way Buddhists, they cannot attain to liberation, to salvation, for without understanding (of a transcendent insight) of this absence of any ego, they will not perceive the means by which to go beyond being and non-being. [emphasis added]

Since, according to the author, there is no in-dwelling self/atman/ego/soul, who exactly are "those who lag behind", who "cannot attain to liberation, to salvation", who "will not perceive the means by which to go beyond being and non-being"?* Why, according to her, there are no such beings!—simply impermanent, arbitrary aggregates.

Note too the confusion and conflation of "soul" and "ego" for "atman", which is more accurately described as:

Ātman, sometimes spelled without a diacritic as atman in scholarly literature, means "real self" of the individual, "innermost essence", and soul. Atman, in Hinduism, is considered as eternal, imperishable, beyond time, "not the same as body or mind or consciousness, but... something beyond which permeates all these". In Advaita vedanta, it is "pure, undifferentiated, self-shining consciousness," the witness-consciousness which observes all phenomena yet is not touched by it.

The foregoing conflict results in such mental gymnastics as:

The tulku, on the contrary, is the incarnation of a lasting energy directed by an individual with the object of continuing a given kind of activity after his death. The tulku does not coexist with his ancestor.

and casual attempts to dismiss reincarnation out of hand:

An amusing point to note on this subject is that the person "reincarnated" generally boasts of having been, in his preceding lives, an important personality, or even several such in succession. No one seems to remember having been an obscure cobbler or a humble farm labourer. At least one does not hear of such.

In fact, such ordinary existences are just about all one does hear of in the research:

* Cf. this dialogue on HN.

/misc | Jun 05, 2021

Two GIF processors added to graphics page #

/windows | May 24, 2021

Remove loop from animated GIF #

with Gifsicle:

$ gifsicle in.gif --no-loopcount > out.gif

/mac | May 23, 2021

Emulating Windows XP x86 under M1 Mac via UTM & QEMU #

While VMWare does not plan to support x86 emulation on M1 Macs and Parallels support staff only offers misdirection when asked, thanks to UTM & QEMU you can emulate x86/x64 Windows versions like XP and 7 on Apple silicon right now:

  1. Download UTM, the requisite template (Windows XP in this example), and SPICE Guest Tools and QEMU Drivers for Windows.
  2. Unzip windows-xp-x64-utm.zip and open Windows XP.utm in UTM.
  3. Click "CD/DVD" at the bottom of the window and select your Windows XP installer ISO.
  4. Start the VM and install Windows normally (if Windows hangs after installation with "Please wait", turn the VM off and on again).
  5. Replace the Windows XP installer ISO with the SPICE tools ISO (spice-guest-tools-0.164.iso) and run spice-guest-tools-0.164.exe.

The result is surprisingly performant: MP4 | GIF

Notes

Related

/mac | May 22, 2021

Added to system page: New Linux-on-a-floppy distro #

🌱 Floppinux 0.1.0 [1440k] {S}+ "An embedded Linux on a single floppy". Released May 2021. Includes build instructions. 📺 | HN discussion

/nix | May 22, 2021

Rare addition to the graphics page #

μGiffer 0.9.12 [108k] + Simple screen-to-GIF recorder by the author of Bvckup 2 and Hamachi. 📺

/windows | May 08, 2021

Bluetooth promixity lock for macOS #

Takeshi Sone has generously crafted and shared (under an MIT license) BLEUnlock, "a small menu bar utility that locks and unlocks your Mac by proximity of your iPhone, Apple Watch, or any other Bluetooth Low Energy device." Unlike Unlox (formerly MacID), no iOS app is required and scripting is supported. Vital for protecting data from laptop snatchers. For a wired solution, see Introducing BusKill: A Kill Cord for your Laptop.

/mac | May 06, 2021

How do you measure, ♫ measure a kalpa? #

/misc | May 04, 2021

DLL & dependency horrors #

/windows | May 01, 2021

Identifying unknown devices in Windows #

See also:

/windows | Apr 26, 2021

Carbon Copy Cloner and SuperDuper! ignore EFI partitions #

When making a bootable clone with Carbon Copy Cloner or SuperDuper!, EFI partitions are skipped, since they aren't needed for macOS boot disks:

Though modern Macs support ... EFI booting in order to maintain compatibility with running non-Apple operating system[s] on their hardware, they do NOT need the EFI partition in order to boot [m]acOS. Because of this, the disk clone utilities do not copy the contents of the secondary EFI partition from one drive to another when doing their job.

However, this is problematic when cloning boot disks like the one produced by Ben Sova's Patched-Sur, which depend on the EFI partition for critical functionality.

Here's how to clone the EFI partition as well:

  1. Partition (GUID) and format (HFS+) the target disk

  2. Use Carbon Copy Cloner to clone the source disk to the target disk

  3. Mount the source and target EFI partitions

    % diskutil list
    ...
    /dev/disk2 (external, physical):
       #:                       TYPE NAME                    SIZE       IDENTIFIER
       0:      GUID_partition_scheme                        *126.7 GB   disk2
       1:                        EFI ⁨EFI⁩                     209.7 MB   disk2s1
       2:                  Apple_HFS ⁨Install macOS Big Sur⁩   126.4 GB   disk2s2
    
    /dev/disk3 (external, physical):
       #:                       TYPE NAME                    SIZE       IDENTIFIER
       0:      GUID_partition_scheme                        *61.5 GB    disk3
       1:                        EFI ⁨EFI⁩                     209.7 MB   disk3s1
       2:                  Apple_HFS ⁨SanDisk                 61.2 GB    disk3s2
    % sudo diskutil mount disk2s1
    Volume EFI on disk2s1 mounted
    % sudo diskutil mount disk3s1
    Volume EFI on disk3s1 mounted
  4. Copy the EFI folder from the source disk's EFI partition to the target disk's empty EFI partition via Finder or Terminal

Notes

Sources

/mac | Apr 26, 2021

Windows XP: VSS backup to rotated drives via shadowspawn and robocopy #

Daily backup routine for an ancient Q&A program and database which is always open:

  1. Copy shadowspawn.exe (depends on Visual C++ runtime) and robocopy.exe (found in the Windows Server 2003 Resource Kit Tools; preinstalled in Vista onwards) to %WINDIR%\system32\.

  2. Edit and save this batch script to desired location:

    for /f %%x in ('date /t') do set today=%%x
    if '%today%=='Mon shadowspawn C:\QA4 Q: robocopy q:\ S:\QA4 /B /MIR
    if '%today%=='Tue shadowspawn C:\QA4 Q: robocopy q:\ T:\QA4 /B /MIR
    if '%today%=='Wed shadowspawn C:\QA4 Q: robocopy q:\ U:\QA4 /B /MIR
    if '%today%=='Thu shadowspawn C:\QA4 Q: robocopy q:\ V:\QA4 /B /MIR
    if '%today%=='Fri shadowspawn C:\QA4 Q: robocopy q:\ W:\QA4 /B /MIR
    if '%today%=='Sat shadowspawn C:\QA4 Q: robocopy q:\ X:\QA4 /B /MIR
    if '%today%=='Sun shadowspawn C:\QA4 Q: robocopy q:\ Y:\QA4 /B /MIR
  3. Create a scheduled task to run the batch script daily without a cmd.exe popup.

/windows | Apr 18, 2021

Windows XP: Schedule a batch script to run hidden #

Running a scheduled bacth script as SYSTEM (no password required) hides the cmd.exe window. In Windows 7, this can be done from the Task Scheduler GUI (Properties → Change User or Group...).

While Windows XP's Scheduled Tasks GUI appears to offer the same option (Properties → Run as:), tasks set to run as SYSTEM will fail with "Could not start"; see Microsoft KB223375, "Cannot Configure Scheduled Tasks to Use System Account"*:

SYMPTOMS
When you create or modify a task in the Scheduled Tasks tool to use the System account, the task does not run as scheduled.

When you view the Scheduled Tasks log file, you receive the following error message:

The attempt to log on to the account associated with the task failed, therefore, the task did not run.

The specific error is: 0x80070057: The parameter is incorrect. Verify that the task's Run-as name and password are valid and try again.

CAUSE
This issue occurs because you cannot configure a task to use the System account using the Scheduled Tasks Wizard.

RESOLUTION
Currently, the only way to schedule a task as the System Account is to use AT.EXE to schedule the task. This command is shipped in Windows 2000 for backward compatibility for NT 4.0 scheduled events. Its defaults are to schedule jobs to run as the Task Scheduler service account (System by default).

To access this tool, open a Command Prompt (cmd.exe) and type AT /?. Be aware that after a job is scheduled using AT, manipulation of the task through the Scheduled Tasks folder will permanently change the job and turn it into a Windows 2000 Scheduled Tasks Job object (.JOB files). During this process, you must enter new credentials, and the only way to return the scheduled event to its original state using the system account is to delete and reschedule the event using AT.EXE.

An issue with using AT.EXE to schedule the task (e.g., at 09:00 /every:M,T,W,Th,F,S,Su c:\path\to\script.bat) is that properties are greyed out in the Scheduled Tasks GUI.

Tasks created with schtasks.exe, however (e.g., schtasks.exe /create /RU "SYSTEM" /SC daily /SD 04/18/2021 /ST 09:00:00 /TN "MyTask" /TR "C:\path\to\script.bat"), do not suffer from this limitation.

* In my testing, Scheduled Tasks → Advanced → View Log reported a different specific error:

"MyTask.job" (script.bat) 4/14/2021 7:52:32 PM ** ERROR **
    The attempt to log on to the account associated with the task failed, therefore, the task did not run.
    The specific error is:
    0x80041314: The task has been configured with an unsupported combination of account settings and run time options.
    Verify that the task's Run-as name and password are valid and try again.

/windows | Apr 18, 2021

Convert color PDF to black and white #

After exhausting the usual suspects (Adobe Acrobat, ImageMagick, Ghostscript, etc.), stumbled onto the cleanest results and smallest file size by pairing Preview.app and IrfanView:

  1. Open color.pdf (96.9MB) in Preview.app
  2. Open bw.pdf (235.4MB) in Preview.app
  3. Open bw.tif (109.5MB) in IrfanView
  4. Open bw2.tif (3.9MB) in IrfanView

Update

Substituting convert and gs for steps 3 and 4 led to cleaner output in some cases, albeit at the expense of larger file sizes:

$ convert bw.tif bw2.pdf
$ gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dNOPAUSE -dQUIET -dBATCH -sOutputFile=bw3.pdf bw2.pdf

Notes

/misc | Apr 15, 2021

Emergent is fine as the adjectival form of emergency #

Despite regrettably miguided notions to the contrary, "emergent" is fine as the adjectival form of "emergency", at least for those willing to accept the testimony of Webster's:

Emergent definition from merriam-webster.com: calling for prompt action : URGENT

and the OED (replete with usage examples spanning the centuries):

Emergent definition from the OED: urgent, pressing

/misc | Apr 12, 2021

Back up the Rosetta 2 installer for offline use #

Prologue

Procedure

  1. Download and install Rosetta 2:
    % softwareupdate --install-rosetta --agree-to-license

  2. Find path to installer:
    % grep RosettaUpdateAuto.pkg /var/log/install.log

  3. Copy installer for safekeeping:
    % cp /path/to/RosettaUpdateAuto.pkg /path/to/backup/dir/

Testing

  1. Turn on new M1 Mac mini, keeping it disconnected from Internet

  2. Copy Intel-only app to /Applications and attempt to launch:
    To open 'nvALT', you need to install Rosetta. Do you want to install it now?

  3. Select "Not Now"

  4. Run RosettaUpdateAuto.pkg installer:
    RosettaUpdateAuto installer window

  5. Relaunch nvALT - success:
    nvALT window

More

/mac | Mar 27, 2021

"This volume is not formatted as APFS" when upgrading Mojave to Catalina #

If your Mojave volume appears as grayed out in the Catalina installer with the message "This volume is not formatted as APFS" when attempting to upgrade:

  1. Boot from Catalina installer
  2. Launch Disk Utility
  3. Select Mojave volume
  4. File → Unmount
  5. Edit → Convert to APFS...
  6. Proceed with Catalina installation

Backup first, proceed at your own risk (and joy), etc.

H/T: klanomath, Redarm, and Antonio23249

/mac | Mar 15, 2021

Sacred truth #

A missionary once undertook to instruct a group of Indians in the truths of his holy religion. He told them of the creation of the earth in six days, and of the fall of our first parents by eating an apple.

The courteous savages listened attentively, and, after thanking him, one related in his turn a very ancient tradition concerning the origin of the maize. But the missionary plainly showed his disgust and disbelief, indignantly saying:—

"What I delivered to you were sacred truths, but this that you tell me is mere fable and falsehood!"

"My brother," gravely replied the offended Indian, "it seems that you have not been well grounded in the rules of civility. You saw that we, who practice these rules, believed your stories; why, then, do you refuse to credit ours?"

— From Chapter 5, The Unwritten Scriptures in The Soul of the Indian by Charles Alexander Eastman (Ohiyesa)

/misc | Mar 07, 2021

Behold the one common substratum in all things #

I do not contemplate either the past or the future: my attention is constantly directed to the present. I do what has to be done in the present, without thinking of the results. Without considerations of being or non-being, desirable and undesirable, I remain in the self: hence I am happy, healthy and free from illness.

...I do not entertain vain notions like, "I have obtained this and I shall gain that, too." I do not praise nor do I censure anyone (neither myself nor others) or anything at any time; my mind does not exult on gaining what is considered good nor does it become depressed on obtaining what is considered evil; hence my state of happiness and health. I embrace the supreme renunciation, having renounced even the desire to live; thus my mind does not entertain cravings but is peaceful and balanced. I behold the one common substratum in all things (a piece of wood, a beautiful woman, a mountain, a blade of grass, ice and fire and space) and I am not worried by thoughts like, "What shall I do now?" nor "What shall I get tomorrow morning?" I am not bothered by thoughts of old age and death, or by longing for happiness, nor do I regard some as "mine" and others as "not-mine". I know that everything at all times, everywhere, is but the one cosmic consciousness. These are the secrets of my state of happiness and health. I do not think, "I am the body," even while engaged in physical activity as I know this world-appearance to be illusory and live in it as if fast asleep. I am disturbed neither by prosperity nor by adversity when they are granted to me, as I regard them with equal vision (even as I look upon both my arms as arms). Whatever I do is untainted by desire or the mud of ego-sense; thus I do not lose my head when I am powerful or go begging when I am poor; I do not let hopes and expectations touch me and even when a thing is old and worn out I look upon it with fresh eyes as if it were new. I rejoice with the happy ones and share the grief of the grief-stricken, for I am the friend of all, knowing I belong to none and none belongs to me. I know that I am the world, all the activities in it and its intelligence.

From The Story of Bhuśuṇḍa in Part 6 (On Liberation) of Swami Venkatesananda's Vasiṣṭha's Yoga, an abbreviated and translated version of Yoga-Vāsiṣṭha. See also Vihārilāla Mitra's complete 19th century English translation, The Yoga-Vásishtha-Mahárámáyana in four volumes: 1, 2, 3, 4.

/misc | Feb 15, 2021

TIFF editor for Windows #

Irfan Paint pluginAn Internet search for "TIFF editor for Windows" turns up several shareware options, none of which outperformed IrfanView's built-in Paint plugin* for erasing stray marks from B&W CCITT G4 TIFs and resaving with the same compression algorithm:

ImageJ and Fiji offer only limited and buggy TIF CCITT G4 support, especially for batch processing.

* Formerly IrfanPaint. Launch via F12.

/windows | Feb 15, 2021

Batch crop images in IrfanView #

  1. Open one of the images in IrfanView
  2. Click and drag to draw box around desired region
  3. File → Batch Conversion/Rename...
  4. Add input files
  5. Check "Use advanced options (for bulk resize...)"
  6. Click "Advanced"
  7. Check "CROP:" → click "Get current sel." → OK
  8. Click "Start Batch"

/windows | Feb 15, 2021

Quickly toggle True Tone, Night Shift, Grayscale, and Dark Mode via AppleScript #

Especially handy for switching between color and E Ink monitors. Paste into Script Editor and export as a Run-only application. Launch via Spotlight, Alfred, etc. Tested under macOS Catalina 10.15.7.

-- toggle True Tone, Night Shift, Grayscale, and Dark Mode

quit application "System Preferences"

-- True Tone & Night Shift

tell application "System Preferences"
    reveal pane "Displays"
end tell
tell application "System Events" to tell process "System Preferences"
    click checkbox 1 of tab group 1 of window 1
    click radio button 3 of tab group 1 of window 1
    click checkbox 1 of tab group 1 of window 1
end tell

-- Grayscale
-- assumes that user has hitherto set "Filter type:" to "Grayscale" in Accessibility > Display > Color Filters

tell application "System Preferences"
    reveal anchor "Seeing_ColorFilters" of pane "Accessibility"
end tell
tell application "System Events" to tell process "System Preferences" to tell window "Accessibility"
    click the checkbox "Enable Color Filters" of tab group 1 of group 1
end tell

quit application "System Preferences"

-- Dark Mode

tell application "System Events"
    tell appearance preferences
        set dark mode to not dark mode
    end tell
end tell

-- thanks to:
-- marshallhiens: https://discussions.apple.com/thread/251336894?answerId=252595525022#252595525022
-- cfriend: https://forum.keyboardmaestro.com/t/toggle-night-shift/11175
-- Tyler: https://stackoverflow.com/a/58469753
-- MirRelevant: https://www.reddit.com/r/mac/comments/8oztql/how_to_quickly_switch_between_light_and_dark_mode/

/mac | Feb 07, 2021

Set keyboard shortcut for opening files in Sublime Text #

Tested under macOS 10.15.7 Catalina:

  1. Automator → File → New → Quick Action → Choose

  2. Workflow receives current: files or folders in: Finder.app

  3. Actions → Library → Files & Folders → drag "Open Finder Items" into Workflow area

  4. Open with: Sublime Text.app

  5. File → Save → Open with Sublime Text → Save (will be saved to "~/Library/Services/Open with Sublime Text.workflow")

  6. System Preferences → Keyboard → Shortcuts → Services → Files and Folders → Open with Sublime Text → set keyboard shortcut as desired (Command S in the screenshot)

Automator window

Services window

See also:

/mac | Feb 01, 2021

macOS Mail: Previous Recipients file location #

Importing the Previous Recipients to a new Mac is as easy as pasting the first set above and rebooting.

H/T: Backspin

/mac | Jan 31, 2021

Linux Mint: Move user's home directory to new drive #

  1. Use Disks to format (e.g., ext4) new disk and set to automount (gear icon → Edit Mount Options... → disable "User Session Defaults" → enable "Mount at system startup" → configure Mount Point as desired, e.g., /newhome)

  2. Boot into recovery mode (via Shift for BIOS systems or Esc for UEFI systems* → Advanced options for Linux Mint... → Linux Mint...(recovery mode)) and select root

  3. mount -o rw,remount /

  4. usermod -d /newhome/bob -m bob

Notes

Sources

/nix | Jan 28, 2021

Colossal Wreck #

OZYMANDIAS.      Ozymandias
I MET a Traveller from an antique land,
Who said, “Two vast and trunkless legs of stone
Stand in the desart.  Near them, on the sand,
Half sunk, a shattered visage lies, whose frown,
And wrinkled lip, and sneer of cold command,
Tell that its sculptor well those passions read,
Which yet survive, stamped on these lifeless things,
The hand that mocked them, and the heart that fed:
And on the pedestal these words appear:
“My name is OZYMANDIAS, King of Kings.”
Look on my works ye Mighty, and despair!
No thing beside remains.  Round the decay
Of that Colossal Wreck, boundless and bare,
The lone and level sands stretch far away.
GLIRASTES

Percy Bysshe Shelley in the January 11, 1818 edition of The Exmainer, under the penname of Glirastes (a "portmanteau of Shelley's own design, combining the Greek suffix erastes, meaning 'lover of,' and the Latin Gliridae, the scientific term for the family of the dormouse. Signing 'Ozymandias' with the name Glirastes, lover of dormice, was an inside joke and a show of Shelley's affection for Mary.").

Readings:

/misc | Jan 09, 2021


Subscribe or visit the archives.