This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- This script uses Acorn (tested with version 6.6.4) | |
| -- to add a light border around a window screenshot. | |
| -- | |
| -- Screenshots (without the huge macOS shadows) are made by shift-cmd-4, then space bar, | |
| -- then option-click on window (see https://apple.stackexchange.com/a/120017/17533) | |
| -- | |
| -- Before use, you need to create a Preset Filter for this, once: | |
| -- With an image opened, use from menu: Filter / Stylize / Drop Shadow… | |
| -- Set its options as you prefer (e.g. X/Y offset 0, Blur Radius 2, Opacity 80%), | |
| -- then save it by clicking the gear icon, choose "Save Filter Preset…" and |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Created by Thomas Tempelmann on 6 Apr 21, updated 8 Apr 21. | |
| // | |
| // This code demonstrates a unicode normalization issue with reading file system paths on APFS | |
| // volumes in macOS. | |
| // | |
| // TL;DR – In short, NSURL.path return paths (probably) always in NFD form even if the on-disk | |
| // name is in NFC form, and even if you passed the on-disk path to NSURL to create it. | |
| // Other path accessors, such as the canonical path, as well as BSD/POSIX functions | |
| // will keep giving you the on-disk name. | |
| // As a result, the name you get from NSURLNameKey may not be identical to the URL's |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| tell application "Mail" | |
| set newMessage to make new outgoing message with properties {subject:"theSubject", content:"theBody"} | |
| set theFile to (POSIX file "/etc/hosts") as alias | |
| tell newMessage | |
| make new attachment with properties {file name:theFile} at after the last word of the last paragraph | |
| end tell | |
| end tell |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // recycleURLs_crash_test | |
| // | |
| // Created by Thomas Tempelmann on 01Feb21. | |
| // | |
| // Purpose: | |
| // Demonstrates that using [NSWorkspace recycleURLs:] on > 600 files often leads to a crash on macOS 10.12 and 10.13. | |
| // In my testing (on 10.13.6), up to 500 items never crash, while it starts crashing sometimes with 650 items | |
| // and nearly every time when it's over 800. I also get spurious errors on the first recycle interation when | |
| // using 600 items. This could be a precursor to the crash, but not sure. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # | |
| # This script demonstrates an issue with SMB (and probably AFP as well) | |
| # sharing, when accessing files by macOS that are hosted on a Linux share. | |
| # | |
| # Run this script on a Linux system to create two file in the current dir. | |
| # Make sure it runs in bash, not sh, or the codes won't work. | |
| # | |
| # Make the generated files acessible via SMB, then try to access both files | |
| # from macOS. The one called "decomposed_ü" won't be accessible - that's the bug. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # VER: 0.28 | |
| client | |
| dev tun0 | |
| proto udp | |
| remote nat.openvpn.ipredator.se 1194 | |
| remote nat.openvpn.ipredator.me 1194 | |
| remote nat.openvpn.ipredator.es 1194 | |
| #remote 46.246.46.100 1194 | |
| #remote 46.246.46.101 1194 | |
| #remote 46.246.46.102 1194 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #import <Foundation/Foundation.h> | |
| int main(int argc, const char * argv[]) { | |
| NSArray<NSURL*> *vols = [NSFileManager.defaultManager mountedVolumeURLsIncludingResourceValuesForKeys:nil options:0]; | |
| for (NSURL *url1 in vols) { | |
| NSURL *url2 = [NSURL fileURLWithPath:url1.path]; | |
| if (! [url1 isEqual:url2]) { | |
| NSLog(@"url mismatch: %@ - %@", url1, url2); | |
| if (! [url1.path isEqualToString:url2.path]) { | |
| NSLog(@"path mismatch: %@ - %@", url1.path, url2.path); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // Sample code for determining all invididual mounted volumes, including volume groups. | |
| // Tested on macOS 10.13.6, 10.15.6 and 10.16 (11.0) b6 | |
| // | |
| // See https://stackoverflow.com/questions/63876549/ | |
| // | |
| // Created by Thomas Tempelmann on 14 Sep 20 to 17 Sep 20 (yes, this took me several days to get right). | |
| // | |
| #import <IOKit/IOKitLib.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // See https://twitter.com/tempelorg/status/1305559310760644612?s=20 | |
| // Turns out this is correct behavior. | |
| // No more need for testing. | |
| #include <stdio.h> | |
| #include <sys/mount.h> | |
| int main(int argc, const char * argv[]) { | |
| struct statfs fsinfo; | |
| statfs("/", &fsinfo); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Written 2019 by Thomas Tempelmann, tempelmann@gmail.com | |
| // Tested on macOS, but may work on iOS as well. | |
| NSMutableSet *reportedMissingLocs = nil; | |
| #define MyAppSupportFolderName "your.bundle.id" // or your app's name | |
| static NSBundle *mainBundle = nil; | |
| static NSArray<NSString*> *availableLangs; // list of langs the app knows (possibly sorted alphabetically) | |
| static NSDictionary<NSString*,NSBundle*> *bundlePerLang = nil; |