[{"content":"After many years with WordPress, the system that lets you set up a website and run a blog in no time, I decided to try something other than a content management system for a change. My experience with Quartz, which I use for my German-language ObsidianGuide, also showed me the advantages of a static site generator. Compared to an application with PHP, plugins, and regular updates, it has clear benefits.\nUntil now, a switch always seemed complicated to me. Over the past few weeks, however, I have done several projects with Claude Code. So I simply asked Claude to draw up a plan for migrating from WordPress to a static site generator. The plan made sense to me, so I gave the \u0026ldquo;go\u0026rdquo;, and here is the result.\nI had been toying with static site generators for a long time, so I agreed when Claude suggested Hugo as the solution. Getting to a first static version of this blog was easy. Still, it took a few iterations until special cases such as the followers from the ActivityPub plugin, a suitable design, and a number of smaller adjustments were done.\nRight now, I feel I have taken the right step. What I have lost is the ability to quickly edit an article from any device with an internet connection. Unfortunately, the comment function that WordPress comes with is gone as well. The existing comments remain as an archive. For now, I only accept new comments via the Fediverse and Bluesky. As a temporary replacement, reactions to an article from both networks are shown below it with a click. Let\u0026rsquo;s see how that works out. Posting to these two networks is now also handled by a script. New articles are announced on Mastodon as @en_leif@indieweb.social and on Bluesky as @en.ileif.de.\nOn the plus side, I can now write articles directly in Obsidian and have a much leaner and hopefully more secure website. I also like that the entire website can now be managed with Git and that I have more options for automation.\nI expect to make a few more adjustments in the near future. The content and the addresses of the articles, however, stay the same.\n","date":"November 30, 2026","externalUrl":null,"permalink":"/2026/11/30/new-home-for-my-blog/","section":"Posts","summary":"After many years with WordPress, the system that lets you set up a website and run a blog in no time, I decided to try something other than a content management system for a change. My experience with Quartz, which I use for my German-language ObsidianGuide, also showed me the advantages of a static site generator. Compared to an application with PHP, plugins, and regular updates, it has clear benefits.\n","title":"A New Home for My Blog: From WordPress to Hugo","type":"posts"},{"content":"","date":"November 30, 2026","externalUrl":null,"permalink":"/category/","section":"Categories","summary":"","title":"Categories","type":"categories"},{"content":"","date":"November 30, 2026","externalUrl":null,"permalink":"/tag/claudecode/","section":"Tags","summary":"","title":"ClaudeCode","type":"tags"},{"content":"","date":"November 30, 2026","externalUrl":null,"permalink":"/","section":"dit und dat","summary":"","title":"dit und dat","type":"page"},{"content":"","date":"November 30, 2026","externalUrl":null,"permalink":"/category/generell/","section":"Categories","summary":"","title":"Generell","type":"categories"},{"content":"","date":"November 30, 2026","externalUrl":null,"permalink":"/tag/hugo/","section":"Tags","summary":"","title":"Hugo","type":"tags"},{"content":"","date":"November 30, 2026","externalUrl":null,"permalink":"/tag/obsidian/","section":"Tags","summary":"","title":"Obsidian","type":"tags"},{"content":"","date":"November 30, 2026","externalUrl":null,"permalink":"/posts/","section":"Posts","summary":"","title":"Posts","type":"posts"},{"content":"","date":"November 30, 2026","externalUrl":null,"permalink":"/tag/","section":"Tags","summary":"","title":"Tags","type":"tags"},{"content":"","date":"November 30, 2026","externalUrl":null,"permalink":"/tag/wordpress/","section":"Tags","summary":"","title":"WordPress","type":"tags"},{"content":"","date":"October 12, 2026","externalUrl":null,"permalink":"/tag/appleshortcuts/","section":"Tags","summary":"","title":"AppleShortcuts","type":"tags"},{"content":"","date":"October 12, 2026","externalUrl":null,"permalink":"/category/automation/","section":"Categories","summary":"","title":"Automation","type":"categories"},{"content":"Update 2026-10-15: Just a few days after publishing this post, there was an update of Crank, with a few changes. These address at least two issues I mentioned in this post and add a new feature.\nIt is now possible to save a rule locally on the Mac; also, it\u0026rsquo;s still possible to share them with the former technique, using the URL. The rules in the list can now be manually reordered with drag and drop. In the Toolbar and on every rule, there is now a new \u0026ldquo;diagnostic icon.“ With that, you can easily check the state of the whole app and of every rule. This replace function replace the setting icon on the rule. Remark: This article is a translation of my German original, created with the help of AI. English is not my first language, so some phrases may sound unusual.\nCrank is an app that runs in the background and can perform different actions when something happens on your system. For example, Crank can react when headphones connect via Bluetooth or when a screenshot lands in a folder. Crank\u0026rsquo;s job is to listen for certain events, which are defined as triggers, and then start an action. It works much like Shortery, which, however, can only run Apple Shortcuts as an action. In Crank, you can also use Shortcuts as an action, and in addition scripts written in different languages.\nI am interested in automation on macOS and in writing scripts, so I found Crank\u0026rsquo;s approach interesting and wanted to take a closer look. The development team The low-tech guys kindly gave me a copy of Crank for this review. The slogan \u0026ldquo;Effortless macOS automation – no manual required” made me even more curious.\nCrank offers more than 30 triggers. They react to changes in the system, for example, joining a Wi-Fi network, connecting a USB device, new content in the clipboard, or a change of Focus mode. In response, Crank can perform the following actions:\nNotify: show a notification Open: launch an app, open a URL, open a file Automate: run a Shortcut, an AppleScript, or a shell script (zsh, Python 3, Ruby, Perl, Swift, or a custom interpreter) Control Crank: activate a profile, enable or disable a rule At the time of this review, the app is a one-time purchase for €10.00 instead of the regular price of €14.28. You can also try it free for 14 days. It requires macOS 14.0 (Sonoma) or later.\nThe User Interface # The UI is fairly self-explanatory, although it does not fully follow Apple\u0026rsquo;s conventions. The title bar contains several functions. With the buttons at (1), you can show and hide the trigger area on the left, open the settings (⌘,), open the command palette (⌘K), and switch the display of the rules (6) between the list view shown here and a table view.\nWith the switcher at (2), you change between three views: the \u0026ldquo;Trigger\u0026rdquo; view, the Event Log (⌘2), and the \u0026ldquo;Action History\u0026rdquo; (⌘3). The \u0026ldquo;Trigger\u0026rdquo; view is the main view. It consists of the trigger list (1) and the rules area (6), which shows the rules as a list of rule boxes. The Event Log shows all events that the system generates and that Crank watches. The Action History lists the actions that were executed, together with their output and any errors.\nThe button at (3) is a menu and shows the name of the active profile. When you open it, you can manage profiles and create new ones, in which you can then create new rules. With profiles, you can, for example, have a different set of rules active at work than at home. Using the context menu (right-click) of a rule, you can move it to another profile.\nArea (4) contains the functions of the toolbar, shown here enlarged:\nEnable all rules Disable all rules Expand all groups Collapse all groups \u0026ldquo;DryRun\u0026rdquo;: Puts the whole system into a test mode. Crank still checks the conditions of the rules and logs the result in the Action History, but it does not execute the actions. Undo the deletion of a rule Save all settings as a backup (do not confuse this with the Share button) Load a backup The Event Log # The Event Log (2) gives you an overview of the events that Crank can react to when \u0026ldquo;All Triggers\u0026rdquo; is active at (1). For debugging, you can use \u0026ldquo;Enabled Rules Only\u0026rdquo; to limit the entries to events for which active rules exist.\nIn the dropdown menu (3), you can filter the log by trigger area. The trash can (5) clears the log, and with the search field (6), you can look for a specific entry.\nThe Action History # The Action History logs the actions that were executed. Each entry shows the time, the rule, the trigger that started it, and the action. Runs that happened in DryRun mode are marked with \u0026ldquo;DRY RUN\u0026rdquo;. If you expand an entry (3), you see the output of the script, the exit code with the run time, and the values of the event that started it.\nThe red text is not necessarily an error. Red is used for the standard error output (stderr) of the script, and this also contains normal status messages, here for example the new name under which the screenshot was saved. The exit code shows whether an action was successful. A 0 (green) means success, anything else (red) means an error. In this way, the script in the lower entry was stopped after 30 seconds (\u0026ldquo;Script timed out after 30 seconds\u0026rdquo;, exit -1).\nThe warning triangle (1) filters the entries for actions that do not end with exit code 0, meaning they did not lead to the desired result. The trash can (1) clears the list, and with the search field (2), you can find individual entries.\nHow Rules Are Built # A rule always starts with a trigger, which you first select in the left sidebar (1). In this example, it is \u0026ldquo;File/Folder changes\u0026rdquo; → \u0026ldquo;created\u0026rdquo;. When you select it, the rule is created and the first line, \u0026ldquo;WHEN\u0026rdquo; (2), is added. It defines that the rule should react to events that report changes in the file system. Although the sidebar says \u0026ldquo;Files\u0026rdquo; here, the \u0026ldquo;File Watcher\u0026rdquo; also reacts to folders that are created, changed, or deleted.\nIn the next line, \u0026ldquo;IF\u0026rdquo; (3), you set a condition that narrows down which files or folders to watch. In the example, the file name must contain the text \u0026ldquo;Bildschirm\u0026rdquo; (the German prefix of screenshot file names).\nThe \u0026ldquo;THEN\u0026rdquo; line (4) defines which action should be executed, for example a Shortcut, an AppleScript, a script, or just a notification. In the example, it is \u0026ldquo;Run Shell Script\u0026rdquo;. The timeout shown here (one minute in the example) is set below the script box (5).\nIn the following line (6), you set the location to be watched (\u0026ldquo;Watch Path\u0026rdquo;) and whether subfolders are included (\u0026ldquo;Recursive\u0026rdquo;).\nIf a script should be executed, as in this example, you can choose the interpreter at (7). Besides zsh, Python 3, Ruby, Perl, and Swift, you can also specify a custom interpreter.\nYou enter the script in the box (8). To the right of it (9), you find the variables that you can use in the script, such as $fileName and $filePath. I will cover the button at the bottom of the script box (\u0026ldquo;Generate code\u0026rdquo;) further below.\nDepending on the interpreter, additional options appear. For a zsh script, the checkbox \u0026ldquo;Load ~/.zshrc\u0026rdquo; (10) lets you decide whether the personal configuration file of the shell should also be loaded. With \u0026ldquo;Run\u0026rdquo; (10), you can execute the script directly. A Swift script can also be compiled if you want. This probably only makes sense when the script is finished, but then it speeds up execution significantly.\nBelow the script box, there are settings that influence how the script runs. The timeout (5) makes sure that a script that runs too long for any reason is stopped. This way, a hanging script cannot run forever. If the timeout is exceeded, the Action History shows \u0026ldquo;Script timed out\u0026rdquo; with exit code -1, as in the example above.\nBelow that are the settings \u0026ldquo;Rate Limit\u0026rdquo;, \u0026ldquo;Schedule\u0026rdquo;, and \u0026ldquo;Conditions\u0026rdquo; (11). In the \u0026ldquo;Rate Limit\u0026rdquo; dropdown menu, you can define how the rule should behave when an event is triggered several times in quick succession. One example is closing a MacBook. This triggers the \u0026ldquo;LidAngle\u0026rdquo; event, which can repeat many times. With the \u0026ldquo;Throttle\u0026rdquo; option, the action is executed at the first occurrence, and all further events are ignored for a defined time window. With \u0026ldquo;Debounce\u0026rdquo;, on the other hand, the rule waits for a defined time before it executes the action. For \u0026ldquo;LidAngle\u0026rdquo;, \u0026ldquo;Debounce\u0026rdquo; seems more useful to me, because the action is only executed after the waiting time and not already at the first change of the angle. (I have not tried this.)\nWith the \u0026ldquo;Schedule\u0026rdquo; option, you can define on which days of the week and in which time window the rule should be active. Under the \u0026ldquo;Conditions\u0026rdquo; switch, you can also define additional conditions that belong to the trigger. If the File Watcher looks for a specific file name (3) in a specific folder (6), as in the example, you can also set here that only changes to folders, not to files, are considered. This means the conditions are spread over three places: the file name in the IF line (3), the location in \u0026ldquo;Watch Path\u0026rdquo; (6), and further ones under \u0026ldquo;Conditions\u0026rdquo;. I do not understand why they are not combined in one place.\nWith the last option (12), \u0026ldquo;Also run an action when the file is deleted\u0026rdquo;, you can additionally define an action for the opposite event, here the deletion of the file. When you turn on the switch, a second \u0026ldquo;WHEN\u0026rdquo; line with the opposite trigger (\u0026ldquo;file deleted\u0026rdquo;) appears in the upper part of the rule, and you can define a separate action for it (see image). Here, too, I do not understand why the switch is placed at the bottom of the rule and not where the definition happens afterward.\nCreating Rules and Scripts with AI # Creating a rule is quite easy. First you choose the right trigger, then you set the condition, and finally you choose an action. Simple actions, such as a notification when the battery level drops below a certain value, or opening a URL when the computer starts, can be put together quickly with a few clicks. When the action becomes more complex, it takes more effort. The easiest way may then be an Apple Shortcut as the action, because with macOS 27, Apple supports creating Shortcuts with the help of \u0026ldquo;Apple Intelligence\u0026rdquo;. You only need to describe what the Shortcut should do. Apple Intelligence does the rest.\nThe Code Generator in Crank # Crank takes a similar approach with its built-in code generator. In the settings under \u0026ldquo;Advanced\u0026rdquo;, you can enter a free API key from Google Gemini. You create the key with a free Google account at aistudio.google.com/api-keys. Alternatively, you can use ChatGPT through Apple Intelligence. For this, Crank installs Apple Shortcuts that serve as the interface.\nFor a new rule, you now enter an instruction instead of a script, here with the request to create a Swift script:\nCreate a Swift script that speaks the file name and the path when a new file is created in the folder, in German: Die Datei wurde im Pfad erstellt After you click \u0026ldquo;Generate code\u0026rdquo;, the script is created. In this example, I used my free ChatGPT account through the \u0026ldquo;Apple Intelligence\u0026rdquo; interface, because calls to the Gemini API in my free account are interrupted from time to time because of overload.\nAfter you approve the execution of the Shortcut, the finished script is inserted in place of the prompt:\n#!/usr/bin/swift import Foundation let env = ProcessInfo.processInfo.environment guard let fileName = env[\u0026#34;fileName\u0026#34;], let filePath = env[\u0026#34;filePath\u0026#34;] else { exit(1) } let message = \u0026#34;Die Datei \\(fileName) wurde im Pfad \\(filePath) erstellt\u0026#34; let task = Process() task.launchPath = \u0026#34;/usr/bin/say\u0026#34; task.arguments = [message] task.launch() task.waitUntilExit() exit(0) Controlling Crank with MCP # The second option is that an AI such as Claude, either in the desktop app or with Claude Code in the terminal, controls Crank directly. For this, you first need to install the \u0026ldquo;crank command line tool\u0026rdquo; in the settings under \u0026ldquo;General\u0026rdquo;.\nAfter that, you can start the Crank MCP server under \u0026ldquo;AI agents\u0026rdquo; (\u0026ldquo;Enable MCP\u0026rdquo;) and connect it to an AI agent, here Claude Code and the Claude desktop app. MCP (\u0026ldquo;Model Context Protocol\u0026rdquo;) is an interface through which AI applications can use external tools. Crank also supports other AI agents, such as Codex from OpenAI, GitHub\u0026rsquo;s Copilot CLI, OpenCode, and Google\u0026rsquo;s Gemini CLI.\nWith this, you can create rules by prompt directly in the app or in the terminal tool of the respective AI provider. To do this, Claude connects to Crank, gets the information it needs, creates the code, and tests it.\nAt the end, the finished rule is created directly in Crank, here with the name \u0026ldquo;Desktop: neue Datei ansagen\u0026rdquo; (\u0026ldquo;Desktop: announce new file\u0026rdquo;).\nThis way, even someone who does not know the syntax of a scripting language can have more complex scripts created. Still, you should have some programming experience, so that you can at least roughly understand what the script does.\nCustom Triggers with Scripts # If the existing triggers are not enough, Crank lets you write your own trigger. Instead of watching for a system event, Crank runs a script at regular intervals and uses the exit code to decide whether the rule fires. As an example, I had Claude, as an AI agent, build a rain warning. The script checks the rain forecast for the next two hours for a defined location. If rain is expected, a notification shows when the rain starts and how much to expect. The script looks like this:\nimport json, sys, urllib.request from datetime import datetime # Coordinates for Heidelberg LAT, LON = 49.40, 8.68 THRESHOLD_MM = 0.5 # Total for the next 2 hours URL = (f\u0026#34;https://api.open-meteo.com/v1/forecast?latitude={LAT}\u0026amp;longitude={LON}\u0026#34; \u0026#34;\u0026amp;minutely_15=precipitation\u0026amp;forecast_minutely_15=8\u0026amp;timezone=Europe%2FBerlin\u0026#34;) # 1 Fetch data, abort silently on any error try: with urllib.request.urlopen(URL, timeout=5) as r: data = json.load(r) times = data[\u0026#34;minutely_15\u0026#34;][\u0026#34;time\u0026#34;] rain = data[\u0026#34;minutely_15\u0026#34;][\u0026#34;precipitation\u0026#34;] except Exception: sys.exit(1) # 2 Decide, exit 1 means do nothing total = sum(x or 0 for x in rain) if total \u0026lt; THRESHOLD_MM: sys.exit(1) # 3 Determine the start of the rain and the waiting time first = next((t for t, x in zip(times, rain) if (x or 0) \u0026gt; 0), times[0]) minutes = max(0, int((datetime.fromisoformat(first) - datetime.now()).total_seconds() // 60)) # 4 Output data for the action print(f\u0026#34;mm={total:.1f}\u0026#34;) print(f\u0026#34;start={first[11:16]}\u0026#34;) print(f\u0026#34;minutes={minutes}\u0026#34;) You enter the script in the \u0026ldquo;Script\u0026rdquo; trigger. Crank runs it every 600 seconds (\u0026ldquo;Poll every\u0026rdquo;). If it ends with exit code 0, the trigger fires. With any other exit code, the rule is skipped. Lines in the format key=value that the script prints are available to the action as placeholders {{key}}.\nWhat Does the Script Do? # In the header, the required libraries are loaded and variables are defined, namely the geographic coordinates (here Heidelberg) and the threshold from which rain is reported.\nThe variable URL contains the address of the weather service Open-Meteo, which is used to get the rain amounts for the next two hours. The parameter minutely_15=precipitation defines that the amount of precipitation should be requested, and forecast_minutely_15=8 asks for eight values at 15-minute intervals, which is two hours.\nimport json, sys, urllib.request from datetime import datetime # Coordinates for Heidelberg LAT, LON = 49.40, 8.68 THRESHOLD_MM = 0.5 # Total for the next 2 hours URL = (f\u0026#34;https://api.open-meteo.com/v1/forecast?latitude={LAT}\u0026amp;longitude={LON}\u0026#34; \u0026#34;\u0026amp;minutely_15=precipitation\u0026amp;forecast_minutely_15=8\u0026amp;timezone=Europe%2FBerlin\u0026#34;) Next, the weather data is requested through the URL. The response from Open-Meteo is a JSON with the forecast data for the next two hours in 15-minute steps. From it, the times are stored in the list times and the amounts of precipitation in the list rain. Entries at the same position belong together. If the request fails, for example because the service is not reachable or does not answer within five seconds, the script ends with exit code 1.\n# 1 Fetch data, abort silently on any error try: with urllib.request.urlopen(URL, timeout=5) as r: data = json.load(r) times = data[\u0026#34;minutely_15\u0026#34;][\u0026#34;time\u0026#34;] rain = data[\u0026#34;minutely_15\u0026#34;][\u0026#34;precipitation\u0026#34;] except Exception: sys.exit(1) After that, the script calculates whether at least 0.5 mm of rain falls in the next two hours. To do this, all values of the list rain are added up and stored in the variable total. If total does not reach the threshold, the script again ends with exit code 1, and the rule does not fire.\n# 2 Decide, exit 1 means do nothing total = sum(x or 0 for x in rain) if total \u0026lt; THRESHOLD_MM: sys.exit(1) Next, the script finds the first point in time within the two hours at which, according to the forecast, rain starts. For this, the function zip(times, rain) combines the values from both lists \u0026ldquo;position by position\u0026rdquo; into pairs, each with one time and the matching precipitation value. next(...) takes the first point in time at which the precipitation value is greater than zero and stores it in first. Then the script calculates how many minutes remain until that time. If it is already in the past, the waiting time is set to zero.\n# 3 Determine the start of the rain and the waiting time first = next((t for t, x in zip(times, rain) if (x or 0) \u0026gt; 0), times[0]) minutes = max(0, int((datetime.fromisoformat(first) - datetime.now()).total_seconds() // 60)) In the last step, the script prints the values for the notification as key-value pairs, so that the \u0026ldquo;Show Notification\u0026rdquo; action can use them.\n# 4 Output data for the action print(f\u0026#34;mm={total:.1f}\u0026#34;) print(f\u0026#34;start={first[11:16]}\u0026#34;) print(f\u0026#34;minutes={minutes}\u0026#34;) You can use these values as placeholders in the \u0026ldquo;Title\u0026rdquo; and \u0026ldquo;Body\u0026rdquo; fields of the notification, here {{minutes}}, {{mm}}, and {{start}}.\nAs soon as rain is forecast, a notification like this appears (here in german).\nIf the rain continues, the \u0026ldquo;Trigger on\u0026rdquo; switch matters.\nIf the switch is set to \u0026ldquo;State Changes\u0026rdquo;, you only get a notification when rain is forecast within the next two hours for the first time. Every further run still ends with exit code 0, but does not lead to a new notification. Only when the forecast no longer contains any significant rain, or the service is not reachable, does the script end with exit code 1 again. This resets an internal flag, and at the next run with code 0, a notification appears again.\nIf the switch is set to \u0026ldquo;Every Run\u0026rdquo;, a new notification with updated data appears at every run, which means every ten minutes, as long as rain is forecast. Only when no more rain is expected do the notifications stop. In both cases, this only applies if at least 0.5 mm of rain is forecast.\nThis is a simple solution that only warns you that it will rain at some point in the next two hours. It does not tell you when the rain stops again. Adding that would go beyond the scope of this article.\nIn summary, with a script trigger you can define your own events, for example to check sensors that the system\u0026rsquo;s built-in triggers do not cover, or to connect any external service.\nSharing Rules # You can share rules with other Crank users. To do this, click the share icon, which is typical for macOS, at the top right of the rule box. This copies a link to the clipboard that looks roughly like this (here the rain warning as an example):\nhttps://crank.lowtechguys.com/rule/YnZ4bvEEAACvAwAA4Ah7IjMiOiJub3RpZmljYXRpb24iLCIxMDQAFeADXC91c3JcL2JpblwvcHl0aG9uMwAcQBp2QAgxgAk0MeALe3ttbX19IG1tIGVyd2FydGV0LCBhYiB7e3N0AA4AGsAsVWhyQCsy73NjcmlwdFRyaWdnZXJlZAhCRjDoUmVnZW4gaW4ANOdtaW51dGVzADZQCk0Iikg7NuAZaW1wb3J0IGpzb24sIHN5cywgdXJsbGliLnJlcXVlc3RcbmZyb20gZGEAgORpbWUgIDAoEOAYXG5cbkxBVCwgTE9OID0gNDkuNDAsIDguNjhcblRIUkVTSE9MRF9NTQAc6zAuNSAgICMgU3VtAEjqZGVyIG7DpGNocwCN6iAyIFN0dW5kZW4IUMAvVVJM4CAoZlwiaHR0cHM6XC9cL2FwaS5vcGVuLW1ldGVvLmNvbVwvdjFcL2ZvcmVjYXN0P2wBYOZ0dWRlPXsAj-Z9JmxvbmcoEOhPTn1cIlxuIBgByQ1cIiby52x5XzE1PXAAQORpcGl0EZ9oTyZoI1_0iOo4Juh6b25lPUV1cgCG5yUyRkJlcmwBvIixIinmIyAxIERhCMjkaG9sZQFI7mJlaSBqZWRlbSBGZWhsAOrlc3RpbGwBvkBfYkjmaOR0cnk6GJPkd2l0aDl09UAPLgjtQQooiH0sIOxvdXQ9NSkgYXMgcjowygmFybxhID3x6C5sb2FkKHIpGB0IM8ghcyA98cjNW1wi98ARXCJdEbqYLSJd5HJhaW44LPABOSHzEDXoZXhjZXB0IEUQBwAVIJICPecuZXhpdCgxIRXmMiBFbnRzAPCJFWlkQBxFASlBGGIAYut0IG5pY2h0cyB0dQkP5G90YWwAhetzdW0oeCBvciAwIAGLir0geAigAFLIJmlmIPKaWTwg9jh9_ugzIEJlZ2lubgJpkwlzIIJicyCLSiBXgIt6ZUFqYsmOaW1t5WZpcnN0AH8A2-R0KCh0EHyYf3Qs5HppcCgRUFiKLECJICCkwAUpID4ZouRzWzBdAHsZPwl85G1heCgDC4BSaW4rLktMLsBgaXNv5G1hdCgQd8tOKSAt9egubm93KCkpLhDp619zZWNvbmRzKCkgCwLkIDYwKSDcYm4062bDvHIgZGllIEFrCYjnIGF1c2dlYgjRiHhwcgNC5G1tPXsQTuU6LjFmfRKwMBwUSJCGPXvnWzExOjE2XTgi9SDObD898QAfDDlGM-U2MDAuMAzQNIDiIn0GAAAAAAAAAGJ2eCQ The rule is not stored on a server. It is completely contained in the link, compressed and Base64-encoded, but not encrypted. Anyone who has the link can therefore read its content. The server seems to act only as a bridge. It replaces the part https://crank.lowtechguys.com/ with crank://, so that when you open the link, the rule appears right away in an import window in Crank.\nBefore you import a rule, you should always check what it does. A shared rule can run shell scripts on your computer. Depending on your security settings, this may even happen without a prompt. Everything that is in a rule is also in the link, such as paths, locations, or credentials. You should keep this in mind before you share a rule.\nIf you want to bypass the server, you can also edit the link yourself and replace https://crank.lowtechguys.com/ with crank://. If you enter this address in a browser, the rule is imported in the same way.\nI do not know why the developers chose this approach instead of simply saving the rule as a file that you could then share.\nConclusion # Crank joins a series of tools that help automate certain workflows. Its strengths are the simple implementation of the trigger → condition → action approach, the large number of triggers, and the supported scripting languages. For simple actions, you can use Apple Shortcuts. zsh is suited for existing command-line tools, Python for web services and JSON processing, and a Swift script is a good choice for actions that need access to macOS frameworks. If you prefer another language, you can even add your own interpreter.\nThere are also some points of criticism.\nSwitches are often far away from what they control. The switch \u0026ldquo;Also run an action when the file is deleted\u0026rdquo; is at the bottom of the rule, but the related action appears in the upper part. Conditions are spread over several places: the IF line, the \u0026ldquo;Watch Path\u0026rdquo;, and the \u0026ldquo;Conditions\u0026rdquo; switch. You cannot freely reorder rules in the list. Groups provide some order, but more freedom in sorting would be helpful. Profiles are a practical way to put together rules for different work contexts. It is only a pity that you can move rules between profiles with the context menu, but not copy them.\nFor simple uses, the app is reasonably intuitive. But there are also more complex concepts that you cannot understand just by looking at them, such as \u0026ldquo;State Changes\u0026rdquo; versus \u0026ldquo;Every Run\u0026rdquo; or \u0026ldquo;Throttle\u0026rdquo; versus \u0026ldquo;Debounce\u0026rdquo;. More documentation would help here, even though the slogan says \u0026ldquo;no manual required\u0026rdquo;.\nIf you are looking for a simple way to run scripts depending on system events or on a schedule, you can get to your goal very quickly with Crank. However, you need a minimum of programming knowledge. Even if you only use ready-made rules from the internet or an AI to create them, you should have enough knowledge to at least roughly understand what the script does.\n","date":"October 12, 2026","externalUrl":null,"permalink":"/2026/10/12/event-driven-automation-on-macos-with-crank/","section":"Posts","summary":"Update 2026-10-15: Just a few days after publishing this post, there was an update of Crank, with a few changes. These address at least two issues I mentioned in this post and add a new feature.\nIt is now possible to save a rule locally on the Mac; also, it’s still possible to share them with the former technique, using the URL. The rules in the list can now be manually reordered with drag and drop. In the Toolbar and on every rule, there is now a new “diagnostic icon.“ With that, you can easily check the state of the whole app and of every rule. This replace function replace the setting icon on the rule. Remark: This article is a translation of my German original, created with the help of AI. English is not my first language, so some phrases may sound unusual.\n","title":"Event-Driven Automation on macOS with Crank","type":"posts"},{"content":"","date":"October 12, 2026","externalUrl":null,"permalink":"/tag/macos/","section":"Tags","summary":"","title":"macOS","type":"tags"},{"content":"","date":"October 12, 2026","externalUrl":null,"permalink":"/tag/python/","section":"Tags","summary":"","title":"Python","type":"tags"},{"content":"","date":"October 12, 2026","externalUrl":null,"permalink":"/tag/scripts/","section":"Tags","summary":"","title":"scripts","type":"tags"},{"content":"","date":"August 30, 2026","externalUrl":null,"permalink":"/tag/apptest/","section":"Tags","summary":"","title":"AppTest","type":"tags"},{"content":"I have a few shortcuts that show me the status of my devices on the network. For example, I can see the current data from my solar panel system. Unfortunately, Apple Shortcuts has very limited graphic options for this. Showing the results as a widget just wasn\u0026rsquo;t possible, so the best I could do was this:\nSimon B. Støvring, developer of Scriptable and Runestone, has released a beta version of his new app, Canvases. It solves the problem of displaying Shortcut data as a widget. The result is much nicer and easier to read.\nHow it works # Everything I describe here is based on the 2018 beta build. Since Simon B. Støvring releases new updates in TestFlight almost daily, the build number may change quickly. Therefore, changes in later betas or the final release are possible.\nThe Canvas definition # The widget is defined in the Canvases app. This includes the visual design, layout elements, and placeholders that are later filled with results from a linked shortcut. For my example, it looks like this:\nThe left panel shows the current structure of the widget. The middle panel shows a preview. The right panel shows the different elements that can be used in a widget. Clicking on an element adds it to the end of the tree in the left panel. Then, you can move it to the desired position.\nEach element has its own properties, such as foreground and background color, as well as spacing. These properties allow the shortcut to control how something is rendered. For example, the shortcut can change the text color from black to red once a certain value drops below a threshold.\nThe shortcut # To retrieve current data from my solar panel system, I access an internal service. The result of that call is stored in a dictionary. I read the raw data from the dictionary and process it further. I go through the dictionary entry by entry. Here, the raw value is shown under the key pv_feed_in_w. This value is in watts. Before writing it into the variable togrid, I convert it to kilowatts by dividing it by 1000 and rounding to three decimal places.\nIn order to display the value of the variable in the widget, it must be passed to the Canvas. The shortcut uses the Canvas action Update View to do so.\nThis action sets the \u0026ldquo;Text\u0026rdquo; property of the placeholder \u0026ldquo;grid\u0026rdquo; in the Canvas definition named \u0026ldquo;PV\u0026rdquo; to the content of the shortcut variable togrid.\nThis method writes each dictionary entry into a variable, which is then displayed as text in the widget. The battery charge level in percent is the one exception; it is shown in the widget using the Progress element. The color of the ring is set to red below 11% and green above 11%.\nNot all the widget\u0026rsquo;s content is derived from variables. In this example, icons and units are fixed in the Canvas and are not set by the shortcut. Once all the variable values have been passed to the Canvas, all that\u0026rsquo;s left to do is add the widget to the home screen or desktop. After that, the widget is updated with new solar system data every time the shortcut runs.\nI was surprised to find that running the shortcut on one Apple device updates the widgets on all my devices. This is because the data is saved into the Canvas definition and synced through iCloud. This means the widgets on other devices receive the new data after iCloud syncs the file.\nLayout elements # A widget\u0026rsquo;s layout is primarily composed of the Stack layout element. Content can be arranged horizontally, vertically, or with overlapping elements (Depth). In this example, the layout looks like this:\nA Stack with the depth property is used to show the percentage inside the progress ring.\nAll elements offer additional properties, such as font (for text elements), color, and spacing. These properties can usually be set through the shortcut, and they are available for almost every element. While fine-tuning these settings can be complex, the defaults are usually sufficient.\nThe Grid for repeating views # The Grid is a special layout element. As its name suggests, it arranges its elements into a set number of columns. The layout tree looks like this in the following examples:\nThe only difference in how it looks is the number of columns (highlighted in red in the first example).\nA Grid is special because it can be filled with repeating content of the same type. For example, this can be done through a loop in the shortcut. To illustrate how this works, consider a simple example: reading key/value pairs from a data source, in this case a shortcut dictionary. In this scenario, the keys are a few dairy products, each with a true/false value indicating whether they need to be purchased.\nThe widget\u0026rsquo;s output should end up looking like this:\nFor the Canvas definition, the Grid needs a Stack that serves as a template with placeholders for the checkbox and text for the product.\nIn theory, you could query the dictionary for each row in the shortcut and define a separate Stack each time. However, this method is not very flexible if a product is added or removed. It\u0026rsquo;s simpler to query the dictionary only once.\nFor the shortcut to work properly, each element must have a name. You also need to activate the \u0026ldquo;Template Children\u0026rdquo; option in the Grid\u0026rsquo;s properties (1).\nThe \u0026ldquo;Editor Shows\u0026rdquo; switch (2) determines if the preview shows the template\u0026rsquo;s placeholders or the data from the last time the shortcut was run using the \u0026ldquo;Created Children\u0026rdquo; option. This option is unavailable if the shortcut hasn\u0026rsquo;t run yet, and the \u0026ldquo;Clear Created Children\u0026rdquo; row (4) is also hidden.\nEnabling \u0026ldquo;Template Children\u0026rdquo; transforms the elements in the Grid into a template. The template can then be filled with data from the dictionary using a loop.\nSince the dictionary must be processed in a loop, all keys are first read into a list, which is then looped over (1). In each iteration of the loop (2), a new view is created from the template (3) defined in the Canvas and its placeholders are filled with data.\nIn step 4, the key of the current loop item is read using Repeat with Each Item. It is then written as text into the placeholder item in the copy of row that was just created inside the Grid list.\nThe value of the key/value pair must also be written into the corresponding placeholder, check. The template defines the element check, which displays an empty or checked checkbox depending on the value. First, the value of the current key is fetched (5) and passed as a true/false value into the If action (6).\nSimilar to passing the current key, this fills a placeholder. However, here the property is not Text; it is Symbol. In the \u0026ldquo;true\u0026rdquo; case (7), the symbol checkmark.square is used, and in the \u0026ldquo;false\u0026rdquo; case (8), only the symbol square is used.\nThe loop will end after it has processed every entry in the dictionary and created a view for each one based on the template. The result is a list of filled rows, called the \u0026ldquo;children\u0026rdquo; of the row template.\nFinally, the Grids list in the \u0026ldquo;GridTest\u0026rdquo; Canvas is updated with the result of the loop. Unlike inside the loop, it doesn\u0026rsquo;t use the Update View Created from Template action. Instead, it uses the regular Update View action to fill the children property of list with the list of views from the loop.\nYou can also build more complex widgets filled with multiple Grids, like Simon\u0026rsquo;s \u0026ldquo;Month Calendar\u0026rdquo; widget, which he uses as an example on his website.\nKeep in mind that widgets have fixed sizes, so they can\u0026rsquo;t display an unlimited number of rows or columns. If there is more data than can fit, the shortcut must handle that by limiting the number of loop runs. Overall, the combination of Grids, templates, and loops leaves plenty of room for discovering more ways to solve problems.\nUse cases # The Canvases app offers a new way to display shortcut results as a nicely designed widget. You can use any data source that a shortcut can work with. This includes interfaces to devices on your network, such as my solar system; internet services for weather or survey data; and data collected right on the device. For example, you can display your steps from the last few days from the Health app as a bar chart. The overview of my solar system is just one example. Instead of opening the PV app or website several times a day, I can see the current values right on my desktop.\nHowever, there is one limiting factor when using widgets: the data update rate is limited to around 40-50 updates per day. Initially, I planned to use launchd on the Mac to create a solution that runs the shortcut every five minutes. However, I had to abandon that idea, also because it isn\u0026rsquo;t possible on iPhone or iPad.\nAt least the Automation feature in Shortcuts lets you run a shortcut at a specific time. For example, you can set it to update activity data every day at 11:00 p.m., so you can check how active your day was before going to bed.\nInstead of automatic updates, you can place a button on the widget that, when clicked, starts the shortcut and loads the newest data. The app lets you add a URL to the button element in the Canvas definition for this purpose. On iOS, iPadOS, and macOS versions prior to 27, this launches the shortcut via the following URL:\nshortcuts://run-shortcut?name=Shortcut%20Name Starting with system version 27, there is also a \u0026ldquo;Run Shortcut\u0026rdquo; action that I have not yet tested.\nWhen the shortcut is run via the button, the Shortcuts app opens and remains in the foreground. As a workaround, you can add an action to hide the Shortcuts app at the beginning of the shortcut.\nI expanded on my example of a solar system by adding a button and a timestamp of the last update.\nAs an alternative to the Canvases app, Simon offers Scriptable, which can be used to create widgets using JavaScript. For this app there is also a community that offers ready-made scripts like this one: A curated list of awesome Scriptable scripts and widgets.\nHowever, Simon has created a more accessible way with the Canvases app through the Shortcuts app. I think a community around the app will form very soon.\nNotes # While iOS and iPadOS already run quite smoothly, the Mac version still needs work. For example, at least up until version 2021, I couldn\u0026rsquo;t reorder elements in the tree, so I created the example Canvas on my iPad. It syncs automatically, which can take a while, but then it works on the Mac with the matching shortcut.\nSo far, I have only built fairly simple examples without complex layouts. I still need to dig deeper into this topic since there are quite a few adjustable parameters that make it slightly complicated.\nOne thing I haven\u0026rsquo;t tried yet is using the AI feature to create a canvas. According to the documentation, providing a simple description of what should be displayed is enough to automatically generate a matching Canvas.\nWith the Canvases app, you can share a Canvas along with its matching shortcut. This creates a link that, when clicked, installs the Canvas and then the shortcut via an iCloud link.\nOverall, I think the Canvases app introduces new possibilities for Shortcuts by allowing you to present your data and analysis in a visually appealing way as a widget.\n","date":"August 30, 2026","externalUrl":null,"permalink":"/2026/08/30/canvases-finally-real-widgets-for-apple-shortcuts/","section":"Posts","summary":"I have a few shortcuts that show me the status of my devices on the network. For example, I can see the current data from my solar panel system. Unfortunately, Apple Shortcuts has very limited graphic options for this. Showing the results as a widget just wasn’t possible, so the best I could do was this:\n","title":"Canvases: Finally Real Widgets for Apple Shortcuts","type":"posts"},{"content":"","date":"August 30, 2026","externalUrl":null,"permalink":"/tag/ios/","section":"Tags","summary":"","title":"iOS","type":"tags"},{"content":"","date":"August 30, 2026","externalUrl":null,"permalink":"/category/shortcuts/","section":"Categories","summary":"","title":"Shortcuts","type":"categories"},{"content":"This article started as a background chapter for my German-language Obsidian guide at obsidianguide.de. While writing it, I realized it works just as well as a standalone read, so here it is in English too. If you have ever wondered why Obsidian feels different from other note-taking tools, the answer is not in the app itself but in the decades of ideas it draws from.\nObsidian didn\u0026rsquo;t come out of nowhere. Behind the app lie decades of ideas, failed experiments, technical standards, and academic research, all aimed at the same fundamental problem: how does a person manage their knowledge in a way that keeps it from getting lost, but instead lets it grow and connect?\nThe history splits into two parallel threads. The first is the story of ideas around networked knowledge and PKM. The second is the technical evolution of markup languages, which were meant to make writing and structuring text readable for both humans and machines. Both threads converge in Obsidian.\nNetworked Knowledge # 1945: As We May Think (Vannevar Bush) — In the magazine \u0026ldquo;The Atlantic Monthly,\u0026rdquo; Vannevar Bush sketched out the Memex concept, which is surprisingly close to what Obsidian can actually do.\nBush described Memex as a device where a person could store books, notes, and other artifacts that could be connected through what he called \u0026ldquo;associative trails.\u0026rdquo; That maps pretty directly onto what Obsidian calls bidirectional links.\nWhat Bush criticized back then still rings true today: knowledge is produced in enormous quantities, but we have almost no tools to connect it the way human thinking actually works, which is associative, not hierarchical. The problem was not access to information. It was the inability to build lasting, navigable connections between pieces of it.\nObsidian\u0026rsquo;s graph structure and backlinks are distilled directly from that idea, even though hardly anyone who uses Obsidian daily has ever read the essay. Online Reprint\n1965: Project Xanadu (Ted Nelson) — Ted Nelson coined the term \u0026ldquo;hypertext\u0026rdquo; in 1965 and also began work on Project Xanadu, a system he envisioned as a universal library of every document ever written. His central idea was the concept of transclusion: content should not be copied, but embedded directly from its source, with the connection to the original preserved and attribution automatic.\nIn some ways, Xanadu was more radical than today\u0026rsquo;s web and more radical than Obsidian: links would never go dead, every connection would be bidirectional, and the origin of any text would always be traceable. That sounds familiar to anyone who knows Obsidian\u0026rsquo;s backlinks and transclusion, but Nelson was thinking on a global scale.\nThe project was never finished and is considered one of the most famous failed software projects in history. Nelson worked on it for over fifty years without shipping a version that anyone actually used. That Nelson was right about the core idea is demonstrated by the fact that Obsidian and similar tools now implement in miniature what he had in mind for all of human knowledge. (Wikipedia)\n1968: NLS and the \u0026ldquo;Mother of All Demos\u0026rdquo; (Douglas Engelbart) — On December 9, 1968, Douglas Engelbart demonstrated a system called NLS (oN-Line System) in San Francisco before an audience of about a thousand computer scientists. It is considered one of the most influential demonstrations in the history of computing. In ninety minutes, Engelbart showed hypertext, the computer mouse, video conferencing, and real-time collaborative editing live, all concepts that would not become standard for decades.\nFor the history of Obsidian, the hypertext aspect is what matters most: NLS allowed documents to be connected by links and navigated between, at a time when most computers did not even have screens. But Engelbart\u0026rsquo;s broader ambition is worth noting. He called his research program \u0026ldquo;Augmenting Human Intellect.\u0026rdquo; The goal was not to automate tasks. It was to extend what a person could think, remember, and understand by giving them better tools for handling connected information. That framing is essentially what PKM is still about today. Wikipedia\n1987: Knowledge Navigator (Apple) — In 1987, Apple under CEO John Sculley produced a concept video showing a vision that was decades ahead of its time: a tablet-like device with an AI assistant that interacts with the user in natural language, accessing a networked system of documents, notes, and external information sources. The assistant does not just passively navigate content but understands context, suggests connections, and prepares information based on what is relevant in the moment.\nWhat makes the video remarkable is not the hardware vision, which admittedly looks a lot like the iPad, but the idea of AI as a navigation layer over a personal knowledge system. The user does not need to search and link manually. Instead, they describe what they need, and the assistant moves through the networked knowledge on their behalf.\nThat is exactly what tools like NotebookLM, AI plugins for Obsidian, or Claude as an assistant layer over your own vault are starting to make real today. Apple in 1987 did not just anticipate the iPad, they also posed the question that PKM enthusiasts are wrestling with now: what happens when AI actively navigates inside a personal knowledge network? (YouTube)\n1990: Hypertext and Hypermedia (Jakob Nielsen) — Before the web existed, hypertext was already a serious research field, and Jakob Nielsen\u0026rsquo;s 1990 book is one of the clearest summaries of what that research had learned. One of his central observations was the \u0026ldquo;lost in hyperspace\u0026rdquo; problem: users navigating a hypertext system often lose track of where they are, where they have been, and how to get back. The more nodes and links a system has, the worse the problem gets.\nNielsen\u0026rsquo;s proposed solutions, contextual orientation cues, structured overviews, consistent navigation patterns, read directly like a design checklist for modern PKM tools. Obsidian\u0026rsquo;s graph view, the backlinks panel, and breadcrumb plugins all address exactly the disorientation he described. The fact that his examples were built around Apple HyperCard rather than a web browser is a reminder of how long these problems predate the tools we use today. (Link to borrowing options)\n1989–1991: The World Wide Web (Tim Berners-Lee) — Tim Berners-Lee proposed the web in a 1989 memo at CERN, developed it through 1990, and published the first public website in August 1991. What he built was, at its core, a simplified version of what Bush and Nelson had imagined: linked documents navigable through hyperlinks.\nThe key difference from Nelson\u0026rsquo;s Xanadu was that Berners-Lee deliberately chose simplicity over correctness. Links only point in one direction. There are no automatic backlinks, no transclusion, no guarantee that a link will still work tomorrow. Berners-Lee later said he knew about these limitations but decided that getting something deployed mattered more than getting it perfect.\nThe web became simple enough to go global, but it did not actually solve the core problems Bush and Nelson had described. Every \u0026ldquo;404 Not Found\u0026rdquo; error is a small reminder of that tradeoff.\nFrom an Obsidian perspective, that is telling: what Obsidian offers with backlinks, graph view, and transclusion is, in a sense, an attempt to retrofit what the web consciously left out when it was built. (Wikipedia)\n1995: The Wiki (Ward Cunningham) — In 1995, Ward Cunningham put the first wiki online, which he simply called WikiWikiWeb. The core idea was radically simple: any page can be edited by anyone, any page can link to other pages, and new pages come into existence the moment you create a link that points to something that does not exist yet. The wiki was the first widely used system to make bidirectional thinking practically workable.\nCunningham\u0026rsquo;s insight was that the barrier to creating a new node should be zero. You do not plan your knowledge structure in advance. You write, link, and the structure emerges from use. That principle is exactly what Obsidian encourages with its \u0026ldquo;just create a note\u0026rdquo; philosophy.\nThe term \u0026ldquo;wikilink\u0026rdquo; in Obsidian comes directly from Cunningham\u0026rsquo;s invention. The double square bracket syntax [[Note Name]] originates in wiki markup and is today the central navigation element in Obsidian. What Cunningham built for collaborative knowledge bases, Obsidian uses as the foundational principle for personal knowledge spaces. (Wikipedia)\n1990s: Knowledge Management as a Research Field — Knowledge management, meaning all strategic and operational activities aimed at making the best possible use of knowledge, became a serious research field in the 1990s, primarily in business administration and computer science. The focus was almost entirely on organizations: how does a company preserve the knowledge of its employees, how does it make that knowledge accessible to others, and how does it prevent knowledge from disappearing when someone leaves? Lotus Notes, developed from 1984 onward, was the flagship example: a powerful system for collaborative document management and knowledge databases, built around the logic of the organization, not the logic of the individual thinker. (Knowledge Management)\nPersonal knowledge management, by contrast, is not about knowledge in a team or organization but about the perspective of a single individual, regardless of whether the context is professional or personal. PKM is explicitly a bottom-up approach that starts with the person, not the institution, and that orients itself around how human thinking actually works: associative, not hierarchical. For Obsidian users, PKM is the relevant frame. The goal is not to manage the knowledge of a department, but to organize your own thinking, connect it, and make it usable over the long term.\n1990s: Content Management Systems — Parallel to PKM research, another branch of knowledge organization emerged in the 1990s: content management systems, or CMS. Where PKM emphasizes the individual perspective, a CMS solves the problem at the organizational level: how does a newsroom, a company, or an institution manage large amounts of content, who can edit what, and how is content published in a structured way?\nA CMS separates content, structure, and presentation: the author writes text, and the system handles layout and publishing. Well-known examples include WordPress, TYPO3, and Drupal. That separation will sound familiar to anyone who uses Obsidian: you write in plain Markdown, and something like Quartz handles the rendering as a website. The difference is fundamental, though. A CMS is built for publishing and collaboration. Obsidian is built for personal thinking and linking. Publishing an Obsidian vault with Quartz is, in a way, building a highly personal CMS, but one that starts from a completely different philosophy. (A Brief History of the Content Managment System)\nTechnical Foundations # 1986: SGML (Standard Generalized Markup Language) — SGML was adopted as an ISO standard in 1986 and was the first widely used metalanguage for defining markup languages. The core idea was forward-looking: document content and structure should be cleanly separated, and the markup should be machine-readable without replacing the actual text.\nSGML was powerful, but correspondingly complex. It was used mainly in publishing, government agencies, and the aerospace industry, anywhere large volumes of documents had to be managed in structured form. For ordinary users it was simply too much effort. Still, SGML laid the conceptual foundation for everything that came after: HTML is an application of SGML, and the philosophy behind Markdown traces back to the same thinking. (Wikipedia)\n1991: HTML (HyperText Markup Language) — When Berners-Lee published the first website, he used HTML, a heavily simplified application of SGML. HTML was deliberately pragmatic: a handful of tags, enough to structure documents and link them together, and that was enough to get the web moving.\nWhat made HTML so successful also became its problem over time. Tags like \u0026lt;b\u0026gt; or \u0026lt;font\u0026gt; mixed content and presentation, and as websites grew more complex, HTML source code became increasingly difficult to read. For writing notes or documents it was simply unsuitable. Trying to write a simple article meant fighting through a jungle of angle brackets. The gap between \u0026ldquo;human-writable\u0026rdquo; and \u0026ldquo;machine-renderable\u0026rdquo; had never been wider. (Wikipedia)\n1998: XML (Extensible Markup Language) — XML was an attempt to preserve the best parts of SGML while reducing the complexity. Unlike HTML, XML was not a fixed language with predefined tags, but a flexible system for defining your own markup languages. XML quickly became the standard for data exchange between systems and still underpins many file formats today, including the Microsoft Word document format and the EPUB format for ebooks.\nFor human writing, XML was just as unsuitable as HTML, arguably more so, because the strictness of the format left even less room for flexibility. But XML did reinforce one important idea: structured, plain-text formats could be both machine-readable and durable. That idea would matter when Markdown came along. (Wikipedia)\n2004: Markdown (John Gruber) — John Gruber released Markdown in 2004 with a refreshingly clear goal: a markup language that is just as readable as plain text as it is after being converted to HTML. A heading marked with #looks like a heading even without rendering. Bold text with **double asterisks** is intuitively readable. A list with minus signs is recognizable as a list even without a parser.\nThat was a small revolution, because Gruber reversed the usual direction: instead of the person adapting to the machine, the markup language adapts to the way people actually write. Markdown spread quickly through the developer community, on platforms like GitHub and Reddit, and eventually became the foundation for a whole generation of writing and knowledge management tools.\nOne side effect that Gruber probably did not fully anticipate: because Markdown files are plain text, they are also future-proof. No proprietary format, no vendor lock-in, no file that becomes unreadable when a company folds. That property turned out to matter a great deal for tools like Obsidian. (Daring Fireball)\n2020: Roam Research and the Backlink Moment — Before Obsidian existed, there was Roam Research. Launched in early 2020, Roam was the tool that brought bidirectional links into mainstream PKM conversations. The idea itself was not new, Bush and Nelson had described it decades earlier, but Roam made it feel immediate and practical in a way that no previous tool had. Every note automatically appeared in the backlinks panel of every note it linked to. The graph grew as you wrote. The community around Roam, vocal on Twitter and in newsletters, turned networked note-taking into a genuine cultural moment.\nObsidian launched in March 2020, just months after Roam had ignited the conversation. It took the same core idea but made a different bet: local files, Markdown, no subscription, no cloud dependency. For users who wanted the linked-thinking model but were uncomfortable handing their notes to a web app, Obsidian was the answer. Without Roam\u0026rsquo;s proof of concept, it is unlikely the PKM landscape of the early 2020s would have looked anything like it did. And without that landscape, Obsidian might have remained a niche tool for a very small audience.\nObsidian is perhaps the most consistent example of what happens when you treat Markdown not just as an output format, but as the native format for an entire knowledge system. The history above shows that almost every idea it embodies had been described, attempted, or partially implemented before. What Obsidian did was assemble them in a way that was actually usable, durable, and open enough to extend. That combination turned out to be the thing that stuck.\n","date":"May 22, 2026","externalUrl":null,"permalink":"/2026/05/22/before-obsidian-a-short-history-of-networked-knowledge-and-markup/","section":"Posts","summary":"This article started as a background chapter for my German-language Obsidian guide at obsidianguide.de. While writing it, I realized it works just as well as a standalone read, so here it is in English too. If you have ever wondered why Obsidian feels different from other note-taking tools, the answer is not in the app itself but in the decades of ideas it draws from.\n","title":"Before Obsidian: A Short History of Networked Knowledge and Markup","type":"posts"},{"content":"","date":"May 22, 2026","externalUrl":null,"permalink":"/category/obsidian/","section":"Categories","summary":"","title":"Obsidian","type":"categories"},{"content":"","date":"May 22, 2026","externalUrl":null,"permalink":"/category/pkm/","section":"Categories","summary":"","title":"PKM","type":"categories"},{"content":"","date":"May 22, 2026","externalUrl":null,"permalink":"/tag/pkm/","section":"Tags","summary":"","title":"PKM","type":"tags"},{"content":"If you\u0026rsquo;re looking for a thorough German-language Obsidian resource to recommend, check out obsidianguide.de. The foundations are already published, covering everything from first-time setup through more advanced workflows like Dataview queries, Bases, Templater, and structured daily notes. There\u0026rsquo;s also a growing glossary with over 80 entries and a dedicated section on the subtle gotchas that tend to bite you once you go deeper, things like date format pitfalls and iCloud\u0026rsquo;s relationship with hidden folders.\nThe guide is an ongoing project, with new content added regularly as Obsidian itself keeps evolving.\nThe content is free, ad-free, and written for anyone who wants to get serious about Obsidian.\nobsidianguide.de\n","date":"April 15, 2026","externalUrl":null,"permalink":"/2026/04/15/dont-panic-just-markup-a-german-language-obsidian-guide/","section":"Posts","summary":"If you’re looking for a thorough German-language Obsidian resource to recommend, check out obsidianguide.de. The foundations are already published, covering everything from first-time setup through more advanced workflows like Dataview queries, Bases, Templater, and structured daily notes. There’s also a growing glossary with over 80 entries and a dedicated section on the subtle gotchas that tend to bite you once you go deeper, things like date format pitfalls and iCloud’s relationship with hidden folders.\n","title":"Don't Panic - Just Markup: A German-Language Obsidian Guide","type":"posts"},{"content":"","date":"April 14, 2026","externalUrl":null,"permalink":"/tag/automation/","section":"Tags","summary":"","title":"Automation","type":"tags"},{"content":"","date":"April 14, 2026","externalUrl":null,"permalink":"/category/cli/","section":"Categories","summary":"","title":"CLI","type":"categories"},{"content":"","date":"April 14, 2026","externalUrl":null,"permalink":"/tag/cli/","section":"Tags","summary":"","title":"CLI","type":"tags"},{"content":"","date":"April 14, 2026","externalUrl":null,"permalink":"/tag/linux/","section":"Tags","summary":"","title":"Linux","type":"tags"},{"content":"","date":"April 14, 2026","externalUrl":null,"permalink":"/tag/msmtp/","section":"Tags","summary":"","title":"msmtp","type":"tags"},{"content":"","date":"April 14, 2026","externalUrl":null,"permalink":"/tag/script/","section":"Tags","summary":"","title":"script","type":"tags"},{"content":"Update (October 25, 2026) Thanks to a reader\u0026rsquo;s comment, I added a chapter on keeping the SMTP password out of the config file with passwordeval. It shows two ways, the macOS Keychain and pass with gpg on Linux, and explains when the simple plain text password is still the better choice.\nA few scripts run on my Raspberry Pi that monitor my systems and send an email when certain events occur. In an earlier post, on my german website, I described how I set up Postfix as a local mail server for that purpose. Here I want to show a simpler approach for cases where all you need is to send emails from the command line on a Linux or Mac system.\nHow Email Actually Works # Sending and receiving email requires a mail server that is reachable from the internet. In most home setups, your own machine does not act as a mail server directly. Instead, you use an email client like Apple Mail or Thunderbird to fetch mail from an extern server or send mail through it.\nThe communication between the client and the server uses two protocols: SMTP for sending, and IMAP for reading and managing mail on the server. With IMAP, the server\u0026rsquo;s contents are essentially mirrored to your local machine, similar to how Dropbox or iCloud sync files. When you delete a message in Thunderbird, it gets deleted on the server too. That way the same account can be connected to multiple computers, all seeing the same folder structure and messages. But that part of the email experience is not what this article is about.\nFor sending email, SMTP is what matters. When you compose a message in your email client and hit Send, the client assembles the message according to certain rules and transmits it via SMTP to your mail server. That server then forwards it to the recipient\u0026rsquo;s server, which stores it in the recipient\u0026rsquo;s inbox.\nHeader, Body, and MIME: How an Email Is Structured # An email consists of two parts: a header and a body, separated by a blank line.\nThe header contains the required fields From (sender) and To (recipient). The Date field is also required and should be set by the sending client. If it is missing, the mail server adds it as a fallback. Optional fields include the subject (Subject), copy and blind copy recipients (CC and BCC), and Reply-To if replies should go to a different address. The Message-ID field should also be set, because mail clients use it to group messages into conversations.\nFor emails with attachments or mixed content, the header must also include a Content-Type field with a boundary, so that the receiving client knows how to parse the body. In that case, MIME-Version: 1.0 must appear in the header as well.\nThe MIME Structure of HTML Emails # A plain text email has a simple body. As soon as HTML, images, or attachments enter the picture, the email is split into multiple parts, which can themselves contain parts. This looks more complicated than it is.\nHere is an example of an email with an HTML part, a plain text fallback, and an embedded image used as a signature:\nFrom: sender@example.de To: recipient@example.de Subject: =?utf-8?Q?Nice_subject_with_Uml=C3=A4uten?= Date: Tue, 17 Mar 2026 10:00:00 +0100 Message-ID: \u0026lt;unique-id@example.de\u0026gt; MIME-Version: 1.0 Content-Type: multipart/mixed; boundary=\u0026#34;==BOUNDARY_1==\u0026#34; --==BOUNDARY_1== Content-Type: multipart/related; boundary=\u0026#34;==BOUNDARY_2==\u0026#34; --==BOUNDARY_2== Content-Type: multipart/alternative; boundary=\u0026#34;==BOUNDARY_3==\u0026#34; --==BOUNDARY_3== Content-Type: text/plain; charset=\u0026#34;utf-8\u0026#34; Content-Transfer-Encoding: quoted-printable Hello! Kind regards! --==BOUNDARY_3== Content-Type: text/html; charset=\u0026#34;utf-8\u0026#34; Content-Transfer-Encoding: quoted-printable \u0026lt;html\u0026gt; \u0026lt;body\u0026gt; \u0026lt;p\u0026gt;Hello! Kind regards!\u0026lt;/p\u0026gt; \u0026lt;img src=\u0026#34;cid:signature.png\u0026#34;\u0026gt; \u0026lt;/body\u0026gt; \u0026lt;/html\u0026gt; --==BOUNDARY_3==-- --==BOUNDARY_2== Content-Type: image/png Content-Transfer-Encoding: base64 Content-ID: \u0026lt;signature.png\u0026gt; Content-Disposition: inline iVBORw0KGgoAAAANSUhEUgAA... --==BOUNDARY_2==-- --==BOUNDARY_1==-- The nested structure looks a bit intimidating at first glance, but it follows a clear logic. The outer container multipart/mixed is the envelope for the entire email and would be the right place for actual file attachments. Inside it sits multipart/related, which keeps the HTML part and the embedded image together. The image is referenced in the HTML via cid:signature.png and is therefore not a standalone attachment. Within related, multipart/alternative gives the mail client a choice: it renders either the HTML part or, if it does not support HTML, the plain text fallback.\nCharacter Encoding: Why quoted-printable? # The SMTP protocol was defined at a time when 7-bit ASCII was the reliable standard for data transmission. That set of 127 characters does not include umlauts or other special characters. The letter ö, for example, is encoded in UTF-8 as two bytes, 0xC3 and 0xB6, both values above 127. Older relay servers could corrupt or drop such bytes.\nquoted-printable solves this by converting all non-ASCII characters into a safe ASCII representation. The ö becomes =C3=B6, and ü becomes =C3=BC. The receiving server transports these encoded bytes without modification, and only the mail client decodes them and interprets them according to the charset=utf-8 declaration in the Content-Type header.\nIn the header itself, things work a bit differently. There is no charset field there, so the RFC 2047 Encoded Word format is used instead:\nSubject: =?utf-8?Q?Nice_subject_with_Uml=C3=A4uten?= The format is always:\n=?charset?encoding?encoded text?= The Q stands for Quoted-Printable and B stands for Base64. Mail clients decode this automatically and display the readable subject line.\nModern mail servers often support the SMTP extension SMTPUTF8 (RFC 6531), which allows raw UTF-8 bytes in transport, but you can never be sure which servers an email passes through on its way. Encoding properly is the safe choice.\nInstalling and Configuring msmtp # msmtp is a lightweight SMTP client. It sends emails through your provider\u0026rsquo;s SMTP server without being a mail server itself. It accepts a finished message on standard input and forwards it. That means the message must already be correctly assembled, including the header, the blank line separator, and the content. msmtp does not build HTML mail, add attachments, or create any structure. It just sends whatever you give it. And since no mail client is there to handle encoding, that part has to be done beforehand, as described in the previous section.\nHere is a minimal example to send a plain text message from the command line:\necho -e \u0026#34;Subject: Test\\n\\nHello World\u0026#34; | msmtp test@example.com The -e flag for echo is important here, because there must be a blank line between the subject header and the message body. Without -e, the \\n would be treated as literal text rather than a newline character.\nInstallation # On a Linux system like Ubuntu, there are two relevant packages:\nmsmtp is the actual SMTP client. msmtp-mta is a compatibility wrapper that registers msmtp as a drop-in replacement for classic MTAs like sendmail or Postfix. For simple command-line sending, the first package is all you need. The second one only makes sense if you want to use other command-line tools like mail for sending and do not already have an MTA like sendmail or Postfix configured. If you have a desktop mail client installed, it talks directly to your mail server, so this installation has no effect on your regular email.\nInstall with:\nsudo apt update sudo apt install msmtp If the installer suggests adding msmtp-mta, you can decline, which leaves any existing configuration untouched.\nAfter the download you may be asked whether to add msmtp to your AppArmor profile. AppArmor is a security mechanism in Ubuntu. In my test installation I confirmed this option and have not had any problems with it.\nOn macOS, msmtp can be installed with Homebrew or another package manager:\nbrew install msmtp Configuration # Next, a configuration file needs to be created. You can choose between a user-specific file at ~/.msmtprc or a global one at /etc/msmtprc. With a global configuration, all users on the system, including root, cron jobs, and system services, can use msmtp with the credentials stored there without needing their own configuration file.\nIn my setup, the global variant makes sense because I am the only interactive user, and this way even scripts running as root can send mail without any extra setup. If multiple users each need their own mail account, the user-specific ~/.msmtprc is the better choice. On macOS it is generally recommended, because the Homebrew-installed msmtp expects the system-wide configuration file at a version-specific path that changes with every msmtp update. The user-specific ~/.msmtprc works the same on macOS and Linux and is not affected by updates.\ndefaults auth on tls on tls_starttls on tls_trust_file /etc/ssl/certs/ca-certificates.crt # On macOS, certificates are loaded from the Keychain, # so the tls_trust_file line should be removed or commented out. # On Ubuntu, syslog is usually more practical than a log file syslog LOG_MAIL # On macOS you can write to a log file directly # logfile /Users/myuser/Library/Logs/msmtp.log # Global log file, may cause permission issues # logfile /var/log/msmtp.log # User log file, simple solution if msmtp is always called by the same user # logfile ~/.msmtp.log account default host smtp.yourprovider.com port 587 from youruser@domain.com user youruser@domain.com password yourpassword You can define multiple account entries in the configuration to send mail from different sender addresses, for example. One of them must be named default, which is used when msmtp is called without explicitly specifying an account. More on that below.\nKeeping the password out of the config file # If you don\u0026rsquo;t want the password in plain text, you can use the option passwordeval. msmtp runs the given command and uses its output as the password. This is more secure, but also more complex. The command runs as the user who calls msmtp, so the password has to be reachable in exactly that context. That gets tricky for cron jobs, system services or other users, for example when a gpg key is protected by a passphrase and nobody is there to enter it.\nThe two examples below show how to keep the password out of the config file. Option A is for macOS and uses the macOS Keychain, Option B uses pass on a headless Linux machine such as a Raspberry Pi. Both work well as long as you are logged in, because the password is tied to your session. The Keychain is unlocked with your login, and the gpg key behind pass needs its passphrase, which gpg-agent only remembers while you are around. A cron job that runs while you are logged out can\u0026rsquo;t get to the password and fails. There are ways around this, but they are complicated and beyond this article. The GnuPG manual on gpg-preset-passphrase is one place to start. If you need cron jobs and are the only user of the system, the simplest solution is to keep the password in /etc/msmtprc.\nOption A: macOS Keychain # First, add the password to the Keychain.\nsecurity add-generic-password -s smtp.yourprovider.com -a youruser@domain.com -U -w Because -w has no value, security asks for the password and then asks you to retype it. Nothing is displayed while you type. The option -U updates an existing entry, so you can run the same command again when your password changes.\nYou could also put the password directly after -w, but then it stays in your shell history and is visible in the process list while the command runs. I would avoid that.\nNow replace the line password yourpassword in your config with this line.\npasswordeval \u0026#34;security find-generic-password -s smtp.yourprovider.com -a youruser@domain.com -w\u0026#34; The values after -s and -a must be identical to the ones you used when adding the entry. Run the command once in the Terminal to check that it prints your password. From now on the password comes from the Keychain and no longer appears in the config file.\nOption B: Linux with pass and gpg # On my Raspberry Pi, which runs without a desktop, I use pass, a small password manager that stores each password as a gpg-encrypted file. If you haven\u0026rsquo;t done so already, install pass and gnupg.\nsudo apt install pass gnupg Now generate a key pair.\ngpg --full-generate-key On current GnuPG versions the defaults work well (ECC with Curve 25519). Name and email address are up to you, but they are used later to identify the key. You can set the expiration to 0 so the key never expires.\nNow list your keys.\ngpg --list-secret-keys You will get an output like this.\nsec ed25519 2026-10-23 [SC] A1B2C3D4E5F6A7B8C9D0E1F2A3B4C5D6E7F8A9B0 uid [ultimate] myname (key for msmtp) \u0026lt;youruser@domain.com\u0026gt; ssb cv25519 2026-10-23 [E] Copy the long string in the second line, which is the fingerprint of your key. Then create the password store with it.\npass init A1B2C3D4E5F6A7B8C9D0E1F2A3B4C5D6E7F8A9B0 Now add an entry for your mail password.\npass insert mail/myaccount pass asks for the password twice. mail/myaccount is just a name to identify the entry, which helps if you use more than one mail account.\nFinally, replace the line password yourpassword in your config with this line.\npasswordeval \u0026#34;pass mail/myaccount\u0026#34; Test it by running pass mail/myaccount in the shell. If it prints your password without asking for anything, msmtp will be able to read it too.\nOnce you have created and saved the file, you are ready to send mail with msmtp.\nFirst Tests on the Command Line # Send your first test email:\necho -e \u0026#34;Subject: Test\\n\\nHello World\u0026#34; | msmtp test@example.com --debug Strictly speaking, this does not produce a fully standards-compliant email, since all header fields except Subject are missing. msmtp creates an SMTP envelope from the email address in the argument and the from entry in the config file, wraps the output of echo -e in it, and sends it. Most modern mail servers that receive such a message will add the missing fields like From, To, Date, and Message-ID, so a complete email shows up in the inbox, but you should not rely on that.\nOne detail that might not be obvious: the -e flag ensures that \\n is treated as a real newline, not as the two characters backslash and n. It is also important that the header is separated from the body by a blank line. That is why there are two \\n in a row: the first ends the last header line, and the second creates the required blank line.\nFor that reason, the following approach is a better choice. All important header fields are fully assembled before the finished email is passed to msmtp:\nprintf \u0026#39;%s\\n\u0026#39; \\ \u0026#34;From: Server \u0026lt;server@example.com\u0026gt;\u0026#34; \\ \u0026#34;To: Leif \u0026lt;leif@example.org\u0026gt;\u0026#34; \\ \u0026#34;Subject: Test via msmtp\u0026#34; \\ \u0026#34;Date: $(LC_ALL=C date -R)\u0026#34; \\ \u0026#34;MIME-Version: 1.0\u0026#34; \\ \u0026#34;Content-Type: text/plain; charset=UTF-8\u0026#34; \\ \u0026#34;\u0026#34; \\ \u0026#34;Hello,\u0026#34; \\ \u0026#34;this is a test.\u0026#34; \\ | msmtp test@example.com If you are wondering about the \\ at the end of each line: it prevents the shell from treating each line as a separate command. The entire call would normally have to be on one line, which quickly becomes unreadable. At the same time, each header field needs to be separated by a newline in the transmitted message. That is handled by the format string '%s\\n' in the printf command, which appends a newline after each quoted string.\nScript for Sending System Info # Now that we know sending mail from the command line works, here is a script that assembles some current system parameters and sends them as an email.\nThe mail uses multipart/alternative as its Content-Type, which means the outer container holds two or more parts. In this case, an HTML part that presents the data as a table, and a plain text fallback for mail clients without HTML support.\nThe script works on both macOS and Linux.\nIt is organized in three sections. The first section fills variables with the data needed to build the email. This includes the header fields, where the subject is assembled from the text \u0026ldquo;System Report\u0026rdquo; and the current date. The boundary variable is constructed from the prefix ALT_ and the number of seconds since January 1, 1970, which is where Unix time counting begins. This ensures the boundary name is unique and avoids collisions when, for example, one email is embedded inside another.\nThe second section collects system data into variables. HOSTNAME=$(hostname) runs the hostname command and stores its output in the HOSTNAME variable. The $(...) syntax is the pattern here: whatever sits between the parentheses is executed as a command, and the result is used directly. The same pattern appears throughout the script, for example with $(date) or $(uname). It can also capture the output of more complex calls:\nDISK=$(df -h / | awk \u0026#39;NR==2 {print $3 \u0026#34; of \u0026#34; $2 \u0026#34; used (\u0026#34; $5 \u0026#34;)\u0026#34;}\u0026#39;) Here df -h / shows the disk usage of the root directory. The -h flag makes the output human-readable, so sizes are shown in GB or MB rather than raw bytes. The output looks something like this:\nFilesystem Size Used Avail Use% Mounted on /dev/sda1 30G 8.2G 22G 28% / The | pipes that output to awk, a powerful tool for recognizing and processing text patterns. In this case, NR==2 limits processing to the second line, which is the one with the actual data. $3, $2, and $5 address the values in the respective columns, so:\n{print $3 \u0026#34; of \u0026#34; $2 \u0026#34; used (\u0026#34; $5 \u0026#34;)\u0026#34;} produces the text 8.2G of 30G used (28%) and stores it in the DISK variable.\nThe other system parameters follow the same pattern. The script distinguishes between Linux and macOS, since RAM and CPU information are queried differently on the two systems.\nThe third section defines the email content. The plain text part is written to the variable PLAIN and the HTML part to HTML. Then the email is assembled, with a separate printf command for each part: header, plain text, and HTML.\nTo correctly encode the plain text and HTML parts, the script uses a Python one-liner that works on both Linux and macOS:\nprintf \u0026#39;%s\\n\u0026#39; \u0026#34;$PLAIN\u0026#34; | python3 -c \u0026#34; import sys, quopri sys.stdout.buffer.write(quopri.encodestring(sys.stdin.buffer.read())) \u0026#34; The printf commands assemble the email and pipe the result to msmtp, which delivers it to $TO.\n#!/bin/bash TO=\u0026#34;recipient@example.com\u0026#34; FROM=\u0026#34;sender@example.com\u0026#34; SUBJECT=\u0026#34;System Report $(date \u0026#39;+%m/%d/%Y\u0026#39;)\u0026#34; BOUNDARY_ALT=\u0026#34;==ALT_$(date +%s)==\u0026#34; # System data HOSTNAME=$(hostname) OS=$(uname) # Disk usage (works on both systems) DISK=$(df -h / | awk \u0026#39;NR==2 {print $3 \u0026#34; of \u0026#34; $2 \u0026#34; used (\u0026#34; $5 \u0026#34;)\u0026#34;}\u0026#39;) # Uptime (works on both systems) UPTIME=$(uptime | sed \u0026#39;s/.*up //\u0026#39; | sed \u0026#39;s/,.*//\u0026#39;) # RAM and CPU differ by operating system if [ \u0026#34;$OS\u0026#34; = \u0026#34;Darwin\u0026#34; ]; then RAM_TOTAL=$(sysctl -n hw.memsize | awk \u0026#39;{printf \u0026#34;%.0f MB\u0026#34;, $1/1024/1024}\u0026#39;) RAM_USED=$(vm_stat | awk \u0026#39; /Pages active/ {active=$3} /Pages wired/ {wired=$4} END {printf \u0026#34;%.0f MB\u0026#34;, (active+wired)*4096/1024/1024}\u0026#39;) RAM=\u0026#34;${RAM_USED} used of ${RAM_TOTAL}\u0026#34; CPU_INFO=$(sysctl -n machdep.cpu.brand_string) else RAM=$(free -m | awk \u0026#39;NR==2 {printf \u0026#34;%d MB of %d MB used\u0026#34;, $3, $2}\u0026#39;) CPU_INFO=$(grep \u0026#34;model name\u0026#34; /proc/cpuinfo | head -1 | cut -d: -f2 | xargs) fi # Plain text part PLAIN=\u0026#34;System Report: $HOSTNAME $(date) Operating System : $OS CPU : $CPU_INFO Disk : $DISK RAM : $RAM Uptime : $UPTIME\u0026#34; # HTML part HTML=\u0026#34;\u0026lt;!DOCTYPE html\u0026gt; \u0026lt;html\u0026gt; \u0026lt;head\u0026gt;\u0026lt;meta charset=\\\u0026#34;utf-8\\\u0026#34;\u0026gt;\u0026lt;/head\u0026gt; \u0026lt;body style=\\\u0026#34;font-family: sans-serif; font-size: 14px;\\\u0026#34;\u0026gt; \u0026lt;h2\u0026gt;System Report: $HOSTNAME\u0026lt;/h2\u0026gt; \u0026lt;p style=\\\u0026#34;color: #666;\\\u0026#34;\u0026gt;$(date)\u0026lt;/p\u0026gt; \u0026lt;table style=\\\u0026#34;border-collapse: collapse; width: 100%;\\\u0026#34;\u0026gt; \u0026lt;tr style=\\\u0026#34;background: #f0f0f0;\\\u0026#34;\u0026gt; \u0026lt;td style=\\\u0026#34;padding: 8px; border: 1px solid #ccc;\\\u0026#34;\u0026gt;\u0026lt;strong\u0026gt;Operating System\u0026lt;/strong\u0026gt;\u0026lt;/td\u0026gt; \u0026lt;td style=\\\u0026#34;padding: 8px; border: 1px solid #ccc;\\\u0026#34;\u0026gt;$OS\u0026lt;/td\u0026gt; \u0026lt;/tr\u0026gt; \u0026lt;tr\u0026gt; \u0026lt;td style=\\\u0026#34;padding: 8px; border: 1px solid #ccc;\\\u0026#34;\u0026gt;\u0026lt;strong\u0026gt;CPU\u0026lt;/strong\u0026gt;\u0026lt;/td\u0026gt; \u0026lt;td style=\\\u0026#34;padding: 8px; border: 1px solid #ccc;\\\u0026#34;\u0026gt;$CPU_INFO\u0026lt;/td\u0026gt; \u0026lt;/tr\u0026gt; \u0026lt;tr style=\\\u0026#34;background: #f0f0f0;\\\u0026#34;\u0026gt; \u0026lt;td style=\\\u0026#34;padding: 8px; border: 1px solid #ccc;\\\u0026#34;\u0026gt;\u0026lt;strong\u0026gt;Disk\u0026lt;/strong\u0026gt;\u0026lt;/td\u0026gt; \u0026lt;td style=\\\u0026#34;padding: 8px; border: 1px solid #ccc;\\\u0026#34;\u0026gt;$DISK\u0026lt;/td\u0026gt; \u0026lt;/tr\u0026gt; \u0026lt;tr\u0026gt; \u0026lt;td style=\\\u0026#34;padding: 8px; border: 1px solid #ccc;\\\u0026#34;\u0026gt;\u0026lt;strong\u0026gt;RAM\u0026lt;/strong\u0026gt;\u0026lt;/td\u0026gt; \u0026lt;td style=\\\u0026#34;padding: 8px; border: 1px solid #ccc;\\\u0026#34;\u0026gt;$RAM\u0026lt;/td\u0026gt; \u0026lt;/tr\u0026gt; \u0026lt;tr style=\\\u0026#34;background: #f0f0f0;\\\u0026#34;\u0026gt; \u0026lt;td style=\\\u0026#34;padding: 8px; border: 1px solid #ccc;\\\u0026#34;\u0026gt;\u0026lt;strong\u0026gt;Uptime\u0026lt;/strong\u0026gt;\u0026lt;/td\u0026gt; \u0026lt;td style=\\\u0026#34;padding: 8px; border: 1px solid #ccc;\\\u0026#34;\u0026gt;$UPTIME\u0026lt;/td\u0026gt; \u0026lt;/tr\u0026gt; \u0026lt;/table\u0026gt; \u0026lt;/body\u0026gt; \u0026lt;/html\u0026gt;\u0026#34; # Assemble and send the email # Header, followed by a blank line { printf \u0026#39;%s\\n\u0026#39; \\ \u0026#34;From: $FROM\u0026#34; \\ \u0026#34;To: $TO\u0026#34; \\ \u0026#34;Subject: $SUBJECT\u0026#34; \\ \u0026#34;Date: $(LC_ALL=C date -R)\u0026#34; \\ \u0026#34;MIME-Version: 1.0\u0026#34; \\ \u0026#34;Content-Type: multipart/alternative; boundary=\\\u0026#34;$BOUNDARY_ALT\\\u0026#34;\u0026#34; \\ \u0026#34;\u0026#34; # Plain text part (starts with boundary and blank line) printf \u0026#39;%s\\n\u0026#39; \\ \u0026#34;--$BOUNDARY_ALT\u0026#34; \\ \u0026#34;Content-Type: text/plain; charset=utf-8\u0026#34; \\ \u0026#34;Content-Transfer-Encoding: quoted-printable\u0026#34; \\ \u0026#34;\u0026#34; printf \u0026#39;%s\\n\u0026#39; \u0026#34;$PLAIN\u0026#34; | python3 -c \u0026#34; import sys, quopri sys.stdout.buffer.write(quopri.encodestring(sys.stdin.buffer.read())) \u0026#34; # HTML part (starts with boundary and blank line) printf \u0026#39;%s\\n\u0026#39; \\ \u0026#34;\u0026#34; \\ \u0026#34;--$BOUNDARY_ALT\u0026#34; \\ \u0026#34;Content-Type: text/html; charset=utf-8\u0026#34; \\ \u0026#34;Content-Transfer-Encoding: quoted-printable\u0026#34; \\ \u0026#34;\u0026#34; printf \u0026#39;%s\\n\u0026#39; \u0026#34;$HTML\u0026#34; | python3 -c \u0026#34; import sys, quopri sys.stdout.buffer.write(quopri.encodestring(sys.stdin.buffer.read())) \u0026#34; # Closing boundary printf \u0026#39;%s\\n\u0026#39; \\ \u0026#34;\u0026#34; \\ \u0026#34;--$BOUNDARY_ALT--\u0026#34; } | msmtp \u0026#34;$TO\u0026#34; This example shows the basic principle of assembling a multipart email using system data. The next section applies the same approach with a live weather service.\nEmail with Current Weather # Open-Meteo is a free weather service with a simple API, meaning a straightforward interface that a script or program can use to fetch weather data. A single curl call with geographic coordinates and a few parameters returns current conditions as JSON. Open-Meteo is a good example here because weather data can be retrieved without an account or API key. The script requests weather for the location whose coordinates you specify.\nSince the location name is shown next to the date in the subject line and may contain special characters, the script has to ensure those characters are correctly encoded.\nUnlike the plain text and HTML parts, where Content-Type and Content-Transfer-Encoding tell the receiving mail client how the following text is encoded, the subject line requires its own handling.\nFor that purpose, the function encode_subject is defined:\nencode_subject() { python3 -c \u0026#34; import sys subject = sys.argv[1] if all(ord(c) \u0026lt; 128 for c in subject): print(subject) else: encoded = subject.encode(\u0026#39;utf-8\u0026#39;) qp = \u0026#39;\u0026#39;.join( \u0026#39;_\u0026#39; if b == 32 else \u0026#39;={:02X}\u0026#39;.format(b) if b \u0026gt; 127 or chr(b) in \u0026#39;?=_\u0026#39; else chr(b) for b in encoded ) print(\u0026#39;=?utf-8?Q?\u0026#39; + qp + \u0026#39;?=\u0026#39;) \u0026#34; \u0026#34;$1\u0026#34; } When non-ASCII characters are present, the text is converted to UTF-8 bytes. The ö in a city name like Mönsheim becomes two bytes in UTF-8: 0xC3 and 0xB6. Each of those bytes is then processed by a compact loop that decides how it should appear in the result string. Three rules apply: a space (byte 32) is replaced by an underscore, since spaces in header fields are treated as separators. Bytes above 127 and the special characters ?, =, and _ are represented as =XX, where XX is the hexadecimal value of the byte. All other bytes, meaning regular ASCII characters like letters or digits, are passed through unchanged.\nThe resulting pieces are joined into a single string with join. For Mönsheim the result would be:\nM=C3=B6nsheim Finally, this encoded text is wrapped in the RFC 2047 envelope:\n=?utf-8?Q?M=C3=B6nsheim?= This tells the mail client that the text is UTF-8 encoded and uses Q-Encoding. The client automatically decodes it and displays \u0026ldquo;Mönsheim\u0026rdquo;.\nWith the subject handled, the API call is assembled. The script does this by appending one segment at a time to the API_URL variable. The final result is equivalent to this command:\ncurl \u0026#34;https://api.open-meteo.com/v1/forecast?latitude=48.85\u0026amp;longitude=8.93\u0026amp;current=temperature_2m,relative_humidity_2m,wind_speed_10m,weather_code\u0026amp;wind_speed_unit=kmh\u0026amp;timezone=Europe/Berlin\u0026#34; The response looks like this:\n{ \u0026#34;latitude\u0026#34;: 48.84, \u0026#34;longitude\u0026#34;: 8.940001, \u0026#34;generationtime_ms\u0026#34;: 0.10466575622558594, \u0026#34;utc_offset_seconds\u0026#34;: 3600, \u0026#34;timezone\u0026#34;: \u0026#34;Europe/Berlin\u0026#34;, \u0026#34;timezone_abbreviation\u0026#34;: \u0026#34;GMT+1\u0026#34;, \u0026#34;elevation\u0026#34;: 410.0, \u0026#34;current_units\u0026#34;: { \u0026#34;time\u0026#34;: \u0026#34;iso8601\u0026#34;, \u0026#34;interval\u0026#34;: \u0026#34;seconds\u0026#34;, \u0026#34;temperature_2m\u0026#34;: \u0026#34;°C\u0026#34;, \u0026#34;relative_humidity_2m\u0026#34;: \u0026#34;%\u0026#34;, \u0026#34;wind_speed_10m\u0026#34;: \u0026#34;km/h\u0026#34;, \u0026#34;weather_code\u0026#34;: \u0026#34;wmo code\u0026#34; }, \u0026#34;current\u0026#34;: { \u0026#34;time\u0026#34;: \u0026#34;2026-03-20T01:15\u0026#34;, \u0026#34;interval\u0026#34;: 900, \u0026#34;temperature_2m\u0026#34;: 5.3, \u0026#34;relative_humidity_2m\u0026#34;: 57, \u0026#34;wind_speed_10m\u0026#34;: 1.1, \u0026#34;weather_code\u0026#34;: 0 } } To extract a single field from the JSON response into a variable, here is the pattern using temperature as an example:\nTEMP=$(echo \u0026#34;$RESPONSE\u0026#34; | python3 -c \u0026#34;import sys,json; d=json.load(sys.stdin); print(d[\u0026#39;current\u0026#39;][\u0026#39;temperature_2m\u0026#39;])\u0026#34;) The JSON data from the bash variable $RESPONSE is passed to a Python process. Python reads the value of temperature_2m under the current node and prints it, so the bash variable TEMP gets a plain number it can work with.\nThe same pattern is used to retrieve humidity, wind speed, and the weather code. The weather code is then translated into a human-readable description.\nAfter that, the individual parts are assembled into a properly structured email and handed to msmtp, just as in the previous example.\nHere is the complete script:\n#!/bin/bash TO=\u0026#34;recipient@example.org\u0026#34; FROM=\u0026#34;sender@example.com\u0026#34; BOUNDARY_ALT=\u0026#34;==ALT_$(date +%s)==\u0026#34; # Adjust coordinates and location name LAT=\u0026#34;48.85\u0026#34; LON=\u0026#34;8.93\u0026#34; LOCATION=\u0026#34;Moensheim\u0026#34; TIMEZONE=\u0026#34;Europe%2FBerlin\u0026#34; # The subject is encoded per RFC 2047 when it contains non-ASCII characters # (e.g. umlauts in the location name). Without this encoding, those characters # would be corrupted in the mail client\u0026#39;s message list. encode_subject() { python3 -c \u0026#34; import sys subject = sys.argv[1] if all(ord(c) \u0026lt; 128 for c in subject): print(subject) else: encoded = subject.encode(\u0026#39;utf-8\u0026#39;) qp = \u0026#39;\u0026#39;.join( \u0026#39;_\u0026#39; if b == 32 else \u0026#39;={:02X}\u0026#39;.format(b) if b \u0026gt; 127 or chr(b) in \u0026#39;?=_\u0026#39; else chr(b) for b in encoded ) print(\u0026#39;=?utf-8?Q?\u0026#39; + qp + \u0026#39;?=\u0026#39;) \u0026#34; \u0026#34;$1\u0026#34; } SUBJECT=$(encode_subject \u0026#34;Weather $LOCATION $(date \u0026#39;+%m/%d/%Y\u0026#39;)\u0026#34;) # Fetch weather data from Open-Meteo (no API key required) API_URL=\u0026#34;https://api.open-meteo.com/v1/forecast\u0026#34; API_URL=\u0026#34;${API_URL}?latitude=${LAT}\u0026amp;longitude=${LON}\u0026#34; API_URL=\u0026#34;${API_URL}\u0026amp;current=temperature_2m,relative_humidity_2m,wind_speed_10m,weather_code\u0026#34; API_URL=\u0026#34;${API_URL}\u0026amp;wind_speed_unit=kmh\u0026amp;timezone=${TIMEZONE}\u0026#34; RESPONSE=$(curl -s \u0026#34;$API_URL\u0026#34;) if [ -z \u0026#34;$RESPONSE\u0026#34; ]; then echo \u0026#34;Error: No response from the API.\u0026#34; \u0026gt;\u0026amp;2 exit 1 fi # Extract values from JSON TEMP=$(echo \u0026#34;$RESPONSE\u0026#34; | python3 -c \u0026#34;import sys,json; d=json.load(sys.stdin); print(d[\u0026#39;current\u0026#39;][\u0026#39;temperature_2m\u0026#39;])\u0026#34;) HUMIDITY=$(echo \u0026#34;$RESPONSE\u0026#34; | python3 -c \u0026#34;import sys,json; d=json.load(sys.stdin); print(d[\u0026#39;current\u0026#39;][\u0026#39;relative_humidity_2m\u0026#39;])\u0026#34;) WIND=$(echo \u0026#34;$RESPONSE\u0026#34; | python3 -c \u0026#34;import sys,json; d=json.load(sys.stdin); print(d[\u0026#39;current\u0026#39;][\u0026#39;wind_speed_10m\u0026#39;])\u0026#34;) WMO=$(echo \u0026#34;$RESPONSE\u0026#34; | python3 -c \u0026#34;import sys,json; d=json.load(sys.stdin); print(d[\u0026#39;current\u0026#39;][\u0026#39;weather_code\u0026#39;])\u0026#34;) # Translate WMO weather code into readable text WEATHER=$(python3 -c \u0026#34; code = int(\u0026#39;$WMO\u0026#39;) codes = { 0: \u0026#39;Clear sky\u0026#39;, 1: \u0026#39;Mainly clear\u0026#39;, 2: \u0026#39;Partly cloudy\u0026#39;, 3: \u0026#39;Overcast\u0026#39;, 45: \u0026#39;Fog\u0026#39;, 48: \u0026#39;Rime fog\u0026#39;, 51: \u0026#39;Light drizzle\u0026#39;, 53: \u0026#39;Drizzle\u0026#39;, 55: \u0026#39;Heavy drizzle\u0026#39;, 61: \u0026#39;Light rain\u0026#39;, 63: \u0026#39;Rain\u0026#39;, 65: \u0026#39;Heavy rain\u0026#39;, 71: \u0026#39;Light snowfall\u0026#39;, 73: \u0026#39;Snowfall\u0026#39;, 75: \u0026#39;Heavy snowfall\u0026#39;, 80: \u0026#39;Light showers\u0026#39;, 81: \u0026#39;Showers\u0026#39;, 82: \u0026#39;Heavy showers\u0026#39;, 95: \u0026#39;Thunderstorm\u0026#39;, 96: \u0026#39;Thunderstorm with hail\u0026#39;, 99: \u0026#39;Thunderstorm with heavy hail\u0026#39;, } print(codes.get(code, \u0026#39;Unknown (Code: \u0026#39; + str(code) + \u0026#39;)\u0026#39;)) \u0026#34;) DATE=$(date \u0026#39;+%A, %B %d, %Y %H:%M\u0026#39;) # Plain text part PLAIN=\u0026#34;Weather Report: $LOCATION $DATE Conditions : $WEATHER Temperature : ${TEMP}°C Humidity : ${HUMIDITY}% Wind : ${WIND} km/h\u0026#34; # HTML part HTML=\u0026#34;\u0026lt;!DOCTYPE html\u0026gt; \u0026lt;html\u0026gt; \u0026lt;head\u0026gt;\u0026lt;meta charset=\\\u0026#34;utf-8\\\u0026#34;\u0026gt;\u0026lt;/head\u0026gt; \u0026lt;body style=\\\u0026#34;font-family: sans-serif; font-size: 14px; max-width: 500px;\\\u0026#34;\u0026gt; \u0026lt;h2\u0026gt;Weather Report: $LOCATION\u0026lt;/h2\u0026gt; \u0026lt;p style=\\\u0026#34;color: #666;\\\u0026#34;\u0026gt;$DATE\u0026lt;/p\u0026gt; \u0026lt;table style=\\\u0026#34;border-collapse: collapse; width: 100%;\\\u0026#34;\u0026gt; \u0026lt;tr style=\\\u0026#34;background: #f0f0f0;\\\u0026#34;\u0026gt; \u0026lt;td style=\\\u0026#34;padding: 8px; border: 1px solid #ccc;\\\u0026#34;\u0026gt;\u0026lt;strong\u0026gt;Conditions\u0026lt;/strong\u0026gt;\u0026lt;/td\u0026gt; \u0026lt;td style=\\\u0026#34;padding: 8px; border: 1px solid #ccc;\\\u0026#34;\u0026gt;$WEATHER\u0026lt;/td\u0026gt; \u0026lt;/tr\u0026gt; \u0026lt;tr\u0026gt; \u0026lt;td style=\\\u0026#34;padding: 8px; border: 1px solid #ccc;\\\u0026#34;\u0026gt;\u0026lt;strong\u0026gt;Temperature\u0026lt;/strong\u0026gt;\u0026lt;/td\u0026gt; \u0026lt;td style=\\\u0026#34;padding: 8px; border: 1px solid #ccc;\\\u0026#34;\u0026gt;${TEMP}°C\u0026lt;/td\u0026gt; \u0026lt;/tr\u0026gt; \u0026lt;tr style=\\\u0026#34;background: #f0f0f0;\\\u0026#34;\u0026gt; \u0026lt;td style=\\\u0026#34;padding: 8px; border: 1px solid #ccc;\\\u0026#34;\u0026gt;\u0026lt;strong\u0026gt;Humidity\u0026lt;/strong\u0026gt;\u0026lt;/td\u0026gt; \u0026lt;td style=\\\u0026#34;padding: 8px; border: 1px solid #ccc;\\\u0026#34;\u0026gt;${HUMIDITY}%\u0026lt;/td\u0026gt; \u0026lt;/tr\u0026gt; \u0026lt;tr\u0026gt; \u0026lt;td style=\\\u0026#34;padding: 8px; border: 1px solid #ccc;\\\u0026#34;\u0026gt;\u0026lt;strong\u0026gt;Wind\u0026lt;/strong\u0026gt;\u0026lt;/td\u0026gt; \u0026lt;td style=\\\u0026#34;padding: 8px; border: 1px solid #ccc;\\\u0026#34;\u0026gt;${WIND} km/h\u0026lt;/td\u0026gt; \u0026lt;/tr\u0026gt; \u0026lt;/table\u0026gt; \u0026lt;p style=\\\u0026#34;font-size: 11px; color: #999; margin-top: 16px;\\\u0026#34;\u0026gt; Weather data: \u0026lt;a href=\\\u0026#34;https://open-meteo.com\\\u0026#34;\u0026gt;Open-Meteo\u0026lt;/a\u0026gt; \u0026lt;/p\u0026gt; \u0026lt;/body\u0026gt; \u0026lt;/html\u0026gt;\u0026#34; # Assemble and send the email { printf \u0026#39;%s\\n\u0026#39; \\ \u0026#34;From: $FROM\u0026#34; \\ \u0026#34;To: $TO\u0026#34; \\ \u0026#34;Subject: $SUBJECT\u0026#34; \\ \u0026#34;Date: $(LC_ALL=C date -R)\u0026#34; \\ \u0026#34;MIME-Version: 1.0\u0026#34; \\ \u0026#34;Content-Type: multipart/alternative; boundary=\\\u0026#34;$BOUNDARY_ALT\\\u0026#34;\u0026#34; \\ \u0026#34;\u0026#34; # Plain text part printf \u0026#39;%s\\n\u0026#39; \\ \u0026#34;--$BOUNDARY_ALT\u0026#34; \\ \u0026#34;Content-Type: text/plain; charset=utf-8\u0026#34; \\ \u0026#34;Content-Transfer-Encoding: quoted-printable\u0026#34; \\ \u0026#34;\u0026#34; printf \u0026#39;%s\\n\u0026#39; \u0026#34;$PLAIN\u0026#34; | python3 -c \u0026#34; import sys, quopri sys.stdout.buffer.write(quopri.encodestring(sys.stdin.buffer.read())) \u0026#34; # HTML part printf \u0026#39;%s\\n\u0026#39; \\ \u0026#34;\u0026#34; \\ \u0026#34;--$BOUNDARY_ALT\u0026#34; \\ \u0026#34;Content-Type: text/html; charset=utf-8\u0026#34; \\ \u0026#34;Content-Transfer-Encoding: quoted-printable\u0026#34; \\ \u0026#34;\u0026#34; printf \u0026#39;%s\\n\u0026#39; \u0026#34;$HTML\u0026#34; | python3 -c \u0026#34; import sys, quopri sys.stdout.buffer.write(quopri.encodestring(sys.stdin.buffer.read())) \u0026#34; # Closing boundary printf \u0026#39;%s\\n\u0026#39; \\ \u0026#34;\u0026#34; \\ \u0026#34;--$BOUNDARY_ALT--\u0026#34; } | msmtp \u0026#34;$TO\u0026#34; Both examples demonstrate the core principle: an email is ultimately nothing but structured text that msmtp accepts and forwards. Once you understand that, you can not only replicate these scripts but also adapt them to your own needs. Open-Meteo alone offers a wide range of additional data: forecasts for the coming days, precipitation, UV index, or sunrise and sunset times can all be added with an extra parameter in the API call. The full documentation is available at open-meteo.com.\nScheduling with a Task Runner # Scripts like these are only really useful when they run automatically on a schedule. On Linux, cron has traditionally handled this. On macOS, Apple provides its own mechanism called launchd. In either case, the machine should of course be running 24/7 and connected to the internet.\nCron on Linux # Cron is a background service that executes tasks at defined times. Schedules are stored in what is called the crontab. Open the crontab for the current user with:\ncrontab -e This typically opens in nano. Each entry consists of five time fields followed by the command to run:\nMinute Hour Day Month Weekday Command An asterisk * in any field means \u0026ldquo;every possible value.\u0026rdquo; Two examples:\n# System report every morning at 7 AM 0 7 * * * /home/leif/scripts/system-report.sh # Weather report daily at 9 AM 0 9 * * * /home/leif/scripts/weather-report.sh A handy tool for building cron expressions is crontab.guru.\nOne important note: cron runs in a minimal environment without the usual shell variables. In particular, the PATH is heavily restricted, so commands like curl or python3 might not be found. The safest approach is to use absolute paths in your script. You can find the path of any command with which:\nwhich curl which python3 which msmtp Alternatively, set the PATH variable at the top of the script. Here is an example for macOS:\nexport PATH=\u0026#34;/usr/local/bin:/usr/bin:/bin:/opt/homebrew/bin:$PATH\u0026#34; launchd on macOS # On macOS, launchd is the system service that manages both background processes and scheduled tasks. Schedules are defined as XML files in the Property List format (.plist) and placed in a specific location so that launchd picks them up.\nOne important note before getting started: macOS protects certain folders like the Desktop, Documents, and Downloads from access by automated processes. Scripts that should be executed by launchd belong in an unprotected folder, for example ~/scripts/. You can create it if it does not already exist:\nmkdir ~/scripts For tasks belonging to the current user, the right place for plist files is ~/Library/LaunchAgents/. Create a new file there, for example com.ileif.weather-report.plist:\n\u0026lt;?xml version=\u0026#34;1.0\u0026#34; encoding=\u0026#34;UTF-8\u0026#34;?\u0026gt; \u0026lt;!DOCTYPE plist PUBLIC \u0026#34;-//Apple//DTD PLIST 1.0//EN\u0026#34; \u0026#34;http://www.apple.com/DTDs/PropertyList-1.0.dtd\u0026#34;\u0026gt; \u0026lt;plist version=\u0026#34;1.0\u0026#34;\u0026gt; \u0026lt;dict\u0026gt; \u0026lt;key\u0026gt;Label\u0026lt;/key\u0026gt; \u0026lt;string\u0026gt;com.ileif.weather-report\u0026lt;/string\u0026gt; \u0026lt;key\u0026gt;ProgramArguments\u0026lt;/key\u0026gt; \u0026lt;array\u0026gt; \u0026lt;string\u0026gt;/bin/bash\u0026lt;/string\u0026gt; \u0026lt;string\u0026gt;/Users/leif/scripts/weather-report.sh\u0026lt;/string\u0026gt; \u0026lt;/array\u0026gt; \u0026lt;key\u0026gt;StartCalendarInterval\u0026lt;/key\u0026gt; \u0026lt;dict\u0026gt; \u0026lt;key\u0026gt;Hour\u0026lt;/key\u0026gt; \u0026lt;integer\u0026gt;9\u0026lt;/integer\u0026gt; \u0026lt;key\u0026gt;Minute\u0026lt;/key\u0026gt; \u0026lt;integer\u0026gt;0\u0026lt;/integer\u0026gt; \u0026lt;/dict\u0026gt; \u0026lt;key\u0026gt;RunAtLoad\u0026lt;/key\u0026gt; \u0026lt;false/\u0026gt; \u0026lt;key\u0026gt;StandardErrorPath\u0026lt;/key\u0026gt; \u0026lt;string\u0026gt;/tmp/weather-report.err\u0026lt;/string\u0026gt; \u0026lt;/dict\u0026gt; \u0026lt;/plist\u0026gt; The Label entry is the unique name of the job and should match the filename. ProgramArguments specifies which script to run. StartCalendarInterval defines the schedule, here daily at 9:00 AM. StandardErrorPath redirects any error output to a file, which makes debugging easier.\nTo register the new file with launchd, load it once:\nlaunchctl load ~/Library/LaunchAgents/com.ileif.weather-report.plist From that point on, the script runs automatically at the specified time. To deactivate the job:\nlaunchctl unload ~/Library/LaunchAgents/com.ileif.weather-report.plist One nice behavior of launchd: missed schedules can be caught up on. If the Mac was off when a job was supposed to run, launchd executes it the next time the system starts, provided you set RunAtLoad to true. Cron, by contrast, silently skips any missed runs.\nWrapping Up # For sending email from the command line or from a script, msmtp is a lean and reliable tool that integrates with minimal configuration effort. Once you understand how an email is structured internally, sending from the command line is not all that complicated. The MIME structure, the character encoding, and the header format all follow clear rules, and the scripts shown here can serve as a starting point for your own ideas.\nThe examples in this article are intentionally straightforward. A system report, a weather brief, but the principle transfers to a lot of different use cases: monitoring alerts, daily summaries from your own data sources, or notifications from automation scripts. Once you get the scripts running, you will quickly find your own applications. Open-Meteo alone offers forecasts for the coming days, precipitation data, UV index, and much more, all with the same simple API call. The full documentation is at open-meteo.com.\n","date":"April 14, 2026","externalUrl":null,"permalink":"/2026/04/14/sending-emails-from-scripts-with-msmtp/","section":"Posts","summary":"Update (October 25, 2026) Thanks to a reader’s comment, I added a chapter on keeping the SMTP password out of the config file with passwordeval. It shows two ways, the macOS Keychain and pass with gpg on Linux, and explains when the simple plain text password is still the better choice.\n","title":"Sending Emails from Scripts with msmtp","type":"posts"},{"content":"","date":"May 25, 2025","externalUrl":null,"permalink":"/tag/actionsforobsidian/","section":"Tags","summary":"","title":"ActionsForObsidian","type":"tags"},{"content":"","date":"May 25, 2025","externalUrl":null,"permalink":"/tag/barcuts/","section":"Tags","summary":"","title":"BarCuts","type":"tags"},{"content":"","date":"May 25, 2025","externalUrl":null,"permalink":"/category/mac/","section":"Categories","summary":"","title":"Mac","type":"categories"},{"content":"Over the past few years, I have used various Read-It-Later apps to save links to websites or articles that interested me. Since such a collection should ideally be maintained and accessed from different devices, web services seemed like a good solution at first. Unfortunately, they have the disadvantage that they are often bought up at some point and then usually discontinued. This is what happened to me, for example, with Delicious (2019), Omnivore (2024) and currently with Pocket.\nSo I moved from these services to solutions I hosted myself, like Bookmarks for Nextcloud. For some time now, I have used an Apple Shortcut and Obsidian as an independent solution. In this blog, I already presented Three Styles to Save Bookmarks in Obsidian. Now, I use an updated version. This version is fully in line with the Obsidian philosophy. The bookmarks are now saved locally as simple Markdown files. This means that they remain completely in your own ownership, can be read and edited by other apps, and remain accessible even if Obsidian itself is no longer developed.\nWhat a Read-It-Later Solution Should Do # Traditionally, the requirements for a read-it-later app are:\neasy access in the web browser content organization visual orientation good readability synchronization across the devices used Because I use Apple Shortcuts, there are different ways to start the tool. I use the share sheet option on the iPhone and iPad, but this is too complicated to use on the Mac. That\u0026rsquo;s why I initially used the “Pin in Menu Bar” option, but I now use the Barcuts app from the indie developer Carlo Zottmann, which I have described here.\nI wanted to keep creating bookmarks simple. The URL is just processed and, as you can see in the two examples, stored either without or with a preview image:\nWhether a preview image is displayed depends on whether the shortcut finds one. This does not seem to be the case with my WordPress pages. Most of the time, however, an image like in the second example is displayed (@Carlo, I hope I was allowed to use the URL as an example).\nI organize the content when I read it later. I edit the collected bookmarks daily: articles are either processed directly, summarized in new or integrated into existing notes and deleted from the list. Sometimes I leave them in the bookmark for further processing, but add tags that help categorize them by topic, importance, or both, so I can easily find them using the search function.\nImplementation # My solution consists of 3 parts:\nAn Apple Shortcut that processes the web page and creates a Markdown Callout for the bookmark note. Carlo Zottmann\u0026rsquo;s app Actions for Obsidian, which writes the callout into the bookmark note. A CSS snippet in my Obsidian Vault that defines the design of the bookmark. The Shortcut # The shortcut performs the following steps:\nActivate the options “Receive What’s On Screen” and, if needed, “Pin to menu bar” in the shortcut details. Select only “URLs” and “Article” as input sources in the shortcut editor. I define also a message if the shortcut is not started in a browser. Save the currently active app in a variable, so the browser come back to the front at the end. Create the “Article object” with the data from the active website for later processing. Use an “if” statement to check if a “Main Image URL” is available: If yes, create the markdown for the bookmark callout including a preview image from the article data and store it in the variable Text. If not, create the markdown without a preview image. Insert the created callout in the variable Text into the bookmark note using the “Actions for Obsidian” action “Prepend Note” below the heading # Bookmarks. Adjust the Vault and path as needed. macOS only: Close the “Actions for Obsidian” app so it does not stay visible in the dock or app switcher (⌘ tab). This is not possible on iPadOS/iOS. Bring the browser back to the front. This is how it looks:\nThat’s it for the shortcut part. Before testing the shortcut, you should create your bookmark note with the headline # Bookmarks. When this is done, start your browser, visit a webpage, and run the shortcut. You can use any browser—at least Safari, Chrome (and Chrome-based), and Firefox should work.\nBecause there is no [!bookmark] callout by default, the bookmark is shown like this at first:\nTo customize the appearance, you need to define a CSS snippet.\nThe CSS snippet # I use a CSS snippet to define the appearance. If you are not familiar with this concept, here is a short introduction:\nObsidian allows you to customize the appearance either with themes, which change the whole interface, or with CSS snippets, which only change specific parts. CSS snippets must be stored in a special folder. You can find this folder via Settings → Appearance → CSS snippets by clicking the folder icon in the top right corner, which open this folder in the FInder.\nNow, use a text editor that saves plain text—such as Sublime, TextMate, VS Code, or in the terminal with nano, vim, or emacs—to create a CSS file. Name it, for example, bookmark.css, and add the following content. Save it in the folder you opened before.\n/* Callout for Bookmarks */ .callout[data-callout=\u0026#34;bookmark\u0026#34;] { --callout-color: white; --callout-icon: book-open-text; background: white !important; border: 1px solid black; border-right: 5px solid #6666 !important; border-bottom: 5px solid #6666 !important; border-radius: 12px; padding: 15px; } .callout[data-callout=\u0026#34;bookmark\u0026#34;] .callout-title { font-weight: bold; color: #005a9c; font-size: 1.3em; } .callout[data-callout=\u0026#34;bookmark\u0026#34;] .callout-title a { text-decoration: none !important; color: #005a9c; font-weight: bold; } .callout[data-callout=\u0026#34;bookmark\u0026#34;] .callout-title a:hover { text-decoration: none !important; color: #003366; } .callout[data-callout=\u0026#34;bookmark\u0026#34;] p { color: black !important; } .callout[data-callout=\u0026#34;bookmark\u0026#34;] img { max-width: 100%; height: auto; border-radius: 12px; margin-top: 10px; display: block; } After you put the CSS file in the correct folder, go back to the Obsidian settings, click the reload icon next to the folder icon, and activate the CSS snippet.\nThe bookmarks should The bookmarks should now look like the images above. look like the images shown above.\nA small but annoying issue occurs when the Obsidian Vault is saved in the iCloud: For reasons that are not entirely clear, the CSS files are not shown in the Finder, but they do appear in the Obsidian settings dialog. Apple has apparently decided that all files in hidden folders in the Finder will not be displayed if they are in iCloud. However, you can use the key combination ⌘-⇧-. to temporarily show these hidden files. Please note: This applies to all folders, and many of these hidden files and folders are important for macOS or for apps to work. You should not change or delete them.\nConclusion # I hope this short article has shown how you can create a replacement for Pocket and similar services with simple tools. This solution makes you independent of external providers and gives you more flexibility, because you can also process the files with other programs or scripts. I still think this is one of the great advantages of Obsidian’s openness.\n","date":"May 25, 2025","externalUrl":null,"permalink":"/2025/05/26/obsidian-as-an-independent-read-it-later-solution/","section":"Posts","summary":"Over the past few years, I have used various Read-It-Later apps to save links to websites or articles that interested me. Since such a collection should ideally be maintained and accessed from different devices, web services seemed like a good solution at first. Unfortunately, they have the disadvantage that they are often bought up at some point and then usually discontinued. This is what happened to me, for example, with Delicious (2019), Omnivore (2024) and currently with Pocket.\n","title":"Obsidian as an Independent Read-It-Later Solution","type":"posts"},{"content":"","date":"May 25, 2025","externalUrl":null,"permalink":"/tag/pocket/","section":"Tags","summary":"","title":"pocket","type":"tags"},{"content":"","date":"May 25, 2025","externalUrl":null,"permalink":"/tag/read-it-later/","section":"Tags","summary":"","title":"Read-It-Later","type":"tags"},{"content":"","date":"May 25, 2025","externalUrl":null,"permalink":"/category/uncategorized/","section":"Categories","summary":"","title":"Uncategorized","type":"categories"},{"content":"Safari can do it out of the box, but unfortunately Chrome and Firefox can’t: sharing websites via AirDrop. With a simple Apple shortcut, it will work from any browser, and with the BarCuts app, it’s even more comfortable. Here I’ll show you how it works.\nIt’s that simple # I’m always amazed at how easily small, annoying everyday problems can be solved with Apple Shortcuts. For a long time, it bothered me that I couldn’t just share a website via AirDrop when using the Chrome browser on my Mac. Today, I finally had the idea to check if there’s an “AirDrop” action in Shortcuts – and look at that: there is! The shortcut was put together in no time.\nThe screenshot above shows the shortcut. I set it up so that it appears in the menu bar and checks before sharing if the input is really a URL. That’s all!\nEven more convenient using the BarCuts App # It gets really practical when the shortcut only shows up if a browser is active that doesn’t support AirDrop by default (so all except Safari). You can do exactly that with the app “BarCuts,” which I introduced in my article BarCuts – Faster, context-based access to shortcuts in macOS.\nHere I tagged the shortcut with \u0026ldquo;BarCuts Tagger\u0026rdquo; so that it only shows up in the BarCuts menu when Chrome or Firefox are active.\nConclusion:\nIt\u0026rsquo;s often the little things that make everyday life on the Mac more pleasant. With Apple Shortcuts and BarCuts, you can add these comfort features without any programming knowledge – and that\u0026rsquo;s just fun!\n","date":"May 6, 2025","externalUrl":null,"permalink":"/2025/05/06/how-to-share-urls-from-chrome-firefox-via-airdrop/","section":"Posts","summary":"Safari can do it out of the box, but unfortunately Chrome and Firefox can’t: sharing websites via AirDrop. With a simple Apple shortcut, it will work from any browser, and with the BarCuts app, it’s even more comfortable. Here I’ll show you how it works.\n","title":"How to Share URLs from Chrome \u0026 Firefox via AirDrop","type":"posts"},{"content":"","date":"May 6, 2025","externalUrl":null,"permalink":"/tag/maos/","section":"Tags","summary":"","title":"maos","type":"tags"},{"content":"","date":"May 6, 2025","externalUrl":null,"permalink":"/tag/tippsamptricks/","section":"Tags","summary":"","title":"Tipps\u0026amp;Tricks","type":"tags"},{"content":"","date":"May 6, 2025","externalUrl":null,"permalink":"/category/tips-and-tricks/","section":"Categories","summary":"","title":"tips and tricks","type":"categories"},{"content":"Carlo Zottmann should already be familiar to the readers of this blog, since I’ve mentioned his apps—which expand the features of Apple Shortcuts—several times before. I use shortcuts created with Actions for Obsidian and Browser Actions every day, and I wouldn’t want to be without these little helpers anymore.\nHowever, one problem is becoming more and more obvious with the growing number of shortcuts, especially on macOS: Access on the Mac is not solved optimally. The share menu requires too many clicks, and pinning to the menu bar, which I prefer, is also not ideal. The number of possible entries is limited, there’s no way to organize them, and – even worse – all shortcuts are always shown, no matter if they make sense in the current work context or not.\nThese problems have apparently also caught Carlo’s attention. A few weeks ago, he announced a beta program for his new app, BarCuts. This time, the app’s main focus wasn’t on offering actions for automating browsers or Obsidian, but on solving the issues of quick and context-based access to shortcuts. No question, I joined the beta program right away. By now, the beta phase is over; version 2025.2.0 was just released. So, it’s about time to write a few lines about this helpful tool.\nNote: In BarCuts, Carlo uses the term Workflow instead of Apple Shortcuts. This actually fits better, because in the end, shortcuts are just automated workflows. Originally, the app that Apple bought in 2017 was also called “Workflow” – later it became the Shortcuts app. In the rest of this article, I will stick to Carlo’s term “Workflow.”\nInstallation # You can download BarCuts from the ActionsDotWork website and try it out for 14 days. This gives you enough time to check out all the features. Right now (May 2025), BarCuts is also available in the Carlos Store at an introductory price. Like I said before, I use Carlo’s other apps a lot and I can really recommend taking a closer look at them too—since you’re already here, it’s a great opportunity to check out what else he’s made.\nThe installation is easy: After downloading, just open the disk image, then copy the app into your Applications folder, start it from there, and adjust some security settings. BarCuts will guide you step by step through all the necessary settings. The security prompts are needed because BarCuts needs to access the shortcuts folder in the Library directory and needs permission to run shortcuts.\nThe app is a menubarapplication that runs in the background after you start it. There’s no classic application window. But the first time when you launch it, a dialog window opens with the following options:\nHowTo – Gives a short help on how to use BarCuts. License – Here you can buy and enter the license key. Settings – Shows the possible settings. About – Various links to more information, especially to the English documentation and the forum. Also, the BarCuts icon appears in the menu bar, which in the example image below is already filled with some workflows. As soon as the dialog window is closed, it can be opened again at any time directly from the menu.\nHow does BarCuts work? # The idea behind BarCuts is that every workflow you want to start from the BarCuts menu gets a “tag.” For this, BarCuts adds the BarCuts Tagger action to Apple’s Shortcuts app, which lets you add so to say metadata to the workflow. BarCuts then uses this metadata to put together the menu dynamically, also depending on which app is currently active.\nThe example shows a workflow I described in the article “First Steps with \u0026lsquo;Browser Actions\u0026rsquo;” Because of the added BarCuts Tagger action, this workflow only shows up in the menu when Safari is active:\nIn this example, I placed the action BarCuts Tagger at the beginning of the workflow. Theoretically, it could be placed anywhere. But I usually put it at the start, because otherwise the editor tries to automatically fill placeholders with values that you would have to change by hand later, which is a lot of work.\nThe \u0026ldquo;BarCuts Tagger\u0026rdquo; action offers the following options:\nAs shown in the example, the workflow is only displayed when Safari is active. Similar to above, but the workflow appears in a submenu called \u0026ldquo;Web.\u0026rdquo; The workflow is shown in every application – even in Finder. With this setting, the workflow is always displayed, but in the submenu \u0026ldquo;Tools.\u0026rdquo; It is possible to add several BarCuts Tagger actions to one workflow. This way, a workflow can be tagged for different browsers, for example. If you want several workflows to appear in one submenu, you just need to give the submenu the same name. It is also possible to show a workflow in a submenu only when a certain application is active, while other entries in the submenu are available in every application.\nThese settings offer many ways to customize things.\nThe example above shows a BarCuts menu that is divided into the following sections:\nWorkflows for the active application Workflows that are available in all applications A help text that can be hidden Functions to open the BarCuts dialog window and the settings Option to quit BarCuts The reason why the workflow “Have a finger in every pie” shows up in every part of the menu is because, for the example image, I gave it different display options.\nThe Settings Dialog # The settings dialog offers the following options:\nMenu bar hotkey # The first point should especially please fans of keyboard controls: Here you can define a keyboard shortcut to open the BarCuts menu. Just click in the field and press the key combination you want – now the menu will open anytime you press that combination. You can use the arrow keys to select a workflow and run it with the Enter key. A bit confusing: In my example above, I had to use the right arrow key to get to the submenu shown on the left. Whether this is a bug from Apple or in the application is unclear. But basically, it’s a very useful feature\nShow hints throughout the app # If this switch is turned off, help text, like the hint in the menu, will no longer be shown.\nShow app section in menu if it’s empty # If this switch had been turned off, the section for the application, will not been shown if there was no entry defined for the active application. The same goes for submenus: they are only shown if they actually have entries that are active in the current context. Otherwise, they are hidden.\nShow general section in menu if it’s empty # If this switch is turned off, the corresponding section will not be shown if there is no workflow tagged with “at all times”.\nStart BarCuts on login # If this switch is turned on, the application will start automatically every time the Mac restarts.\nBarCuts vs. Shortcut Menu # If you activate the option “Pin to menu bar” in the details of a workflow in the Shortcuts app, the Apple Shortcut Menu will appear next to the BarCuts menu. But with BarCuts, you don’t really need the Apple menu anymore. Unfortunately, you can’t just hide the Apple menu with the built-in tools. However, there are two ways to get rid of the Apple Shortcut Menu:\nEither you use a menu bar tool like “Ice” to hide the menu, or you remove the “Pin to menu bar” option from all workflows in the Apple Shortcuts app.\nAdvanced Features # Get Workflows Action # In the Shortcuts app, BarCuts offers not only the BarCuts Tagger action, but also the Get Workflows action. This action creates a list of\nall tagged workflows, the workflows that were tagged for the currently active app, as well as the workflows that are always shown. Right now, I find it useful to quickly list all tagged workflows at a glance. I’m curious to see what other possible uses for this action might come up – I don’t have a concrete idea yet, but that’s also because this feature was just newly implemented.\nCommand Line Command # At the moment, I find the newly added command line tool more exciting. With this tool, you can query the BarCuts to see which workflows are offered globally or for the currently active app. After running the command in the terminal, you get a result in JSON format. For better readability, the result was formatted with the tool jq:\n$ /Applications/BarCuts.app/Contents/MacOS/barcuts-cli | jq { \u0026#34;activeAppID\u0026#34;: \u0026#34;com.apple.terminal\u0026#34;, \u0026#34;activeAppName\u0026#34;: \u0026#34;Terminal\u0026#34;, \u0026#34;activeWorkflows\u0026#34;: [ { \u0026#34;fullTitle\u0026#34;: \u0026#34;Terminal Workflow\u0026#34;, \u0026#34;workflowID\u0026#34;: \u0026#34;80730E88-5611-4812-9039-9E00D9145E37\u0026#34; } ], \u0026#34;globalWorkflows\u0026#34;: [ { \u0026#34;fullTitle\u0026#34;: \u0026#34;Have a finger in every pie\u0026#34;, \u0026#34;workflowID\u0026#34;: \u0026#34;9DC37D14-D7B8-408D-95EB-DA15AD52C2D1\u0026#34; }, { \u0026#34;fullTitle\u0026#34;: \u0026#34;Resize and center active Window\u0026#34;, \u0026#34;workflowID\u0026#34;: \u0026#34;68F2216C-6336-4558-83A0-69E6A6B24FE3\u0026#34; }, { \u0026#34;fullTitle\u0026#34;: \u0026#34;Tools ≫ Have a finger in every pie\u0026#34;, \u0026#34;workflowID\u0026#34;: \u0026#34;9DC37D14-D7B8-408D-95EB-DA15AD52C2D1\u0026#34; } ] } Along with information about the active application – in this case, the Terminal – you’ll see a list of activeWorkflows (these are workflows tagged as relevant only for the Terminal application) and globalWorkflows. This CLI tool makes it possible to create shell or Python scripts that can access BarCuts metadata.\nCarlo also provides a solution for a practical use case: context-sensitive launching of tagged workflows using Alfred or Raycast. I installed the Alfred version and now I can easily call up context-specific and global workflows with Alfred just using the keyboard. After opening the Alfred input line, you use the command bc and select the option Show active Shortcut workflows to see the list of active workflows. For example, ⌘p bc ⏎ r ⏎ in the example below would directly trigger the workflow Resize and center active Window.\nThis way, you can use the advantages of the BarCuts menu without having to use a mouse or trackpad. I’m curious to see what other automation possibilities can be realized with it.\nURL Scheme (x-callback-url) # As a third option for consume the metadata from BarCuts, there is the possibility to use the x-callback-url mechanism. Since I have hardly used x-callback-URLs so far, I recommend the detailed chapter in the official documentation:\nBarCuts › URL Scheme (x-callback-url) — ActionsDotWork. Docs.\nConclusion # BarCuts removes key limitations of Apple’s Shortcuts menu – the limited number of displayed workflows, the lack of context sensitivity, and the restricted options for menu structure. By adding metadata, BarCuts offers a powerful alternative to the native Apple menu. With the command line tool and support for x-callback-URLs, you can also integrate and use workflows in other tools. The integration with Alfred and Raycast is a first, very promising example.\nSo I can only give a clear recommendation here: If you work with workflows on macOS, BarCuts is really a must-have.\n","date":"May 5, 2025","externalUrl":null,"permalink":"/2025/05/05/barcuts-faster-context-based-access-to-shortcuts-in-macos/","section":"Posts","summary":"Carlo Zottmann should already be familiar to the readers of this blog, since I’ve mentioned his apps—which expand the features of Apple Shortcuts—several times before. I use shortcuts created with Actions for Obsidian and Browser Actions every day, and I wouldn’t want to be without these little helpers anymore.\n","title":"BarCuts – Faster, Context-Based Access to Shortcuts in macOS","type":"posts"},{"content":"","date":"January 28, 2025","externalUrl":null,"permalink":"/tag/codingtips/","section":"Tags","summary":"","title":"CodingTips","type":"tags"},{"content":"","date":"January 28, 2025","externalUrl":null,"permalink":"/tag/unicode/","section":"Tags","summary":"","title":"UniCode","type":"tags"},{"content":" Introduction # I’m currently in the middle of a “spring-cleaning” phase for my Obsidian vault. That’s why I decided to create a small Python library with functions for analyzing and managing my notes. As part of this project, I wrote a script to help me find specific notes in the vault based on tags, content, titles, and properties. The script worked well: it found the notes and generated wiki-links to them in a new note save in my Obsidian Vault.\nBut then I noticed something strange. When I clicked on some of the links, Obsidian created a new note instead of opening the existing one. This unexpected behavior caught me off guard. After investigating, I realized the issue was related to diacritical letters in the filenames. But why was this happening?\nWhy ‘Für_Elise.md’ and ‘Für_Elise.md’ Aren’t Always the Same # Modern operating systems like macOS, Windows, and Linux allow the use of diacritical letters in filenames without any issues. Naturally, I assumed that a filename like “Für_Elise.md” would be treated the same everywhere. But that’s not the case.\nThe problem lies in something called Unicode Normalization, which goes beyond the UTF-8 encoding of letters. While Windows and Linux use Normalization Form C (NFC), macOS uses Normalization Form D (NFD). But what’s the difference?\nIn NFD, the “D” stands for “decomposed.” This means characters are stored as a base character combined with a diacritical mark. For example, “ü” becomes “u” plus a combining diaeresis, the two dot above the “u”. In contrast, NFC (used by Windows and Linux) stores characters as a single, precomposed entity.\nWhen I asked ChatGPT how to determine the normalization of a filename, it suggested the following command:\n\u0026gt; $ echo -n \u0026#34;Für_Elise.md\u0026#34; | cat -p -A Fu\\u{308}r_Elise.md However, this only works if I copy the filename from Finder and paste it into the terminal. If I type the filename manually or use the tab-key for path autocompletion, I get this different result:\n\u0026gt; $ echo -n Für_Elise.md | cat -p -A F\\u{fc}r_Elise.md This difference reflects the two normalization forms in action. The first example Fu\\u{308}r_Elise.md is in Normalization Form D (NFD), where characters are stored as a base character plus a combining diacritical mark. The second example F\\u{fc}r_Elise.md is in Normalization Form C (NFC), where characters are stored as a single precomposed entity.\nNFC is the normalization form used by Windows, Linux, and even macOS in certain contexts, such as the terminal when using e.g. zsh as I do. On the other hand, NFD is the default for macOS at the file system level.\nThis discrepancy explains now the odd behavior of my script. The script finds the file Fu\\u{308}r_Elise.mdand builds the wiki link using the same NFD normalization. However, Obsidian cannot resolve this link. Even though both the link and the file are NFD normalized, Obsidian seems somehow to internally work with NFC file names. As a result, it fails to find the file and creates a new one, which is then stored in NFC normalization even on the macOS file system.\nWhy I have this “Normalization Chaos” on my Computer # I think there is a mixture of reasons.\n1. Obsidian # As I already mentioned above, qObsidian cannot resolve wiki-links that are both stored in NFD normalization in the note and refer to files stored in NFD normalization on macOS. Instead of finding the file, Obsidian creates a new one.\nFor example:\nA link like Fu\\u{308}r_Elise (NFD) in a note will fail to resolve to a file named Fu\\u{308}r_Elise.md (also NFD) on macOS. However, a link like F\\u{fc}r_Elise.md (NFC) will correctly resolve to the NFD-normalized file Fu\\u{308}r_Elise.md. This suggests that Obsidian internally defaults to working with NFC-normalized names, even when the macOS file system stores filenames in NFD. The inconsistency causes issues with diacritical letters in filenames. I will definitely post a bug report about this. ;-)\n2. macOS # I’m still not sure why UTF-8 has two different (or more?) normalization forms, and why Apple chose to use NFD, while “the others” (Windows and Linux) use NFC.\nThat being said, the situation becomes even more complicated in the macOS file system. Files could be stored in NFD and NFC normalization. For example, a file created using the touch command in the terminal will be NFC normalized. Here’s what happens, but keep in mind you have to use a copy of the filename from the Finder in the echoline.\n\u0026gt; $ touch Für_Elise_touch \u0026gt; $ echo -n Für_Elise_touch | cat -p -A F\\u{fc}r_Elise_touch This happens because the terminal app and shell (e.g., zsh) always use NFC normalization when typing, also on a Mac.\nAs we’ve already seen, Obsidian also creates files with NFC-normalized filenames. However, other applications, such as Sublime Text, TextEdit, or Word, save files with NFD-normalized filenames—all of them using the standard “Save File” dialog box.\nI created some test files, and for the first time, I noticed how filenames with diacritical letters appear when listed in the terminal (e.g., New_Note, created by Obsidian). I had never consciously noticed these visual differences until I started investigating the “normalization problem\nOne of my Test-Scripts # During my journey through this problem space, I used various scripts and terminal commands to understand what was happening. Some of these I found on the internet, while others were generated by ChatGPT. One script, in particular, I’d like to introduce now as a small add-on.\nUsing the CLI commands mentioned earlier was always a bit tricky because the strings had to be copied to the right place for testing. To simplify this, I asked ChatGPT to create a script that analyzes the Unicode details of a given input. The input can be a text string, a directory of files, a single file, or the content of a file.\nBelow is the result of this script analyzing three key elements:\nThe wiki-link created by my search script in the result note. Line 3: - [[Für_Elise]] \u0026#39;-\u0026#39; -\u0026gt; HYPHEN-MINUS \u0026#39; \u0026#39; -\u0026gt; SPACE \u0026#39;[\u0026#39; -\u0026gt; LEFT SQUARE BRACKET \u0026#39;[\u0026#39; -\u0026gt; LEFT SQUARE BRACKET \u0026#39;F\u0026#39; -\u0026gt; LATIN CAPITAL LETTER F \u0026#39;u\u0026#39; -\u0026gt; LATIN SMALL LETTER U \u0026#39;̈\u0026#39; -\u0026gt; COMBINING DIAERESIS \u0026#39;r\u0026#39; -\u0026gt; LATIN SMALL LETTER R \u0026#39;_\u0026#39; -\u0026gt; LOW LINE \u0026#39;E\u0026#39; -\u0026gt; LATIN CAPITAL LETTER E \u0026#39;l\u0026#39; -\u0026gt; LATIN SMALL LETTER L \u0026#39;i\u0026#39; -\u0026gt; LATIN SMALL LETTER I \u0026#39;s\u0026#39; -\u0026gt; LATIN SMALL LETTER S \u0026#39;e\u0026#39; -\u0026gt; LATIN SMALL LETTER E \u0026#39;]\u0026#39; -\u0026gt; RIGHT SQUARE BRACKET \u0026#39;]\u0026#39; -\u0026gt; RIGHT SQUARE BRACKET The filename of the original NFD normalized file name Filename: Für_Elise.md (file name) \u0026#39;F\u0026#39; -\u0026gt; LATIN CAPITAL LETTER F \u0026#39;u\u0026#39; -\u0026gt; LATIN SMALL LETTER U \u0026#39;̈\u0026#39; -\u0026gt; COMBINING DIAERESIS \u0026#39;r\u0026#39; -\u0026gt; LATIN SMALL LETTER R \u0026#39;_\u0026#39; -\u0026gt; LOW LINE \u0026#39;E\u0026#39; -\u0026gt; LATIN CAPITAL LETTER E \u0026#39;l\u0026#39; -\u0026gt; LATIN SMALL LETTER L \u0026#39;i\u0026#39; -\u0026gt; LATIN SMALL LETTER I \u0026#39;s\u0026#39; -\u0026gt; LATIN SMALL LETTER S \u0026#39;e\u0026#39; -\u0026gt; LATIN SMALL LETTER E \u0026#39;.\u0026#39; -\u0026gt; FULL STOP \u0026#39;m\u0026#39; -\u0026gt; LATIN SMALL LETTER M \u0026#39;d\u0026#39; -\u0026gt; LATIN SMALL LETTER D The newly created NFC file name generated when clicking the wiki-link. Filename: Für_Elise.md \u0026#39;F\u0026#39; -\u0026gt; LATIN CAPITAL LETTER F \u0026#39;ü\u0026#39; -\u0026gt; LATIN SMALL LETTER U WITH DIAERESIS \u0026#39;r\u0026#39; -\u0026gt; LATIN SMALL LETTER R \u0026#39;_\u0026#39; -\u0026gt; LOW LINE \u0026#39;E\u0026#39; -\u0026gt; LATIN CAPITAL LETTER E \u0026#39;l\u0026#39; -\u0026gt; LATIN SMALL LETTER L \u0026#39;i\u0026#39; -\u0026gt; LATIN SMALL LETTER I \u0026#39;s\u0026#39; -\u0026gt; LATIN SMALL LETTER S \u0026#39;e\u0026#39; -\u0026gt; LATIN SMALL LETTER E \u0026#39;.\u0026#39; -\u0026gt; FULL STOP \u0026#39;m\u0026#39; -\u0026gt; LATIN SMALL LETTER M \u0026#39;d\u0026#39; -\u0026gt; LATIN SMALL LETTER D And here is the script:\n#!/usr/bin/python3 import unicodedata import os import argparse def analyze_text(text): \u0026#34;\u0026#34;\u0026#34; Analyze the Unicode details of each character in the text. Args: text (str): The input text to analyze. \u0026#34;\u0026#34;\u0026#34; for char in text: try: unicode_name = unicodedata.name(char) except ValueError: unicode_name = \u0026#34;UNKNOWN CHARACTER\u0026#34; print(f\u0026#34; \u0026#39;{char}\u0026#39; -\u0026gt; {unicode_name}\u0026#34;) def analyze_filenames(input_path): \u0026#34;\u0026#34;\u0026#34; Analyze filenames for a given path. If the path is a file, analyze its filename. If it is a directory, analyze all filenames in the directory. Args: input_path (str): Path to the file or directory. \u0026#34;\u0026#34;\u0026#34; if os.path.isfile(input_path): filename = os.path.basename(input_path) print(f\u0026#34;Analyzing filename: {filename}\u0026#34;) print(\u0026#34;-\u0026#34; * 50) analyze_text(filename) print(\u0026#34;-\u0026#34; * 50) elif os.path.isdir(input_path): print(f\u0026#34;Analyzing filenames in directory: {input_path}\u0026#34;) print(\u0026#34;-\u0026#34; * 50) for root, _, files in os.walk(input_path): for file in files: print(f\u0026#34;Filename: {file}\u0026#34;) analyze_text(file) print(\u0026#34;-\u0026#34; * 50) else: print(f\u0026#34;Error: {input_path} is neither a valid file nor a directory.\u0026#34;) def check_unicode_details(text): \u0026#34;\u0026#34;\u0026#34; Check and display the Unicode names for each character in the given text. Args: text (str): The input text to analyze. \u0026#34;\u0026#34;\u0026#34; print(\u0026#34;Unicode Analysis:\u0026#34;) print(\u0026#34;-\u0026#34; * 50) lines = text.splitlines() for line_no, line in enumerate(lines, start=1): print(f\u0026#34;Line {line_no}: {line}\u0026#34;) analyze_text(line) print(\u0026#34;-\u0026#34; * 50) def main(): parser = argparse.ArgumentParser( description=\u0026#34;Analyze Unicode details of text, file content, or filenames.\u0026#34;, epilog=\u0026#34;Examples:\\n\u0026#34; \u0026#34; python check_unicode.py \\\u0026#34;Hello, world!\\\u0026#34;\\n\u0026#34; \u0026#34; python check_unicode.py /path/to/file.txt\\n\u0026#34; \u0026#34; python check_unicode.py /path/to/directory -n\u0026#34;, formatter_class=argparse.RawTextHelpFormatter ) parser.add_argument(\u0026#34;input\u0026#34;, help=\u0026#34;Text, file path, or directory path\u0026#34;) parser.add_argument(\u0026#34;-n\u0026#34;, \u0026#34;--name-only\u0026#34;, action=\u0026#34;store_true\u0026#34;, help=\u0026#34;Analyze filenames. If input is a directory, scan all filenames; \u0026#34; \u0026#34;if input is a file, analyze the file\u0026#39;s name.\u0026#34;) args = parser.parse_args() if args.name_only: analyze_filenames(args.input) else: if os.path.isdir(args.input): print(f\u0026#34;Error: {args.input} is a directory. Use the -n option to analyze filenames.\u0026#34;) return try: # Check if the input is a file with open(args.input, \u0026#39;r\u0026#39;, encoding=\u0026#39;utf-8\u0026#39;) as file: text = file.read() print(f\u0026#34;Analyzing text from file: {args.input}\u0026#34;) except FileNotFoundError: # Treat input as a direct text argument text = args.input print(\u0026#34;Analyzing provided text input:\u0026#34;) except UnicodeDecodeError: print(\u0026#34;Error: The file cannot be decoded using UTF-8. Please check the file encoding.\u0026#34;) return check_unicode_details(text) if __name__ == \u0026#34;__main__\u0026#34;: main() How it works:\nOpen your favorite text editor. Paste the content of the code block into the editor. Don’t forget to copy the shebang line at the top. This line should point to your Python 3 installation. You can verify the correct path using the command: which python3. Save the file as check_unicode. Make the script executable by running: chmod +x check_unicode Run the script directly with ./check_unicode, or move it to a folder included in your PATH environment variable (e.g., ~/Applications). Once it’s in your PATH, you can simply execute the script by typing check_unicode in the terminal. ChatGPT also created a helpful man page for this script, making it even easier to use.\nCHECK_UNICODE(1) User Commands CHECK_UNICODE(1) NAME check_unicode - Analyze Unicode details of text, file content, or filenames in a directory or file. SYNOPSIS check_unicode [OPTIONS] INPUT DESCRIPTION The check_unicode utility provides a detailed breakdown of Unicode characters in a given text, file content, or filenames within a directory or a single file. It is useful for inspecting and debugging Unicode encoding issues and identifying special characters. The utility can operate in two modes: 1. Analyze the characters in text or file content (default). 2. Analyze filenames in a directory or a single file (with the -n option). OPTIONS -n, --name-only Analyze filenames. If INPUT is: - A directory: Scans and analyzes all filenames in the directory. - A file: Analyzes the filename of the specified file. -h, --help Display a help message and exit. ARGUMENTS INPUT The text, file path, or directory path to analyze. USAGE Analyze a simple text string: check_unicode \u0026#34;Hello, Ünicode!\u0026#34; Analyze the content of a file: check_unicode /path/to/file.txt Analyze the filename of a single file: check_unicode /path/to/file.txt -n Analyze all filenames in a directory: check_unicode /path/to/directory -n Display help information: check_unicode --help ERRORS If INPUT is a directory but the -n option is not specified: Error: /path/to/directory is a directory. Use the -n option to analyze filenames. If INPUT is invalid: Error: INPUT is neither a valid file nor a directory. If a file cannot be decoded as UTF-8: Error: The file cannot be decoded using UTF-8. Please check the file encoding. EXIT STATUS The check_unicode utility exits with the following codes: 0 Successful execution. 1 Invalid input or runtime error (e.g., file not found, invalid directory). EXAMPLES Analyze the characters in a string: check_unicode \u0026#34;Hello, world!\u0026#34; Analyze the content of a UTF-8 text file: check_unicode /Users/name/Documents/example.txt Analyze the filename of a single file: check_unicode /Users/name/Documents/example.txt -n Analyze filenames in a directory: check_unicode /Users/name/folder -n Conclusion # It took my some time to understand the real problem because there are so much level involved. So I hope I brought some light into the question of UTF Normalization. Also I think i only scratches the surface of the UTF-Hell ;-)\nI now have to add into my search script something like this:\n# Normalize the string to NFC (precomposed form) nfc_normalized_string = unicodedata.normalize(\u0026#34;NFC\u0026#34;, nfd_string) # Format the string as a wiki-link wiki_link = f\u0026#34;[[{nfc_normalized_string}]]\u0026#34; And then my script will also work “Für_Elise” regardless how she is normalized ;-)\nSo if there are any additions, corrections or other feedback feel free to use the comment box below. If you comment via the Ferdiverse, I still not 100 sure if my answers in this blog will reach you, so just check this page again.\n","date":"January 28, 2025","externalUrl":null,"permalink":"/2025/01/28/when-fur_elise-md-isnt-the-same-as-fur_elise-md/","section":"Posts","summary":"Introduction # I’m currently in the middle of a “spring-cleaning” phase for my Obsidian vault. That’s why I decided to create a small Python library with functions for analyzing and managing my notes. As part of this project, I wrote a script to help me find specific notes in the vault based on tags, content, titles, and properties. The script worked well: it found the notes and generated wiki-links to them in a new note save in my Obsidian Vault.\n","title":"When ‘Für_Elise.md’ Isn’t the Same as ‘Für_Elise.md’","type":"posts"},{"content":"","date":"November 23, 2024","externalUrl":null,"permalink":"/tag/mail/","section":"Tags","summary":"","title":"Mail","type":"tags"},{"content":"","date":"November 23, 2024","externalUrl":null,"permalink":"/tag/markdown/","section":"Tags","summary":"","title":"Markdown","type":"tags"},{"content":"Lou Plummer published a useful workflow to send emails to Obsidian using IFTTT, Dropbox, and Hazel. I liked the idea of capturing and sending information to an Obsidian Vault via email. Since I use Obsidian on all my devices, there are situations where an email would be more efficient for capturing information and storing it in Obsidian. I have had a special email account for these kinds of things for years, but the emails end up in an inbox and not in Obsidian. Additionally, solving this problem presents an enjoyable challenge.\nHere are my requirements:\nRuns locally on my main computer—in my case, my MacBook Works with a dedicated email account Accesses emails via IMAP Downloads all unread emails and converts them into Markdown files Saves these files directly into the Obsidian Vault Because I’m not yet an expert in Python programming, I asked my Obsidian Co-Pilot using OpenAI GPT-4o for help. After three iterations, I have a version that works very well. In this post, I want to present this solution, although I know it is only a quick and dirty first attempt. I will continue to refine it and make it more sophisticated.\nInitial Prototype Implementation # As I mentioned earlier, I use a special email account solely for this purpose, which serves as a basic security feature. I only use this account to send emails to myself, so I haven\u0026rsquo;t received any spam on it for years. However, any account that uses IMAP can be used.\nWhenever I don\u0026rsquo;t explicitly request a specific language, OpenAI typically provides a Python-based solution. Let\u0026rsquo;s go through the steps:\nPreparing the Environment\nThe first step is to create a project folder and navigate into it:\nmkdir /Users/leif/Documents/Projects/mail2obsidian cd /Users/leif/Documents/Projects/mail2obsidian Next, create and activate a virtual Python environment inside your project folder. This ensures that all the necessary libraries are local to this project, and all paths are handled within this environment. This way, your standard Python installation remains unchanged.\npython3 -m venv env source env/bin/activate After activating the environment, your shell prompt will change to something like this:\n(env) \u0026gt; $ You\u0026rsquo;ll need a few packages to run the script:\npip install imapclient markdownify pyyaml imapclient is a library that enables the script to interact with email servers. It\u0026rsquo;s used to fetch all unread emails from your mail server via IMAP. markdownify is a library that converts HTML content into Markdown format. It\u0026rsquo;s used to convert HTML emails into Markdown, though it\u0026rsquo;s not perfect. pyYAML is a library for parsing and writing YAML. In this case, it allows you to keep all configuration parameters outside the code in a YAML file. This library can read and understand YAML. Configuration # Next, we will create the configuration file config.yml. You can use any text editor; I typically use the CLI editor nano. Enter your data and path as follows:\nemail: server: \u0026#34;imap.example.com\u0026#34; user: \u0026#34;your-email@example.com\u0026#34; password: \u0026#34;your-password\u0026#34; output: path: \u0026#34;/Users/leif/Documents/ObsidianVault/98 emails\u0026#34; Make sure to replace the placeholders with your actual email server details and the desired output path.\nThe Main Code # Finally, create a new file and copy-paste the following Python script. I named mine mail2obsidian.py:\nimport imapclient import email from email.header import decode_header import os from markdownify import markdownify as md import yaml # Load configuration from YAML file with open(\u0026#39;config.yaml\u0026#39;, \u0026#39;r\u0026#39;) as file: config = yaml.safe_load(file) EMAIL = config[\u0026#39;email\u0026#39;][\u0026#39;user\u0026#39;] PASSWORD = config[\u0026#39;email\u0026#39;][\u0026#39;password\u0026#39;] IMAP_SERVER = config[\u0026#39;email\u0026#39;][\u0026#39;server\u0026#39;] OUTPUT_PATH = config[\u0026#39;output\u0026#39;][\u0026#39;path\u0026#39;] # Ensure the output directory exists os.makedirs(OUTPUT_PATH, exist_ok=True) # Connect to the server with imapclient.IMAPClient(IMAP_SERVER) as server: server.login(EMAIL, PASSWORD) server.select_folder(\u0026#39;INBOX\u0026#39;) # Search for all unread emails messages = server.search([\u0026#39;UNSEEN\u0026#39;]) for uid, message_data in server.fetch(messages, \u0026#39;RFC822\u0026#39;).items(): email_message = email.message_from_bytes(message_data[b\u0026#39;RFC822\u0026#39;]) # Decode email subject subject, encoding = decode_header(email_message[\u0026#39;Subject\u0026#39;])[0] if isinstance(subject, bytes): subject = subject.decode(encoding if encoding else \u0026#39;utf-8\u0026#39;) # Create a safe filename filename = f\u0026#34;{subject}.md\u0026#34;.replace(\u0026#39;/\u0026#39;, \u0026#39;_\u0026#39;).replace(\u0026#39;\\\\\u0026#39;, \u0026#39;_\u0026#39;) # Initialize email content email_content = f\u0026#34;# {subject}\\n\\n\u0026#34; # Extract email body for part in email_message.walk(): if part.get_content_type() == \u0026#34;text/plain\u0026#34; or part.get_content_type() == \u0026#34;text/html\u0026#34;: charset = part.get_content_charset() or \u0026#39;utf-8\u0026#39; payload = part.get_payload(decode=True) if payload: body = payload.decode(charset, errors=\u0026#39;replace\u0026#39;) if part.get_content_type() == \u0026#34;text/html\u0026#34;: body = md(body) email_content += body # Save the email content to a Markdown file file_path = os.path.join(OUTPUT_PATH, filename) with open(file_path, \u0026#39;w\u0026#39;, encoding=\u0026#39;utf-8\u0026#39;) as f: f.write(email_content) # Mark the email as read server.add_flags(uid, \u0026#39;\\\\Seen\u0026#39;) print(\u0026#34;Unread emails have been converted to Markdown files.\u0026#34;) Here\u0026rsquo;s a brief explanation of what each part of the code does:\nImports: imapclient: A library for interacting with email servers using the IMAP protocol. email: A module for handling email messages. decode_header: A function to decode email headers. os: A module for interacting with the operating system, used here to handle file paths. markdownify: A library to convert HTML content to Markdown. yaml: A library to parse YAML configuration files. Configuration Loading: The script reads a configuration file named config.yaml to get the email credentials (EMAIL, PASSWORD), the IMAP server address (IMAP_SERVER), and the output directory path (OUTPUT_PATH). Ensure Output Directory Exists: os.makedirs(OUTPUT_PATH, exist_ok=True): Ensures that the directory where the Markdown files will be saved exists. If it doesn\u0026rsquo;t exist, it will be created. Connect to the Email Server: The script uses IMAPClient to connect to the specified IMAP server and logs in using the provided credentials. It selects the \u0026lsquo;INBOX\u0026rsquo; folder to search for emails. Search and Fetch Unread Emails: server.search(['UNSEEN']): Searches for all unread emails in the inbox. server.fetch(messages, 'RFC822'): Fetches the full email data for each unread email. Process Each Email: For each email, it decodes the subject line using decode_header. It creates a safe filename by replacing any slashes in the subject with underscores. Initializes a Markdown string with the email subject as a header. Extract Email Body: The script iterates over each part of the email to find text or HTML content. It decodes the content using the appropriate charset. If the content is HTML, it converts it to Markdown using markdownify. The content is appended to the Markdown string. Save Email as Markdown File: The email content is saved to a file in the specified output directory with a .md extension. Mark Email as Read: server.add_flags(uid, '\\\\Seen'): Marks the email as read on the server. Completion Message: Prints a message indicating that the unread emails have been converted to Markdown files. If you configure everything correctly and have a few unread emails in your inbox, you can run this script (while still in the active Python environment) with:\n(env) \u0026gt; $ python mail2obsidian.py If everything runs smoothly, you\u0026rsquo;ll see a success message in the terminal, and all unread emails will be saved inside your Obsidian vault at the defined location. Otherwise, you might encounter some runtime errors.\nUnread emails have been converted to Markdown files. Outlook # This proposed solution is far from complete. Although my account isn\u0026rsquo;t receiving spam yet, it might be wise to ensure that not every email is automatically processed. For instance, requiring a specific string in the subject line could be a useful filter. Only emails containing this string would be downloaded.\nThis string could also indicate where to save the emails or serve as a tag. Different codes could direct the email to different folders or represent different tags.\nIt might also be beneficial to add frontmatter for the sender\u0026rsquo;s email address or other email properties before saving the file in the vault. In my vault, every note includes a footer area, so this could be added as well.\nCurrently, only plain text and HTML are being downloaded. This is relatively safe, as it reduces the risk of executable code being loaded. However, I welcome feedback on how secure this approach is.\nI believe the conversion of HTML emails could be improved, so there\u0026rsquo;s still a need to explore this further.\nMy plan is to compile the script once it\u0026rsquo;s finished and then run it every 30 minutes using a scheduler like launchd. For this, all outputs need to be redirected to a log, and error handling should be examined more closely.\nSome people have asked for an Obsidian plugin to handle this, but I\u0026rsquo;m not sure a plugin is always necessary. The great thing about Obsidian is that all notes are Markdown files, which can also be created with scripts or applications like this one. Not everything needs to be a plugin, which could potentially slow down Obsidian. Scripts like these only consume resources when they are running. I can use standard schedulers like launchd or cron to run the script periodically. It fetches emails even when Obsidian is not running, making it a perfect way to use scripts outside of Obsidian to create workflows for Obsidian.\nI hope this inspires you to come up with your own ideas. It would be great if you could share them here in the comments or leave a link.\n","date":"November 23, 2024","externalUrl":null,"permalink":"/2024/11/23/quick-and-dirty-prototyp-receive-mail-for-obsidian/","section":"Posts","summary":"Lou Plummer published a useful workflow to send emails to Obsidian using IFTTT, Dropbox, and Hazel. I liked the idea of capturing and sending information to an Obsidian Vault via email. Since I use Obsidian on all my devices, there are situations where an email would be more efficient for capturing information and storing it in Obsidian. I have had a special email account for these kinds of things for years, but the emails end up in an inbox and not in Obsidian. Additionally, solving this problem presents an enjoyable challenge.\n","title":"Quick and Dirty Prototyp- Receive Mail for Obsidian","type":"posts"},{"content":"","date":"November 7, 2024","externalUrl":null,"permalink":"/tag/browseractions/","section":"Tags","summary":"","title":"BrowserActions","type":"tags"},{"content":"In my article First Steps with \u0026ldquo;Browser Actions\u0026rdquo;, I presented examples of how to use Carlo Zottmann’s new app Browser Actions. One example was a shortcut to capture a selection in a browser window and display it in Obsidian as a quote callout.\nIn my next article Form Base Entry for Obsidian, I discuss how to use an HTML page with a form to capture data for an Obsidian note. This article serves as a concept car to illustrate the idea of combining Apple Shortcuts, HTML form-based data input, and Obsidian in a workflow.\nI often use the shortcut to capture selections from webpages. What I always missed is the ability to add tags and my own notes. In this article, I combine the two shortcuts and present a useful solution to capture selections while also adding my own notes and tags.\nThe flow # With a selection in a browser window, the shortcut must be executed. Since the shortcut is called without any parameters, the “No” path of the conditional statement will be executed.\nAn action from the Browser Action app then captures all relevant attributes of the active browser window. However, in our context, we are only interested in the following:\nThe pageURL The pageTitle The active selection (formatted as Markdown) Now, the shortcut uses another action to open a predefined HTML form in a new tab. This form includes fields for the pageURL, pageTitle, and a field for the captured selection in Markdown.\nWhen this page is active, the attributes will be inserted into the corresponding fields by another action from the Browser Action app.\nNow the user can:\nPreview the selection Review the other data Add an extra note and some tags After clicking the submit button, the snippet will be built, and with help of “Actions for Obsidian,” the snippet will be added to the special page in Obsidian.\nThe HTML-Form # Let’s start with the html form page. On top there is a field, that shows the markdown of the selection as preview.\nBelow this there is two groups, left for an additional note from the user and right for the tags input. Because most time, I use only a few predefined tags, these are rendered here as checkboxes. Nevertheless for additional tags there is an input field as well.\nThe note can be multiline, and it\u0026rsquo;s possible to use any Markdown supported in callouts. Tags can be entered into the input as comma-separated values, without the #. These will be added by the JavaScript.\nNext there are the fields for the markdown of the selection and the pageURL and pageTitle. These fields are actually meant only as temporary storage so that they are not lost for the next call of the shortcut. Therefore, I intended to hide them behind a collapsible area or make them completely invisible. However, the current beta version (2024.0.5) seems to have issues with both options. I think this will be fixed soon. Until then, these fields will be visible so that the user can make changes if necessary.\nAt the very bottom is the submit button. After this button is pressed, the content of all fields is sent back to the shortcut as a JSON string. Since the shortcut is now called with an input, it will then process the other part of the conditional statements to build the snippet and place it on the Obsidian note.\nThe HTML code is pretty straightforward. In the head section, along with the CSS, there is a script that includes the markedjs/marked library for parsing Markdown.\nThe HTML code in the body section manages the fields I described earlier, as well as the submit button. As well as the JavaScript part with these two functions:\nThe updatePreview() function updates the preview whenever the user types in the Markdown textarea. It retrieves the Markdown content and updates the preview box using the Marked.js library to convert Markdown to HTML.\nThe handleSubmit() function is called when the submit button is clicked. It collects values from the notes, tags, Markdown, URL, and title fields. The function processes the tags input by splitting each entry (separated by a ,), adding a # in front of each tag, and saving them into an array. In addition, the script processes all checked checkboxes, collecting the name of each checkbox and adds a # before name.\nAll data is combined into an object, which is then converted to a JSON string. Finally, it starts the shortcut using the specific URL scheme (shortcuts://run-shortcut) with the JSON string as input for further processing.\nThe handleSubmit() function is called when the submit button is clicked. It collects values from the notes, tags, Markdown, URL, and title fields. The function processes the tags input by splitting each entry (separated by a ,), adding a # in front of each tag, and saving them into an array. Additionally, the script handles all the checked checkboxes, collecting the text (i.e., the name of each checkbox) and adding a # in front of each tag as well.\nThis function facilitates easy modification of checkboxes for tags. Just edit the text, add or delete checkbox inputs.\nHere is the whole HTML-file:\n\u0026lt;!DOCTYPE html\u0026gt; \u0026lt;html lang=\u0026#34;en\u0026#34;\u0026gt; \u0026lt;head\u0026gt; \u0026lt;meta charset=\u0026#34;UTF-8\u0026#34;\u0026gt; \u0026lt;meta name=\u0026#34;viewport\u0026#34; content=\u0026#34;width=device-width, initial-scale=1.0\u0026#34;\u0026gt; \u0026lt;title\u0026gt;Create Snippet with note and tags in Obsidian\u0026lt;/title\u0026gt; \u0026lt;script src=\u0026#34;https://cdn.jsdelivr.net/npm/marked/marked.min.js\u0026#34;\u0026gt;\u0026lt;/script\u0026gt; \u0026lt;style\u0026gt; /* Base Body Style */ body { margin: 0; padding: 10px; font-family: \u0026#39;Segoe UI\u0026#39;, Tahoma, Geneva, Verdana, sans-serif; background-color: #f4f7f9; color: #333; } /* Container Styling */ .container { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; max-width: 1000px; margin: 0 auto; } /* Box Styling */ .box { background-color: #fff; border-radius: 8px; box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1); padding: 15px; border: 1px solid #ddd; } /* Preview Box Styling */ .preview-box { grid-column: 1 / 3; min-height: 200px; font-size: 0.9rem; overflow: auto; } .preview-box h2 { margin-top: 0; font-size: 1.2rem; color: #007acc; } /* Notes and Tags in Two Columns */ .notes-tags-box { grid-column: 1 / 3; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; } .note-field { } /* Tags Section */ .tag-input { width: 100%; padding: 8px; font-size: 0.9rem; border-radius: 4px; border: 1px solid #ccc; margin-top: 8px; margin-bottom: 15px; /* Added space below tag input field */ } /* Checkbox Group - Inline with Wrap */ .checkbox-group { display: flex; flex-wrap: wrap; gap: 10px; /* Space between checkboxes */ } .checkbox-group label { display: flex; align-items: center; margin-right: 10px; } /* Markdown and Meta Information Side by Side */ .markdown-meta-box { grid-column: 1 / 3; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; } /* Input and Textarea Styling */ textarea, input[type=\u0026#34;text\u0026#34;] { width: 100%; padding: 8px; font-size: 0.9rem; border-radius: 4px; border: 1px solid #ccc; box-sizing: border-box; } textarea { min-height: 100px; resize: vertical; } /* Submit Button Styling */ .submit-button { display: block; margin: 20px auto; padding: 12px 24px; font-size: 1rem; background-color: #007acc; color: white; border: none; border-radius: 5px; cursor: pointer; transition: background-color 0.3s; } .submit-button:hover { background-color: #005999; } /* Responsive Styles */ @media (max-width: 768px) { .container { grid-template-columns: 1fr; } .preview-box, .notes-tags-box, .markdown-meta-box { grid-column: 1 / 2; } .notes-tags-box, .markdown-meta-box { grid-template-columns: 1fr; } } \u0026lt;/style\u0026gt; \u0026lt;/head\u0026gt; \u0026lt;body\u0026gt; \u0026lt;div class=\u0026#34;container\u0026#34;\u0026gt; \u0026lt;!-- Preview Box (spans both columns) --\u0026gt; \u0026lt;div class=\u0026#34;box preview-box\u0026#34; id=\u0026#34;preview-container\u0026#34;\u0026gt; \u0026lt;h2\u0026gt;Preview of Selection\u0026lt;/h2\u0026gt; \u0026lt;!-- Headline stays outside of the rendered content area --\u0026gt; \u0026lt;div id=\u0026#34;preview\u0026#34;\u0026gt; \u0026lt;p\u0026gt;Markdown content will be previewed here.\u0026lt;/p\u0026gt; \u0026lt;/div\u0026gt; \u0026lt;/div\u0026gt; \u0026lt;!-- Notes and Tags Side by Side --\u0026gt; \u0026lt;div class=\u0026#34;notes-tags-box\u0026#34;\u0026gt; \u0026lt;div class=\u0026#34;box notes-section\u0026#34;\u0026gt; \u0026lt;h3\u0026gt;Notes\u0026lt;/h3\u0026gt; \u0026lt;textarea id=\u0026#34;notes\u0026#34; class=\u0026#34;note-field\u0026#34; placeholder=\u0026#34;Enter your notes here...\u0026#34;\u0026gt;\u0026lt;/textarea\u0026gt; \u0026lt;/div\u0026gt; \u0026lt;div class=\u0026#34;box tags-section\u0026#34;\u0026gt; \u0026lt;h3\u0026gt;Tags\u0026lt;/h3\u0026gt; \u0026lt;input type=\u0026#34;text\u0026#34; id=\u0026#34;tags\u0026#34; class=\u0026#34;tag-input\u0026#34; placeholder=\u0026#34;Enter tags separated by commas\u0026#34;\u0026gt; \u0026lt;div class=\u0026#34;checkbox-group\u0026#34;\u0026gt; \u0026lt;label\u0026gt;\u0026lt;input type=\u0026#34;checkbox\u0026#34;\u0026gt; Review\u0026lt;/label\u0026gt; \u0026lt;label\u0026gt;\u0026lt;input type=\u0026#34;checkbox\u0026#34;\u0026gt; Obsidian\u0026lt;/label\u0026gt; \u0026lt;label\u0026gt;\u0026lt;input type=\u0026#34;checkbox\u0026#34;\u0026gt; AppleShortcuts\u0026lt;/label\u0026gt; \u0026lt;label\u0026gt;\u0026lt;input type=\u0026#34;checkbox\u0026#34;\u0026gt; macOS\u0026lt;/label\u0026gt; \u0026lt;label\u0026gt;\u0026lt;input type=\u0026#34;checkbox\u0026#34;\u0026gt; iPadOS\u0026lt;/label\u0026gt; \u0026lt;/div\u0026gt; \u0026lt;/div\u0026gt; \u0026lt;/div\u0026gt; \u0026lt;!-- Markdown and Meta Information Side by Side --\u0026gt; \u0026lt;div class=\u0026#34;markdown-meta-box\u0026#34;\u0026gt; \u0026lt;div class=\u0026#34;box markdown-section\u0026#34;\u0026gt; \u0026lt;h3\u0026gt;Markdown\u0026lt;/h3\u0026gt; \u0026lt;textarea id=\u0026#34;markdown\u0026#34; placeholder=\u0026#34;Enter markdown content here...\u0026#34; oninput=\u0026#34;updatePreview()\u0026#34;\u0026gt;\u0026lt;/textarea\u0026gt; \u0026lt;/div\u0026gt; \u0026lt;div class=\u0026#34;box meta-section\u0026#34;\u0026gt; \u0026lt;h3\u0026gt;URL\u0026lt;/h3\u0026gt; \u0026lt;input type=\u0026#34;text\u0026#34; id=\u0026#34;url\u0026#34; placeholder=\u0026#34;Enter URL\u0026#34;\u0026gt; \u0026lt;h3\u0026gt;Page Title\u0026lt;/h3\u0026gt; \u0026lt;input type=\u0026#34;text\u0026#34; id=\u0026#34;title\u0026#34; placeholder=\u0026#34;Enter page title\u0026#34;\u0026gt; \u0026lt;/div\u0026gt; \u0026lt;/div\u0026gt; \u0026lt;/div\u0026gt; \u0026lt;button class=\u0026#34;submit-button\u0026#34; onclick=\u0026#34;handleSubmit()\u0026#34;\u0026gt;Submit\u0026lt;/button\u0026gt; \u0026lt;script\u0026gt; function updatePreview() { const markdownContent = document.getElementById(\u0026#39;markdown\u0026#39;).value; const previewBox = document.getElementById(\u0026#39;preview\u0026#39;); previewBox.innerHTML = marked.parse(markdownContent); } function handleSubmit() { const notes = document.getElementById(\u0026#39;notes\u0026#39;).value; const tagsInput = document.getElementById(\u0026#39;tags\u0026#39;).value; const markdown = document.getElementById(\u0026#39;markdown\u0026#39;).value; const url = document.getElementById(\u0026#39;url\u0026#39;).value; const title = document.getElementById(\u0026#39;title\u0026#39;).value; const tagsArray = tagsInput.split(\u0026#39;,\u0026#39;) .map(tag =\u0026gt; `#${tag.trim()}`) .filter(tag =\u0026gt; tag.length \u0026gt; 1); const checkedTags = Array.from(document.querySelectorAll(\u0026#39;.checkbox-group input[type=\u0026#34;checkbox\u0026#34;]:checked\u0026#39;)) .map(checkbox =\u0026gt; `#${checkbox.parentElement.textContent.trim()}`); const tags = [...tagsArray, ...checkedTags]; const data = { notes: notes, tags: tags, markdown: markdown, url: url, title: title }; const jsonString = JSON.stringify(data); window.location.href = `shortcuts://run-shortcut?name=Snippets+\u0026amp;input=${encodeURIComponent(jsonString)}`; } \u0026lt;/script\u0026gt; \u0026lt;/body\u0026gt; \u0026lt;/html\u0026gt; The Snippet+ # Before creating the shortcut, let\u0026rsquo;s take a look at how a snippet will be structured. The snippet consists of four distinct sections:\nHeader: The header begins with the callout indicator \u0026gt; [!quote]. This is followed by the current date, the page title, and the page URL. Tags: The second section contains a line with tags that are relevant to the snippet. Selection: The third section displays the browser selection formatted in Markdown. Note: The note is rendered in italics in the fourth section to distinguish it from the selection section. Here is an example in Markdown format, along with a screen capture from Obsidian:\n\u0026gt; [!quote] 4.11.24 [Obsidian (software) - Wikipedia](https://en.wikipedia.org/wiki/Obsidian_(software)) \u0026gt;#definiton #Obsidian \u0026gt; **Obsidian** is a [personal knowledge base](https://en.wikipedia.org/wiki/Personal_knowledge_base) and [note-taking](https://en.wikipedia.org/wiki/Note-taking) software application that operates on [Markdown](https://en.wikipedia.org/wiki/Markdown) files.[[3]]()[[4]]()[[5]]() It allows users to make [internal links](https://en.wikipedia.org/wiki/Internal_links) for notes and then to visualize the connections as a [graph](https://en.wikipedia.org/wiki/Graph_(discrete_mathematics)).[[6]]()[[7]]() It is designed to help users organize and structure their thoughts and knowledge in a flexible, [non-linear](https://en.wikipedia.org/wiki/Nonlinear_system) way.[[8]]() The software is free for personal use, with commercial licenses available for pay.[[3]]()[[9]]() \u0026gt; \u0026gt; *This is the first paragraph of the Obsidian article in wikipedia* The Shortcut # The first block in most shortcuts defines the source of the “shortcut input.” For this shortcut we need a “Receive No input Nowhere” input block, because we don’t need any other input source. This option cannot be selected directly. The easiest way to achieve this is to first drag the if action into the Shortcut editor and then select \u0026ldquo;Shortcut Input\u0026rdquo; as the input parameter. Then, the block with the source \u0026ldquo;Nowhere\u0026rdquo; will appear, where the first parameter has to set to No.\nWith the already implemented if/otherwise action in the editor, the shortcut can now be defined. The \u0026ldquo;if\u0026rdquo; condition will be executed when the shortcut is called on a browser window with a selection, retrieving all the necessary data from the active browser tab. Conversely, the \u0026ldquo;otherwise\u0026rdquo; condition will be processed when the shortcut is invoked via the submit button on the HTML form page, where it will build and create the snippet.\nFirst, let\u0026rsquo;s examine what happens when the \u0026lsquo;if\u0026rsquo; condition detects no input. In this case, the actions from the “Browser-Actions” app come into play. The attributes of the active webpage are retrieved using the action “Get Details of the tab active tab of frontmost window in frontmost browser.” A list of possible result parameters can be found in the documentation.\nIn the final step, the HTML file will open in a new tab of the active browser, and the corresponding fields for the page URL, page title, and markup will be populated with the retrieved data. This is accomplished using the action “Set form field with ‘id’ attribute of field name to value parameter in active tab of frontmost window in frontmost browser” from the “Browser Actions” app.\nOnce the fields are filled with data, the user can add additional notes and tags. Upon clicking the “Submit Button,” the \u0026ldquo;otherwise\u0026rdquo; condition will be executed, as the shortcut is now called with input in the form of a JSON string.\nThe actions in the ”otherwise” condition convert and prepare the JSON input to create the snippet, which is then included on the snippet page.\nFirst, the tags are converted into a string, separated by spaces. The result of the ”combine” action is assigned to the variable tags. To access the “value” of a “key,” specify the dictionary as the data source in the action. Then, in the selection popup, enter the name of the key you want to retrieve in the input at the bottom, which in this case is \u0026ldquo;tabs.\u0026rdquo;\nAdding the \u0026gt; character to the beginning of each line of the Markdown from the retrieved selection is a bit tricky. First, the entire text is converted into a list, where each line represents an item. Then, this list is iterated over in a loop, and the \u0026gt; character is prepended to each item. The result, again a list, must be converted back into a string, with each item separated by a line break. The result of this conversation is assign to the variable markdown. The same procedure has to be done with the note provided by the user.\nNow the snippet can be built in a text box as specified above. This box then will be prepends to the Snippets+ Note (in my case in the vault “Obsidian Notes” below the headline ## Snippets+)\nThe “Stop and output” action is created automatically after the first run.\nLast Words # That\u0026rsquo;s all. Test this shortcut with the HTML form in every browser except Firefox and Arc. As I mentioned in my previous article, I only add most of my shortcuts to the Finders Shortcuts menu, as this is the easiest way for me to access them. If you assign other methods, such as keyboard shortcuts, ensure that the “Shortcut Input” box remains set to “No” and “Nowhere.” Otherwise, it might result in the wrong part of the conditional statement being executed.\nThe capabilities in iOS and iPadOS are much more restricted, which means that “Browser Actions” only runs on macOS. As a result, this shortcut is not useful for mobile usage. Due to this limitation, I call the HTML file locally on my MacBook, but it\u0026rsquo;s also possible to call it from a web server.\nThe example presented is certainly not perfect. It is intended only to inspire your own ideas on how these apps can be used. At the moment, I am using this shortcut extensively. This often leads to new ideas on how this workflow can be improved and enhanced.\nHave fun, and special thanks to Carlo for these two apps.\nAs always, please leave any feedback, corrections, or ideas in the comments.\n","date":"November 7, 2024","externalUrl":null,"permalink":"/2024/11/07/improving-web-selection-capture-for-obsidian-with-browser-actions/","section":"Posts","summary":"In my article First Steps with “Browser Actions”, I presented examples of how to use Carlo Zottmann’s new app Browser Actions. One example was a shortcut to capture a selection in a browser window and display it in Obsidian as a quote callout.\n","title":"Improving Web Selection Capture for Obsidian with \"Browser Actions\"","type":"posts"},{"content":"","date":"November 7, 2024","externalUrl":null,"permalink":"/tag/javascript/","section":"Tags","summary":"","title":"JavaScript","type":"tags"},{"content":"","date":"October 27, 2024","externalUrl":null,"permalink":"/tag/4caf50/","section":"Tags","summary":"","title":"4CAF50","type":"tags"},{"content":"Due to a copy and paste issue, the explanation of the HTML code wasn\u0026rsquo;t published in the first version. Sorry for any inconvenience.\nAs a frequent user of Actions for Obsidian, I check the Community Forum often. A few days ago, a user asked the following question: How can I create an input form for multiple inputs? to create an Obsidian note.\nSince I was looking for use cases for the new beta app from Carlo Zottmann, Browser Actions, I thought this could be a good use case. My first idea was to create a web form for the questionnaire, then fetch all the entries using “Browser Actions” within a shortcut, compose the markdown with all the entries, and finally use “Actions for Obsidian” to create the note in the Obsidian Vault.\nHowever, I didn’t want to open a webpage first and then start the workflow. Fortunately, Carlo also asked his followers on Mastodon for ideas on how to create something that can collect multiple entries. @davidbures@mstdn.social proposed a flow that solved my problem.\nThe Flow of the Example # David showed how the same shortcut can be used in different ways depending on how it’s called. When the shortcut is run without any arguments, it follows the if branch of a conditional statement, which opens an HTML form in Safari. This form allows the user to enter health parameters.\nOnce the form is filled out, the user clicks the submit button. This triggers the shortcut again, but now with the input data passed as a string. Since the shortcut is now called with input, it follows the else branch of the conditional statement, where the input (field labels and values) can be processed. It would also be possible to respond to the type of input and create different branches for different inputs.\nFinding a Solution. for all Apple Platforms # Unfortunately, David\u0026rsquo;s suggestion only worked on iOS devices because it calls the HTML with a “data construct” that is not supported on macOS. So, I looked for another way with a slightly different flow.\nMy initial approach of using the new \u0026lsquo;Browser Actions\u0026rsquo; app to read the data from the fields in the form worked well (it is published in the forum post), but only on the Mac. Since the questioner asked for an iOS/iPadOS solution, I found a solution that works on both macOS and iOS/iPadOS and could be a blueprint for similar problems.\nOn MacOS, the HTML file can be saved and opened locally, but on iOS and iPadOS, it is not possible to open a local HTML file with any browser. Therefore, a web server is required to store and access the HTML file. Another limitation is that the “Open URL” action only works with Safari. If you want to use this approach on MacOS only, I recommend using \u0026ldquo;Browser Actions\u0026rdquo; with the \u0026ldquo;Open URL\u0026rdquo; action. This action supports most other browsers on the Mac.\nTo create an Obsidian note, I rely on \u0026ldquo;Actions for Obsidian\u0026rdquo;. There may be other ways, but for me, working within shortcuts and Obsidian\u0026rsquo;s Actions for Browser is just the easiest way.\nThe HTML-Form # Because the customer of Carlo asked for a form to make entries with health data, I created this small form with different UI elements for data entry. To be honest, in this case, I asked “Perplexity” to create an example form.\nHere is the HTML Code:\n\u0026lt;!DOCTYPE html\u0026gt; \u0026lt;html lang=\u0026#34;en\u0026#34;\u0026gt; \u0026lt;head\u0026gt; \u0026lt;meta charset=\u0026#34;UTF-8\u0026#34;\u0026gt; \u0026lt;meta name=\u0026#34;viewport\u0026#34; content=\u0026#34;width=device-width, initial-scale=1.0\u0026#34;\u0026gt; \u0026lt;title\u0026gt;Vital Data Recording\u0026lt;/title\u0026gt; \u0026lt;style\u0026gt; body { font-family: Arial, sans-serif; max-width: 600px; margin: 0 auto; padding: 20px; } label { display: block; margin-top: 10px; } input, select { width: 100%; padding: 5px; margin-top: 5px; } button { margin-top: 20px; background-color: #4CAF50; color: white; border: none; padding: 10px; cursor: pointer; width: 100%; } \u0026lt;/style\u0026gt; \u0026lt;/head\u0026gt; \u0026lt;body\u0026gt; \u0026lt;h1\u0026gt;Vital Data Recording\u0026lt;/h1\u0026gt; \u0026lt;form id=\u0026#34;vitalSignsForm\u0026#34;\u0026gt; \u0026lt;label for=\u0026#34;heartRate\u0026#34;\u0026gt;Heart Rate (BPM):\u0026lt;/label\u0026gt; \u0026lt;input type=\u0026#34;range\u0026#34; id=\u0026#34;heartRate\u0026#34; name=\u0026#34;heartRate\u0026#34; min=\u0026#34;40\u0026#34; max=\u0026#34;180\u0026#34; value=\u0026#34;70\u0026#34;\u0026gt; \u0026lt;output for=\u0026#34;heartRate\u0026#34;\u0026gt;\u0026lt;/output\u0026gt; \u0026lt;label for=\u0026#34;bloodPressure\u0026#34;\u0026gt;Blood Pressure (systolic/diastolic):\u0026lt;/label\u0026gt; \u0026lt;input type=\u0026#34;text\u0026#34; id=\u0026#34;bloodPressure\u0026#34; name=\u0026#34;bloodPressure\u0026#34; placeholder=\u0026#34;120/80\u0026#34;\u0026gt; \u0026lt;label for=\u0026#34;temperature\u0026#34;\u0026gt;Body Temperature (°C):\u0026lt;/label\u0026gt; \u0026lt;input type=\u0026#34;number\u0026#34; id=\u0026#34;temperature\u0026#34; name=\u0026#34;temperature\u0026#34; min=\u0026#34;35\u0026#34; max=\u0026#34;42\u0026#34; step=\u0026#34;0.1\u0026#34; value=\u0026#34;36.5\u0026#34;\u0026gt; \u0026lt;label for=\u0026#34;respiration\u0026#34;\u0026gt;Respiration Rate (per minute):\u0026lt;/label\u0026gt; \u0026lt;input type=\u0026#34;range\u0026#34; id=\u0026#34;respiration\u0026#34; name=\u0026#34;respiration\u0026#34; min=\u0026#34;10\u0026#34; max=\u0026#34;30\u0026#34; value=\u0026#34;15\u0026#34;\u0026gt; \u0026lt;output for=\u0026#34;respiration\u0026#34;\u0026gt;\u0026lt;/output\u0026gt; \u0026lt;label for=\u0026#34;Mood\u0026#34;\u0026gt;Mood:\u0026lt;/label\u0026gt; \u0026lt;select id=\u0026#34;Mood\u0026#34; name=\u0026#34;mood\u0026#34;\u0026gt; \u0026lt;option value=\u0026#34;euphoric\u0026#34;\u0026gt;Euphoric\u0026lt;/option\u0026gt; \u0026lt;option value=\u0026#34;neutral\u0026#34;\u0026gt;Neutral\u0026lt;/option\u0026gt; \u0026lt;option value=\u0026#34;frustrated\u0026#34;\u0026gt;Frustrated\u0026lt;/option\u0026gt; \u0026lt;/select\u0026gt; \u0026lt;button type=\u0026#34;button\u0026#34; onclick=\u0026#34;sendData()\u0026#34;\u0026gt;Submit Data\u0026lt;/button\u0026gt; \u0026lt;/form\u0026gt; \u0026lt;script\u0026gt; // Updates the display of the slider values document.querySelectorAll(\u0026#39;input[type=\u0026#34;range\u0026#34;]\u0026#39;).forEach(function(slider) { slider.nextElementSibling.value = slider.value; slider.oninput = function() { this.nextElementSibling.value = this.value; } }); function sendData() { var form = document.getElementById(\u0026#39;vitalSignsForm\u0026#39;); var formData = new FormData(form); var jsonObject = {}; for (var pair of formData.entries()) { jsonObject[pair[0]] = pair[1]; } var jsonString = JSON.stringify(jsonObject); var shortcutURL = \u0026#34;shortcuts://run-shortcut?name=vital\u0026amp;input=\u0026#34; + encodeURIComponent(jsonString); window.location.href = shortcutURL; } \u0026lt;/script\u0026gt; \u0026lt;/body\u0026gt; \u0026lt;/html\u0026gt; In this HTML, there are two parts besides the header with some CSS. The form with the ID vitalSignsForm contains several inputs with different types: a slider for the heart rate, a text input for the blood pressure, a number input for the body temperature, another slider for the respiration rate, a dropdown for the mood, and finally a submit button to send the data.\nNext, there are two JavaScript functions. The first part updates the value of the inputs that are controlled by the sliders; every time the slider changes, this part updates the input value. The second part, the function sendData(), will be executed when the user clicks the submit data button.\nFirst, it finds the form by its ID and collects it in the FormData object. Then it creates a data object. In the form loop, the jsonObject will be filled with the key-value pairs of the formData object.\nAfter finishing the loop, the jsonObject will be converted into a JSON string, which will be encoded for safe transfer in a URL.\nThe URL shortcuts://run-shortcut?name=vital\u0026amp;input= is a command to launch the Apple Shortcut named “vital” and pass encoded JSON data to the shortcut for processing.\nThat’s the HTML part of the solution. You can now copy this file to any local or external web server.\nThe shortcut # For the shortcut, there is no need to click anything in the details pane of the shortcut app. The “Provide Output” option became, at least in my test, automatically checked when the shortcut runs for the first time.\nIt took me some time to understand that the “Receive No input from Nowhere If there’s no input: continue” couldn’t be chosen from any detail option. Then I fifure out, that it will also be created during the first run. Just put the if action into the pane and press the run button.\nIt is important to name the shortcut the same as the call in the HTML form.\nThe if conditional checks if the shortcut is called with input parameters; if not, it skips to the otherwise branch, where it opens the HTML form from a web server.\nWhen the web form is filled out and the user presses the “Submit Data” button, the if branch will be processed. To work with the input from the form, the easiest way is to transform the JSON string into a dictionary with the action “Get dictionary from Shortcut Input.”\nIt’s possible to add some additional data that are not part of the form; here I added, as an example, the current weather conditions. If you are only on iOS and partly on iPadOS, you can also fetch some health data from the Apple Health app or some other health app from the App Store.\nNext, the markdown for the note is created in a “Text” container. You can access the data directly from the dictionary by typing the key into the field with the red border in the image. It’s the same as the id in the HTML form.\nThe last action is to create a note from that text box content. I save the note in my Obsidian folder “00 New”; with a name, where I use the current date and the string “vital.” The note will be saved in my Vault “ObsidianNotes,” and the text will be inserted into the note body.\nHow to Run This Shortcut # You can start the shortcut with the run button in the shortcut app. My preferred way is to save it in the dock (File –\u0026gt; Add to Dock). When you do this, the shortcut will be saved in your user\u0026rsquo;s application folder (~/Application or /Users/UserName/Application). In my case, it’s part of the search for apps, so Spotlight, Siri, Alfred Launcher, or Raycast all will find it. If you don’t want it in the Dock, you can just move it out; the app will stay where it is.\nConclusion # If you want a nice form-based input with a great UI and user experience, an HTML form seems to be the best way to go. This works well for Obsidian but may also be suitable for other applications. The example I used here is very simple, and in terms of health data, it might make more sense to use the data directly from the apps on the iPhone. However, I like the idea of starting a shortcut and using an HTML page for form-based data entry.\nCurrently, I’m thinking about my next project to enhance my snippets shortcut example by adding more user-created information, like tags or notes, before saving it in Obsidian.\nIf you have any ideas, please share them in the comments. Questions, feedback, and suggestions are also welcome.\n","date":"October 27, 2024","externalUrl":null,"permalink":"/2024/10/27/form-base-entry-for-obsidian/","section":"Posts","summary":"Due to a copy and paste issue, the explanation of the HTML code wasn’t published in the first version. Sorry for any inconvenience.\nAs a frequent user of Actions for Obsidian, I check the Community Forum often. A few days ago, a user asked the following question: How can I create an input form for multiple inputs? to create an Obsidian note.\n","title":"Form Base Entry for Obsidian","type":"posts"},{"content":"","date":"October 27, 2024","externalUrl":null,"permalink":"/tag/webtool/","section":"Tags","summary":"","title":"Webtool","type":"tags"},{"content":" Introduction # I’m constantly reading, collecting, and evaluating web content, so most of the shortcuts I use are related to interacting with my browser. So I was happy that Carlo Zottmann just released the first betas of his new application, Browser Actions, which expands the capabilities of Apple Shortcuts with actions that allow interactions with all internet browsers. “Browser Actions” can access menus, windows, and tabs, enabling both reading and controlling their state. Additionally, “Browser Actions” can also interact with the web content. Input fields can be read or filled with data, buttons can be triggered, and much more.\nWhile a fraction of these capabilities is already available out of the box in the Shortcut App, it is limited to Safari. With “Browser Actions”, shortcuts work seamlessly with Google Chrome, MS Edge, Vivaldi, and Brave without any modifications.\nIn this article, I will demonstrate how to use \u0026ldquo;Browser Actions\u0026rdquo; with two simple examples. However, this will only give an idea of the variety of possibilities that “Browser Actions” offers.\nAmazon Price history # The first example shows how easy it is to work with URLs. Reading them from the active browser, manipulating them, and creating new insights by opening the modified URLs in the active browser again.\nThe web application camelcamelcamel.com tracks how the prices of products on the Amazon website have evolved over time. It uses a simple URL query to search the price history of a product. This makes it easy to create a shortcut that can be invoked directly from an Amazon product page, rather than having to copy and paste or switch browser tabs manually.\nTo achieve this, the product page URL will be added to the following URL:\nhttps://camelcamelcamel.com/search?sq=AmazonURL Using standard Apple Shortcut actions, it’s already possible to create a shortcut with the following steps:\nGet the URL from the current browser using the “Receive URLs input from Whats On Screen” action. If there is no URL, stop the workflow with the message “No URL.” Check if the URL contains the word \u0026ldquo;amazon\u0026rdquo;. If it doesn’t, stop the shortcut and display the message “No Amazon URL.” If it does, concatenate the URL with the CamelCamelCamel URL. Open the resulting URL using the “Open URL” action. And this is the shortcut:\nThe disadvantage of this shortcut is that it always displays the result in Safari, regardless of which browser it was called from. However, I would prefer the result to be displayed in the same browser from which I initiated the shortcut.\n“Browser Actions” is the solution because it works with most of the browsers on macOS. It helps to stay within the active browser, as it operates based on the concept of the frontmost browser. Even when multiple browsers are open in the background, you can interact with the currently active browser window and expect that the results will be displayed in that same browser.\nWith \u0026ldquo;Browser Actions\u0026rdquo;, the shortcut would look like this:\nThere is no need to check the option to \u0026ldquo;Receive What’s On Screen\u0026rdquo;. I only use the \u0026lsquo;Pin in Menu Bar\u0026rsquo; option. It is easier for me to access shortcuts on the Mac from the menu instead of the Share Sheets.\nBefore continuing, I want to include a brief discussion about using object parameters in action calls. Let’s take the action \u0026ldquo;Get details of the tab active tab of frontmost window in frontmost browser\u0026rdquo; as an example. This action creates an internal object from the current browser tab, including all its parameters and with their current values. The values can be used in other actions, such as in the “if” part of a conditional statement.\nBecause of the features of the shortcut editor, the condition is already set up with the result from the action that is used before, in this example with “Browser Tab Object.” If there is another object set up or none at all, just click in the field, clear it, and select “Insert Variable → Get Details of Browser Tab.”\nAfter clicking on “Browser,” a popup will appear with all the parameters that can be used. Here, we want to check the Page URL, there for “PageURL” has to be selected.\nIt is also possible to store an object in a variable. In this case, the object will be duplicated and saved. This copy variable can then be used in the same way as the original object. You can also assign one parameter of an object to a variable. But at least, it seems that way. In reality, the whole object will be copied again.\nIn one case, it took me hours to discover that another parameter was used when I thought I had assigned a specific parameter. The shortcut ended up using a different one.\nI am not a computer scientist, so I hope I have used the correct terminology for the most part.\nNow, back to the shortcut.\nIn the next step, the shortcut checks whether the \u0026ldquo;PageURL\u0026rdquo; return value from the \u0026lsquo;Get Tab Details…\u0026rsquo; action contains the word \u0026lsquo;amazon\u0026rsquo;. If it does not, the shortcut will display an alert. Otherwise, it builds the link with the query in a text box, which is then used to call CamelCamelCamel in the current browser in a new tab.\nThis is a very basic use case for browser actions. It already shows an advantage over the standard actions: It works seamlessly across browsers. If you call the shortcut when a Chrome browser is active, the result will appear in the same browser. In the next example, I will present a more complex scenario that also uses \u0026ldquo;Actions for Obsidian\u0026rdquo;, an application also developed by Carlo Zottmann.\nCapture a Browser Selection as Snippet in Obsidian # The second example shows how a selection in a browser window can be captured by “Browser Actions” and converted to Markdown. Then this markdown will be added inside a callout to an Obsidian note that collects these snippets along with some metadata. The snippets will then look like this:\nFirst, create a note to collect the snippets. Since the \u0026ldquo;Prepend Note\u0026rdquo; action from \u0026ldquo;Actions for Obsidian\u0026rdquo; will be used, a heading is required under which the snippets will be inserted. Here is an example. It is possible to add more text and headlines if needed.\n--- title: \u0026#34;Snippets\u0026#34; tags: - WebSnippets date: 2023-10-20 --- ## Snippets --- This is a possible extra area, see text With \u0026ldquo;Prepend Notes\u0026rdquo; and the option \u0026ldquo;beginnig of section below the headline\u0026rdquo; the snippet will be inserted below the headline in order from newest to oldest. It is also possible to change the order with the action Append Notes. However, without an additional step the snippet would be inserted below the line \u0026ldquo;This is a possible extra area, see text\u0026quot;. To avoid this, an additional header must be placed above the --- in the footer. This could be an invisible header like ## %%hidden%% or another headline with additional text.\n--- title: \u0026#34;Snippets\u0026#34; tags: - WebSnippets date: 2023-10-20 --- ## Snippets ## %%hidden%%` --- This is a possible extra area, see text The entire shortcut will look like this:\nThe shortcut goes through the following steps:\nThe “Details of the tab…” action gets all the details of the active tab of the frontmost browser, such as the URL of the page, the title, the source, and so on. One of these details is \u0026ldquo;Current Selection (Markdown)\u0026rdquo; which, unlike the \u0026ldquo;Current Selection\u0026rdquo; parameter, captures all formatting information and converts it to markdown. In the next step, the value of the parameter “Current Selection (Markdown)” is converted into a list where each line becomes an item. This makes it possible to add \u0026ldquo;\u0026gt; \u0026quot; in front of every line needed for the callout markdown visualization. The result of the split action will be assigned to a variable, so its possible to loop through all the items with the “repeat” action. With each iteration, the \u0026lsquo;repeat item\u0026rsquo; is then prefixed with \u0026ldquo;\u0026gt; \u0026ldquo;. The resulting list is converted back to normal text. The “date” is needed for the use in the text box. In the \u0026ldquo;Text\u0026rdquo; box, the snippet is then assembled from the individual components. Two blank lines are added before the headline of the callout, to ensure a gap between the snippets. At the end, the snippet created is inserted into the snippet note with the help of “Actions for Obsidian” This allows you to select any part of a web page in most browsers on the Mac and save the selection as a snippet to a note in Obsidian. I chose Obsidian because it\u0026rsquo;s my tool for capturing what I find on the web. It may be possible to apply this shortcut to other tools as well, as long as there is some sort of integration with Apple Shortcuts.\nConclusion and Outlook # In this post I presented two small solutions that I think show the potential of “Browser Actions “on the Mac. The first example takes the URL of an active web page and calls a web application with that URL. This example shows that, unlike standard actions, “Browser Actions” work with all browsers. The second example integrates the content of a web page into a workflow and creates new content in different tools. But this is not all Browser Actions can do. The application provides many actions that allow automation of browser interactions and HTML elements, such as input.\nIn one of my next posts, I want to discuss these possibilities and show how to manipulate web pages. So stay tune ;-)\n","date":"October 21, 2024","externalUrl":null,"permalink":"/2024/10/21/first-steps-with-browser-actions/","section":"Posts","summary":"Introduction # I’m constantly reading, collecting, and evaluating web content, so most of the shortcuts I use are related to interacting with my browser. So I was happy that Carlo Zottmann just released the first betas of his new application, Browser Actions, which expands the capabilities of Apple Shortcuts with actions that allow interactions with all internet browsers. “Browser Actions” can access menus, windows, and tabs, enabling both reading and controlling their state. Additionally, “Browser Actions” can also interact with the web content. Input fields can be read or filled with data, buttons can be triggered, and much more.\n","title":"First Steps with \"Browser Actions\"","type":"posts"},{"content":"","date":"September 27, 2024","externalUrl":null,"permalink":"/tag/designworkflow/","section":"Tags","summary":"","title":"DesignWorkflow","type":"tags"},{"content":" Introduction # After explaining a straightforward workflow for creating an article image in the post Fast and Easy Image Generation with Fabric and OpenAI, an additional step can be incorporated into such a workflow. In this post, I would like to demonstrate how a brief description can be transformed into a freely scalable logo in SVG format using Fabric, DALL-E, and vectorization tools.\nSVG format, utilizing Fabric, DALL-E, and command-line vectorization tools.\nPrerequisites # As outlined in the previous article, the following prerequisites must be met:\nAn OpenAI account and an OpenAI API key. A functional installation of Fabric. Please refer to Installation and Getting Started with Fabric – the Prompt Optimizer. The command-line tool jq for processing JSON data. Additionally, the following command-line programs are required for this workflow:\nAutotrace: Converts simple bitmaps into vector graphics and supports colors. Potrace: Transforms monochrome bitmaps into more precise vector graphics. ImageMagick: A powerful command-line graphic tool, utilized here for converting bitmap graphics. I employ Autotrace and Potrace for the creation of vector graphics, as they yield different results. More on that below.\nAll these programs can be easily installed on a Mac using Homebrew:\nbrew install jq autotrace potrace imagemagick The Workflow # As with most workflows involving Fabric, this one begins with a text input, which may be provided either as a text file or a simple string, depending on the complexity of the description. This input is then processed by Fabric along with a specialized pattern optimized for logo creation. The result is a prompt which will be passed to a script that invokes DALL-E with that prompt, saves the generated logo as PNG, and forwards its path to the next script. This subsequent script then converts the PNG into a vector-based SVG file.\nThe Logo Pattern # With the installation of Fabric, a pattern specifically optimized for logo creation is already available: create_logo. I duplicated this folder in the Patterns directory, renaming it to create_mylogo, and replaced the content of the included system.md with the following:\n# IDENTITY and PURPOSE You create simple, elegant, and impactful company logos based on the input given to you. The logos are super minimalist, minimal colors. Take a deep breath and think step by step about how to best accomplish this goal using the following steps. # OUTPUT SECTIONS - Output a prompt that can be sent to an AI image generator for a simple and elegant logo that captures and incorporates the meaning of the input sent. - The prompt should take the input and create a simple, vector graphic logo description for the AI to generate. - This logo should be optimal for convert it with potrace. Only white backgound. No Colors, No Text. - Make an very detailed description with 100 words # OUTPUT INSTRUCTIONS - Ensure the description asks for a simple, vector graphic logo with a white background. - Ensure the description asks for minimalist vector graphic logo. - Ensure the description asks for a design that emphasizes smooth curves and geometric shapes. - Ensure the description asks for an entirely in black on a white background. - Ensure the description asks for stylized form of all objects. - Do not output anything other than the raw image description that will be sent to the image generator. - You only output human-readable Markdown. - Do not output warnings or notes —- just the requested sections. # INPUT: INPUT: This file can be tailored and further optimized to meet individual requirements. Having prepared the pattern, we now proceed to the next step: the actual creation of the logo.\nThe CreateLogo Script # This script takes the prompt from Fabric and passes it to DALL-E via the OpenAI API. Initially, I intended to invoke DALL-E 2 at a size of 512x512 for logo creation, as this would make image generation somewhat more cost-effective. However, I was ultimately convinced by the superior interpretation of the prompt and the quality of the results to generate the logos using DALL-E 3 instead.\nOverall, the script closely resembles the script for article image generation from the previous article, with the only difference being the use of a square format of 1024x1024 for the image size. The created logos are also stored in a different folder. At the end of the script, I have commented out the lines for saving the prompts. If these are to be retained for optimizing the pattern, the comment symbol must be removed from those lines. It is important to note that the script only outputs the path of the created PNG file!\nAs always, I save the script in the $HOME/Applications/ folder under the name CreateLogo and mark it as executable with:\nchmod +x $HOME/Applications/CreateLogo And here is the script:\n#!/bin/zsh # Check if data is piped into the script if [ -t 0 ]; then # Check if data is piped into the script exit 1 else # Read all piped inputs prompt=$(cat -) fi # The OpenAI API key should be set as an environment variable api_key=\u0026#34;$OPENAI_API_KEY\u0026#34; # Create JSON payload json_payload=$(jq -n \\ --arg model \u0026#34;dall-e-3\u0026#34; \\ --arg prompt \u0026#34;$prompt\u0026#34; \\ --argjson n 1 \\ --arg size \u0026#34;1024x1024\u0026#34; \\ \u0026#39;{model: $model, prompt: $prompt, n: $n, size: $size}\u0026#39; ) # Get the current date and time for the filename timestamp=$(date +\u0026#34;%Y%m%d_%H%M%S\u0026#34;) # Execute the curl command and save the response response=$(curl -s https://api.openai.com/v1/images/generations \\ -H \u0026#34;Content-Type: application/json\u0026#34; \\ -H \u0026#34;Authorization: Bearer $api_key\u0026#34; \\ -d \u0026#34;$json_payload\u0026#34;) # Extract the image URL from the response image_url=$(echo $response | jq -r \u0026#39;.data[0].url\u0026#39;) # Save the image with date and time in the filename curl -s \u0026#34;$image_url\u0026#34; -o \u0026#34;$HOME/Pictures/CreateLogo/image_${timestamp}.png\u0026#34; # Extract the revised prompt from the response # revised_prompt=$(echo $response | jq -r \u0026#39;.data[0].revised_prompt\u0026#39;) # echo \u0026#34;$revised_prompt\u0026#34; \u0026gt; \u0026#34;$HOME/Pictures/CreateLogo/revised_prompt_${timestamp}.txt\u0026#34; # echo \u0026#34;Revised prompt has been saved as prompt_${timestamp}.txt\u0026#34; # Save the prompt created by Fabric in a text file # echo \u0026#34;$prompt\u0026#34; \u0026gt; \u0026#34;prompt_${timestamp}.txt\u0026#34; # echo \u0026#34;Prompt has been saved as prompt_${timestamp}.txt\u0026#34; # Output success message echo $HOME/Pictures/CreateLogo/image_${timestamp}.png # Open the image # open image_${timestamp}.png Vectorization # As previously mentioned, I utilize two distinct command-line tools in this example to handle the conversion from PNG to the vector format SVG. Interestingly, I have only found these two tools, which are quite dated. There are several AI-based services available online, but they do not necessarily provide an API and can be rather expensive.\nBoth programs are command-line tools, but they cannot be easily integrated into a Fabric workflow, as they do not accept the standard input. Therefore, I have encapsulated them in scripts that take the file path of the PNG, initiate the processing, and then name the SVG accordingly.\nThe Autotrace Script # The script first checks whether a file has been provided, verifies the path, and ensures that it is indeed a PNG file. While this may not be crucial for the Fabric workflow, it is beneficial to have some error checks in place if the script is used \u0026ldquo;standalone.\u0026rdquo; In principle, Autotrace can process other bitmap formats as well, but since OpenAI generates PNG files, I restrict the script to this format.\nAfter the checks, the path to the file and the name are separated, allowing the SVG to be saved under the same path and name, but with the .svg extension. The Autotrace tool is then invoked with the path of the PNG file and several options, and the SVG is saved. I have yet to systematically experiment with the options, as there is certainly potential for improved results.\n#!/bin/bash # Check if data has been passed through the pipe if [ -t 0 ]; then echo \u0026#34;Keine Datei übergeben.\u0026#34; exit 1 fi # Read the filename from standard input read -r input_file_path # Check if the file path is empty or the file does not exist if [ -z \u0026#34;$input_file_path\u0026#34; ] || [ ! -f \u0026#34;$input_file_path\u0026#34; ]; then echo \u0026#34;Ungültiger Dateipfad: $input_file_path\u0026#34; exit 1 fi # Check if the file is a PNG file if [[ \u0026#34;$input_file_path\u0026#34; != *.png ]]; then echo \u0026#34;Die Datei ist keine PNG-Datei.\u0026#34; exit 1 fi # Extract the input filename without path and extension input_filename=$(basename \u0026#34;$input_file_path\u0026#34;) input_basename=\u0026#34;${input_filename%.*}\u0026#34; # Determine the directory of the input file input_dir=$(dirname \u0026#34;$input_file_path\u0026#34;) # Set the output file path output_file=\u0026#34;$input_dir/$input_basename.svg\u0026#34; # Call autotrace with the specified parameters if ! autotrace \u0026#34;$input_file_path\u0026#34; \\ --output-file \u0026#34;$output_file\u0026#34; \\ --input-format png \\ --output-format svg \\ --color-count 256 \\ --background-color FFFFFF \\ --despeckle-level 20 \\ --remove-adjacent-corners \\ --corner-threshold 0.5 \\ --line-threshold 1; then echo \u0026#34;Fehler bei der Konvertierung mit autotrace.\u0026#34; exit 1 fi open $output_file This script will be saved as svgAuto in the $HOME/Applications folder and marked as executable.\nNow the script can be tested. The echo command is used since the path, not the content of the PNGs, is being passed.\necho /path/to/logo.png | svgAuto Here is an example with the source image logo.png:\nAnd her the SVG converted by Autotrace:\nThe result is not bad, but it does not closely match the original contours. Adjusting the values of the options or utilizing additional options could lead to improvements. More options and further information can be easily accessed in the terminal using the command man autotrace.\nThe Potrace Script # Potrace can only create monochrome vector files. It operates on grayscale or colored bitmaps using thresholds that may need to be adjusted based on the type of image. However, I have found the default settings, as used in the script, to be sufficient thus far. Interestingly, Inkscape also utilizes Potrace for vectorization but can process colored bitmaps as well. As far as I understand, it vectorizes the image in multiple passes with different thresholds and then reconstructs the created SVGs at the end. For my purposes, the monochromatic output is adequate. Additional options for Potrace can also be accessed in the terminal using man potrace.\nThe script that works with the Potrace program functions similarly to the one with Autotrace. The first part is identical. The file path is passed using echo, parsed, and then used to save the SVG file in the correct location with the appropriate name.\nBefore Potrace is invoked, the original PNG image is first converted to the PGM format using the command magick, which was installed with ImageMagick, since Potrace cannot process PNG files. After that, Potrace is called with several options that can also be optimized or supplemented, just like in the Autotrace script.\n#!/bin/bash # Check if data has been passed through the pipe if [ -t 0 ]; then echo \u0026#34;Keine Datei übergeben.\u0026#34; exit 1 fi # Read the file path from standard input read -r input_file_path # Verify if the file path is empty or if the file does not exist if [ -z \u0026#34;$input_file_path\u0026#34; ] || [ ! -f \u0026#34;$input_file_path\u0026#34; ]; then echo \u0026#34;Ungültiger Dateipfad: $input_file_path\u0026#34; exit 1 fi # Check if the file is a PNG file if [[ \u0026#34;$input_file_path\u0026#34; != *.png ]]; then echo \u0026#34;Die Datei ist keine PNG-Datei.\u0026#34; exit 1 fi # Determine the directory and filename of the input file without extension input_dir=$(dirname \u0026#34;$input_file_path\u0026#34;) input_basename=$(basename \u0026#34;$input_file_path\u0026#34; .png) # Create the PGM output path output_pgm_path=\u0026#34;$input_dir/$input_basename.pgm\u0026#34; # Create the SVG output path output_svg_path=\u0026#34;$input_dir/$input_basename.svg\u0026#34; # Step 1: Convert PNG to PGM using ImageMagick magick \u0026#34;$input_file_path\u0026#34; \u0026#34;$output_pgm_path\u0026#34; if [ $? -ne 0 ]; then echo \u0026#34;Fehler bei der Konvertierung von PNG zu PGM.\u0026#34; exit 1 fi # Step 2: Convert PGM to SVG using \u0026#39;potrace\u0026#39; with the specified options if ! potrace \u0026#34;$output_pgm_path\u0026#34; \\ --svg \\ --output=\u0026#34;$output_svg_path\u0026#34; \\ --turdsize 2 \\ --turnpolicy black \\ --alphamax 1 \\ --opttolerance 0.2; then echo \u0026#34;Fehler bei der Konvertierung mit potrace.\u0026#34; exit 1 fi # Successful conversion echo $output_svg_path # Clean up the temporary file rm \u0026#34;$output_pgm_path\u0026#34; exit 0 The result of vectorization with Potrace of the previously used original PNG appears as follows (consider temporarily disabling dark mode if only a black area is visible):\nThe SVG converted by Potrace has traced the contours much more accurately than Autotrace. Furthermore, the paths can be edited more effectively in programs such as Inkscape or Affinity Designer. If you are in dark mode, you may see nothing due to the fact that the above SVG is transparent. There should actually be an option in Potrace that fills the background, but it somehow did not work for me. However, there is a solution, as SVG is an XML text format, allowing for relatively easy insertion of a definition that ensures the background turns white. The header section of the SVG file must be supplemented with the line\n\u0026lt;rect width=\u0026#34;100%\u0026#34; height=\u0026#34;100%\u0026#34; fill=\u0026#34;white\u0026#34;/\u0026gt; before the \u0026lt;metadata\u0026gt; tag. This can be accomplished, if desired, by the following script, which is specifically tailored to SVG files generated by Potrace and may not work with every SVG file:\n#!/bin/zsh # Check if input is provided via a pipe if [ -t 0 ]; then echo \u0026#34;No file path provided through the pipe.\u0026#34; exit 1 fi # Read the file path from the standard input (pipe) read -r input_file # Check if the file exists and is an SVG file if [ ! -f \u0026#34;$input_file\u0026#34; ] || [[ \u0026#34;$input_file\u0026#34; != *.svg ]]; then echo \u0026#34;Invalid or non-SVG file provided: $input_file\u0026#34; exit 1 fi # Create the output file path with the \u0026#34;_weiss\u0026#34; suffix output_file=\u0026#34;${input_file%.svg}_weiss.svg\u0026#34; # Insert \u0026lt;rect\u0026gt; tag before \u0026lt;metadata\u0026gt; and save to new file sed \u0026#39;/\u0026lt;metadata\u0026gt;/i\\ \u0026lt;rect width=\u0026#34;100%\u0026#34; height=\u0026#34;100%\u0026#34; fill=\u0026#34;white\u0026#34;/\u0026gt;\u0026#39; \u0026#34;$input_file\u0026#34; \u0026gt; \u0026#34;$output_file\u0026#34; # Output the new file path echo \u0026#34;$output_file\u0026#34; Like all other scripts, this one is saved in the folder $HOME/Applications as add_white_background. The corresponding invocation can then look something like this:\necho \u0026#34;/path/to/image.png\u0026#34; | potrace | add_white_background While the Autotrace solution can handle colors to a certain extent, the result is not as close to the original, and the created paths are essentially just path fragments. However, it may suffice to quickly generate a reasonably similar vector graphic for scaling images. Additionally, it is possible that better results can be achieved through improved settings in the options. I would be grateful for any tips.\nThe complete Call # Now all the components are combined, and a logo can be created, for instance, for a blog about Obsidian.\necho \u0026#34;Create a logo for a blog that discusses the PKM tool Obsidian\u0026#34; | fabric -sp create_mylogo | CreateLogo | svgPot | add_white_background With this invocation, the following image was created, which captures the theme quite well:\nAs well as the corresponding SVG:\nIf the Autotrace script is used instead of the Potrace script, the SVG file for the same PNG appears as follows. Here, adjustments to the threshold would be necessary to achieve a better result. Note: Be sure to disable dark mode here as well! The script for setting the white background would need to be adjusted for the SVGs generated by Autotrace.\nConclusion # DALL-E, Autotrace, and Potrace provide an efficient means of quickly generating vector graphics. As I mentioned in my conclusion in the article Fast and Easy Image Generation with Fabric and OpenAI, while these workflows are indeed helpful, they are primarily intended a source of inspiration and starting points for your own ideas.\nThis article also aims to demonstrate how powerful and flexible the combination of various tools with Fabric can be, offering a solid foundation for further automation and optimization of graphics processes.\nI hope to achieve these two goals. The comment section is open for ideas, feedback, praise, or whatever else you may wish to share.\n","date":"September 27, 2024","externalUrl":null,"permalink":"/2024/09/27/efficient-logo-generation-with-fabric-dall-e-and-vectorization-tools/","section":"Posts","summary":"Introduction # After explaining a straightforward workflow for creating an article image in the post Fast and Easy Image Generation with Fabric and OpenAI, an additional step can be incorporated into such a workflow. In this post, I would like to demonstrate how a brief description can be transformed into a freely scalable logo in SVG format using Fabric, DALL-E, and vectorization tools.\nSVG format, utilizing Fabric, DALL-E, and command-line vectorization tools.\n","title":"Efficient Logo Generation with Fabric, DALL-E, and Vectorization Tools","type":"posts"},{"content":"","date":"September 27, 2024","externalUrl":null,"permalink":"/tag/fabric/","section":"Tags","summary":"","title":"Fabric","type":"tags"},{"content":"","date":"September 27, 2024","externalUrl":null,"permalink":"/tag/image-generation/","section":"Tags","summary":"","title":"Image Generation","type":"tags"},{"content":"","date":"September 27, 2024","externalUrl":null,"permalink":"/tag/openai/","section":"Tags","summary":"","title":"OpenAI","type":"tags"},{"content":"","date":"September 27, 2024","externalUrl":null,"permalink":"/tag/vectorgraphics/","section":"Tags","summary":"","title":"VectorGraphics","type":"tags"},{"content":"","date":"September 23, 2024","externalUrl":null,"permalink":"/tag/blogging/","section":"Tags","summary":"","title":"Blogging","type":"tags"},{"content":" Introduction # In my previous articles, I introduced Fabric and explained how this tool can be integrated into workflows on Mac, iPad, and iPhone. Fabric generates an optimized prompt for a given problem through text inputs, such as simple entries in the command line or by extracting information from text files, in conjunction with a template referred to as a pattern. This prompt is then submitted to a large language model (LLM), which subsequently returns a text output.\nImage Generation # A workflow that I use quite often is the creation of an article image using a specific pattern tailored to the style of this blog. Until now, I have created the article images for this blog manually using Stable Diffusion or ChatGPT. To do this, I described the topic of the article in keywords and conveyed the desired image style as well as the type of composition to the tools, subsequently saving the result manually. With Fabric, I can further automate this process by generalizing these style and composition descriptions as a pattern. This way, the text of an article can simply be passed to Fabric, and the finished image will be generated as a result.\nCreation of an Article Image # Originally, I intended to implement the image generation in Python. However, the Python example on the OpenAI website failed to generate images in landscape format. So, I adapted the curl example to meet my requirements and integrated it into a shell script. The following prerequisites must be fulfilled:\nAn OpenAI account and an OpenAI API key (OpenAI Platform). A functioning installation of Fabric. Please refer to Installation and Getting Started with Fabric – the Prompt Optimizer. The command-line program jq to process JSON data. The Pattern # Let us begin with the pattern optimized for this blog. To do this, I duplicated an existing pattern folder as a template. The folder $HOME/.config/fabric/prompts/create_art_prompt suited my needs well. I renamed the copy of the folder to create_blog_image, which simultaneously serves as the name under which the new pattern will be invoked in Fabric. I then replaced the contents of the file system.md in the folder with the following content.\n# IDENTITY AND GOALS You are an expert graphic designer and AI whisperer. You know how to take a concept and give it to an AI and have it create the perfect piece of drawing for it. Take a step back and think step by step about how to create the best result according to the STEPS below. STEPS - Think deeply about the concepts in the input. - Think about the best possible way to capture that concept visually in a compelling and interesting way. OUTPUT - Output a 100-word description of the concept and the visual representation of the concept. - Write the direct instruction to the AI for how to create the drawing, i.e., don\u0026#39;t describe the drawing, but describe what it looks like and how it makes people feel in a way that matches the concept. the style, colors, mood and composition description below - Style: Vibrant and dynamic with a mix of modern digital and vintage elements. - Composition: Flowing, ribbon-like elements intertwined with detailed sketches of mathematical equations and geometric shapes. The background features aged parchment paper with modern digital elements like a keyboard and computer code on a screen. - Colors: Bright, neon colors such as blues, reds, and purples contrasted against warm sepia tones. - Mood: Abstract and technological, with a futuristic feel emphasized by the bold, futuristic font of the word “FABRIC” integrated into the design. - Include nudging clues that give the piece the proper style, .e.g., \u0026#34;Like you might see in the New York Times\u0026#34;, or \u0026#34;Like you would see in a Sci-Fi book cover from the 1980\u0026#39;s.\u0026#34;, etc. In other words, give multiple examples of the style of the art in addition to the description of the art itself. INPUT INPUT: With this pattern, a prompt can already be created that can be used in ChatGPT or Stable Diffusion:\ncat $HOME/Documents/Blog/new_blog_post.md | fabric -sp create_blog_image Thus, the first part is complete.\nThe Script # The script is intended to pass the generated prompt to DALL·E 3 and process the response. This response consists of a JSON payload that includes, among other things, an URL that pointed to the generated image and the revised_prompt, which is the prompt actually utilized by DALL·E 3.\nAs previously mentioned, the command-line tool jq is required for processing the input and output to OpenAI, which can be installed using Homebrew:\nbrew install jq\nIn addition to the image, the script will, at least in the test phase, save the prompt generated by Fabric as well as the revised_prompt for analysis purposes and to optimize the pattern. Later, these lines can be uncommented or deleted.\nUntil now, I have no found a solution for generating meaningful names for the files, so I used timestamp to name them. Additionally, the image will be opened at the end in a program designated for PNG files, such as the Preview app.\nThis leads to the following script:\n#!/bin/zsh # Check if data is being piped into the script if [ -t 0 ]; then # If no input is received via pipe... echo \u0026#34;Es wurde keine Eingabe gepiped\u0026#34; exit 1 else # Read all piped input prompt=$(cat -) fi # Your OpenAI API key should be set as an environment variable api_key=\u0026#34;$OPENAI_API_KEY\u0026#34; # Create the JSON payload json_payload=$(jq -n \\ --arg model \u0026#34;dall-e-3\u0026#34; \\ --arg prompt \u0026#34;$prompt\u0026#34; \\ --argjson n 1 \\ --arg size \u0026#34;1792x1024\u0026#34; \\ \u0026#39;{model: $model, prompt: $prompt, n: $n, size: $size}\u0026#39; ) # Get the current date and time for the filename timestamp=$(date +\u0026#34;%Y%m%d_%H%M%S\u0026#34;) # Execute the curl command and save the response response=$(curl -s https://api.openai.com/v1/images/generations \\ -H \u0026#34;Content-Type: application/json\u0026#34; \\ -H \u0026#34;Authorization: Bearer $api_key\u0026#34; \\ -d \u0026#34;$json_payload\u0026#34;) # Extract the image URL from the response image_url=$(echo $response | jq -r \u0026#39;.data[0].url\u0026#39;) # Extract the revised prompt from the response revised_prompt=$(echo $response | jq -r \u0026#39;.data[0].revised_prompt\u0026#39;) # Save the image using the date and time in the filename curl -s \u0026#34;$image_url\u0026#34; -o \u0026#34;$HOME/Pictures/CreateImage/image_${timestamp}.png\u0026#34; # Save the used prompt in a text file echo \u0026#34;$prompt\u0026#34; \u0026gt; \u0026#34;$HOME/Pictures/CreateImage/prompt_${timestamp}.txt\u0026#34; # Save the revised prompt in a text file echo \u0026#34;$revised_prompt\u0026#34; \u0026gt; \u0026#34;$HOME/Pictures/CreateImage/revised_prompt_${timestamp}.txt\u0026#34; # Display the image open \u0026#34;$HOME/Pictures/CreateImage/image_${timestamp}.png\u0026#34; # Output success messages echo \u0026#34;Bild gespeichert als image_${timestamp}.png\u0026#34; echo \u0026#34;Prompt gespeichert als prompt_${timestamp}.txt\u0026#34; echo \u0026#34;Überarbeiteter Prompt gespeichert als revised_prompt_${timestamp}.txt\u0026#34; # If the created image file should be piped to the next step, uncomment the success messages and uncomment the following line # echo image_${timestamp}.png What to Do with the Scripts # Scripts are text files that typically cannot be executed directly. To simplify the invocation of a shell script, I copy them into a directory that is included in the shell\u0026rsquo;s search path. On a Mac, these are usually:\n$HOME/Applications $HOME/bin $HOME/.local/bin When scripts are stored in one of these directories, they are accessible only to the current user. If a script is to be made available to all users on a computer, the appropriate paths are:\n/usr/local/bin /opt/bin Administrator privileges are required for copying and manipulating files in these locations.\nTo test which paths are already specified in the search path, you can use the command:\necho $PATH I prefer the folder $HOME/Applications for my personal programs and scripts. Since this folder is also used for web apps created by browsers, such as those added to the Dock in Safari via “File → Add to Dock”, it is usually already present.\nIf this folder is not included in the search path, it can easily be added with the following command:\necho \u0026#39;export PATH=$PATH:$HOME/Applications\u0026#39; \u0026gt;\u0026gt; $HOME/.zshrc` source $HOME/.zshrc` The script can then be saved in the folder, for example, under the name CreateImage, and made executable with:\nchmod +x $HOME/Applications/CreateImage Another Environment Variable # In order to create an image using the OpenAI API call, the OpenAI API key must be stored as an environment variable in the shell configuration file. The script will then read it from there. The advantage of this approach is that the key does not need to be specified in the code of every program that calls OpenAI, thus preventing accidental exposure of the key in a blog post like this or on GitHub.\n# Added for OpenAI Apps echo \u0026#39;export OPENAI_API_KEY=\u0026#34;Your OpenAI Key\u0026#34;\u0026#39; \u0026gt;\u0026gt; $HOME/.zshrc source $HOME/.zshre The First Test Run # With this command, you can now test whether the image generation with Fabric and the script works:\necho \u0026#34;Create an image of two parrots on a skyscraper roof\u0026#34; | CreateImage You should see a confirmation in the terminal that the image and both prompts have been saved. Additionally, the created image will open in the Preview app:\nNow that all components have been created, the workflow can be tested with the draft of this article:\ncat $HOME/Documents/Blog/article_draft.md | fabric -sp create_blog_image | CreateImage With that result:\nFurther Optimization # However, this still requires too much typing. Therefore, this lengthy command line invocation can be encapsulated in a shell script:\n#!/bin/zsh # Check if an argument has been provided if [ $# -eq 0 ]; then echo \u0026#34;Please provide a file.\u0026#34; exit 1 fi # Check if the provided argument is a file if [ ! -f \u0026#34;$1\u0026#34; ]; then echo \u0026#34;The provided argument is not a file.\u0026#34; exit 1 fi # If an argument has been provided and it is a file, execute the command cat \u0026#34;$1\u0026#34; | fabric -sp create_blog_image | CreateImage Saved in the $HOME/Applications folder, for example as make_article_image, and marked as executable, the invocation then simplifies to:\nmake_article_image /path/to/article.md For my use case, I am currently seeking a solution that I can directly invoke in Obsidian to create the image from the active note. There are several candidates that might support this, such as the “Templater” or “Shell Commands” plugins, but that will be the next step.\nConclusion # This example of how Fabric can be integrated into a useful workflow should be understood as just that: an example for personal development. The pattern must be tailored to individual needs — I certainly want my image blog style to be consistently reflected everywhere 😉 . Optimizing such a pattern will undoubtedly require several iterations and time. It is worthwhile to take a closer look at the two generated prompts to see which levers need to be adjusted, as the saying goes in German.\nI hope these ideas are nonetheless helpful, and as always, I welcome comments, whether regarding potential errors, improvements, praise, or criticism.\n","date":"September 23, 2024","externalUrl":null,"permalink":"/2024/09/23/fast-and-easy-image-generation-with-fabric-and-openai/","section":"Posts","summary":"Introduction # In my previous articles, I introduced Fabric and explained how this tool can be integrated into workflows on Mac, iPad, and iPhone. Fabric generates an optimized prompt for a given problem through text inputs, such as simple entries in the command line or by extracting information from text files, in conjunction with a template referred to as a pattern. This prompt is then submitted to a large language model (LLM), which subsequently returns a text output.\n","title":"Fast and Easy Image Generation with Fabric and OpenAI","type":"posts"},{"content":"","date":"September 23, 2024","externalUrl":null,"permalink":"/tag/llm/","section":"Tags","summary":"","title":"LLM","type":"tags"},{"content":" Introduction # In my last blog post, I provided an outlook on running a shortcut that summarizes a webpage on an iPhone or iPad. Since it\u0026rsquo;s not possible to run Go on iOS, we need a computer that can be reached via SSH from your device. For constant access, it should preferably be up and running 24/7. For me, my MacBook Pro would be a good choice, but when I use my iDevices, I close the lid, so the iDevices have no chance to connect.\nChoosing the Right Machine # I have two machines running all the time in my network: a Synology NAS and a Raspberry Pi 4 with 4GB of RAM running Ubuntu 24.04 LTS. Because I am not very experienced in cross-compiling with Go or creating Docker images, I decided to go with my Raspberry Pi.\nSince I’m only running Fabric with cloud LLMs, in my case with OpenAI, there is no need for a lot of computing power, so the Raspberry Pi is more than sufficient.\nBut in the end, you can use any computer system that runs Go.\nPreconditions # You need to have a little expertise in Linux/Unix and the Command Line Interface (CLI). Besides the installation of Go (see the next chapter), you should also set up SSH on your Raspberry Pi, because the Shortcut will call Fabric via “Run Script over SSH”. You should also install git to access the Fabric repository on GitHub, ffmpeg for running the yt command, and wget to follow some of my experiments later on:\nsudo apt install git ffmpeg wget Installation of Go and Fabric # If Go isn’t already installed, you have to install it first. I followed the “official” method as described on the GO website:\nEnsure there is no previous version installed by checking if the folder /usr/local/go exists. If it does, delete it with sudo rm -rf /usr/local/go. Download the latest arm64 version for the Raspberry Pi. Install Go. Depending on where you downloaded the archive, for me it was: tar -C /usr/local -xzf $HOME/Downloads/go1.23.0.linux-amd64.tar.gz. Add the necessary path information. For the setup in my case $HOME/.zshrc. For the shortcut call, I created and used a special shell limited configuration file, similar to my macOS setup, called .fabenv, and added the paths there:\n\u0026amp;nbsp;export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin Install Fabric directly from the repository:\ngo install github.com/danielmiessler/fabric@latest. Set up Fabric with fabric --setup. Before doing so, read the next paragraph. Install yt if you want to analyze YouTube videos: go install github.com/danielmiessler/yt@latest, but be sure to add your YouTube API key. Troubleshooting Fabric Setup # When I wrote this, the setup failed at the end when copying the patterns, with the error stream error: stream ID 3; CANCEL; received from peer happened. However, the installation and setup completed all the necessary tasks. The only things missing are the folders for the patterns, sessions, and contexts. After copied them from my macOS installation, Fabric ran fine. I hope someone can figure out why the setup fails so I can delete this paragraph ;-). If you use another computer as a server or another OS on your Raspberry Pi, it might work.\nUpdate 2024/09/23: When using an Ethernet cable to connect the Raspberry Pi 4, everything works fine. This suggests that the issue may be related to the speed or bandwidth limitations of the Wi-Fi chip.\nValidating the Installation # All the other information in my blog post Installation and Getting Started with Fabric is still valid. For example:\necho \u0026#34;Two parrots on a skyscraper rooftop\u0026#34; | fabric --stream --pattern create_logo works just like on the Mac.\nThe “Run Script over SSH” Mystery # As I already mentioned in my previous blog post Summarizing Websites with Fabric and Apple Shortcuts, there is some mysterious behavior with Shortcut variables inside and around the shell action, both local and remote.\nPassing the URL # For the “Run Script over Shell” action, I tried several ways to pass the URL into the action until I found a hint somewhere on the web that the easiest way is just to use variables inside the script box:\nAs you can see, this is an example in the macOS Shortcuts app, and it works fine. You can use this solution instead of the workaround in my previous blog post.\nI initially thought that if it works on macOS, it should also work in the iOS/iPadOS Shortcuts app. So, I copied the shortcut. However, it didn’t work at all, which was frustrating.\nAfter hours of experimenting, I found that this construct works, though I’m not sure why the easy one line command doesn\u0026rsquo;t work:\nUsing curl Instead of wget # There is another command to download the content of URLs in the Linux and macOS toolbox: curl. Out of curiosity, I tried this command. To my surprise, there is no need for the complex construction that I had to use with wget.\nAlthough I’ve been using wget for ages, I think I have to switch over to curl. Because of all the trouble, I didn’t go the extra mile to extract the text from the HTML with pandoc. So this will be the preferred solution.\nAn Unexpected Working Solution # For the sake of completeness, here is another approach. During my experiments, I made a small mistake and ended up with this command, which surprisingly works as well:\nI assume it might be because the variable URL is internally treated as some kind of structure that always has all information available, and some magic fetches the right value for a given context. For example, if you just echo the variable URL, the output is simply the URL.\nThe iOS/iPasOS Shortcut # The workflow is the same as in the macOS workflow:\nUse Receive What’s Onscreen to work in all web browsers. Assign the URL of the active website to the variable URL. Assign the title to the variable name. Delete : and / in the variable name, because these characters cause issues in file names (this could be extended to other characters like ?). Use Run Script over SSH with the IP address or name of your server, the user and password, and the script discussed above. Put the result into the variable summary. Create the note for Obsidian in a text box, including the properties section and, if needed, a footer area. Save it with the Create Note action of the ActionForObsidian (AFO) Shortcuts Extension App. Use \u0026ldquo;AFO\u0026rdquo; to open the newly created note. I use \u0026ldquo;AFO\u0026rdquo; to save the note in my Obsidian vault because it’s very easy to handle. It is worth investing in this extension, as its collection of Obsidian-related actions helps bridge the gap between the Shortcuts app and Obsidian. Nevertheless, you can also use the save-file action or move the result to the Notes app.\nConclusion # This is just an example of how to integrate a remotely running Fabric installation into iOS/iPadOS Shortcuts. This approach opens up a universe of possibilities. Anything that runs on a remote machine and consumes text input or creates text output on the terminal (stdin/stdout) can be used to create complex workflows with Fabric, thereby easily becoming AI-supported.\nI hope this blog post is overall helpful, despite the little hurdles. It would be great if someone could explain the mysterious behavior of the URL variable. I would also love to learn how to avoid the Fabric setup error. Critics, kudos, more ideas, and whatever else—please leave them in the comments.\n","date":"August 28, 2024","externalUrl":null,"permalink":"/2024/08/28/creating-a-shortcut-that-uses-fabric-remotely/","section":"Posts","summary":"Introduction # In my last blog post, I provided an outlook on running a shortcut that summarizes a webpage on an iPhone or iPad. Since it’s not possible to run Go on iOS, we need a computer that can be reached via SSH from your device. For constant access, it should preferably be up and running 24/7. For me, my MacBook Pro would be a good choice, but when I use my iDevices, I close the lid, so the iDevices have no chance to connect.\n","title":"Creating a Shortcut that Uses Fabric Remotely","type":"posts"},{"content":"","date":"August 28, 2024","externalUrl":null,"permalink":"/tag/ipados/","section":"Tags","summary":"","title":"iPadOS","type":"tags"},{"content":"","date":"August 28, 2024","externalUrl":null,"permalink":"/tag/promptengineering/","section":"Tags","summary":"","title":"PromptEngineering","type":"tags"},{"content":" Introduction # In my previous article, I explained the first steps for using Fabric to work more efficiently with LLMs. This was primarily done through the command line interface. As I promised in that article, I now want to show how Fabric can be integrated into an Apple Shortcuts workflow.\nAs an example, I will demonstrate how to summarize a webpage using the workflow described in the article. As a reminder, here’s the CLI command:\nwget -qO - https://example.com/my-blog-article | pandoc -f html -t plain | fabric --stream --pattern summarize My requirements for the shortcut are:\nIt should work with every browser. It will be called from the Shortcut Menu. It will save the result in my Obsidian Vault as a note in a specific folder. The title of the webpage will be used as the title of the note. The URL of the webpage and the tag “fabric” should be saved in the frontmatter section of the note. The Apple Shortcuts # Originally, I intended to implement the Apple Shortcut using the script more or less as it was. The plan was to fetch the URL of the active website with the “What’s On Screen” action, pass it as an argument to the “Run Shell Script” action, and then execute the script. However, it didn’t work as intended. While the URL is correctly identified within the Shortcuts environment, it turns into a link to a local copy of the webpage when the “Run Shell Script” action is called. This can be tested with a simple Shortcut.\nJust run this shortcut when a browser is active, and you’ll see the problem. ;-)\nIn the end, I took advantage of this strange behavior by simply piping the content of the file located at the path provided as an argument with the cat command to the fabric command.\nBefore starting to define the shortcut, there is another issue to solve. Since the “Run Shell Script” action doesn’t run in the normal environment of the Terminal program, it can’t access, for example, the search path definitions that are set in the .zshrc configuration file. This means it won’t find the fabric command or any of the alias definitions for easily calling fabric, as I explained in the previous article.\nShortcut definitions # Before starting to define the shortcut, there is another issue to solve. Since the “Run Shell Script” action doesn’t run in the normal environment of the Terminal program, it can’t access, for example, the search path definitions that are set in the .zshrc configuration file. This means it won’t find the fabric command or any of the alias definitions for easily calling fabric, as I explained in the previous article.\nHere is the shell configuration that will be used in the script:\n# Add the Go binary directory and the path to homebrew commands to the existing PATH environment variable export export PATH=\u0026#34;$PATH:$HOME/go/bin:/opt/homebrew/bin/\u0026#34; # Check if the fabric-bootstrap.inc file exists in the specified directory # If the file exists, source it to load its configurations and variables if [ -f \u0026#34;$HOME/.config/fabric/fabric-bootstrap.inc\u0026#34; ]; then . \u0026#34;$HOME/.config/fabric/fabric-bootstrap.inc\u0026#34;; fi This configuration adds the path information for the Fabric as well as for Homebrew-installed commands (in this case, pandoc). The second part loads the alias definitions, allowing you to use just summarize instead of fabric -sp summarize.\nNow, let’s take a look at the script:\nsource $HOME/.fabenv cat $1 | pandoc -f html -t plain | -sp summarize First, it sources the shell configuration. Then, it calls the command cat $1. Since the variable $1 contains the local path to the webpage, it pipes the entire HTML, which includes a lot of extra rendering information, through the pandoc command to clean it up before piping it through the fabric/summarize call.\nWith the script defined, let’s look at the entire Shortcut:\nAnd here’s how the process works:\nThe URL and title of the webpage are passed to the shortcut and stored in the corresponding variables. The title will be cleared of any special characters that might cause issues in Obsidian or Finder. The “Run Shell Script” action receives the path to the local HTML file through the URL variable. The script will be executed as described above. The output of the shell script is stored in the Text variable. The note is then assembled in a text block, including the frontmatter section and footer. This text is then saved in the Obsidian Vault. To save the note in the Obsidian Vault, I use the shortcut extension Actions for Obsidian with the “Create Note” action. Alternatively, you can save the note with the “Save File” action, but when working with Obsidian, it’s worth investing in Actions for Obsidian. Some webpages are resistant, and the script can’t fetch them. In such cases, at least when using OpenAI, the shortcut will save a note with some placeholder text.\nSummary and Outlook on Future Applications\nI hope that with this article, I not only introduced a useful tool but also provided a starting point for creating your own solutions on how to integrate Fabric into Apple Shortcuts.\nThe shortcut is certainly not yet fully refined. For example, error handling is missing. I can also imagine that a selection dialog could be used to choose different patterns. Additionally, the workflows currently run locally on my MacBook Pro, so I haven’t tested whether the “Remote Shell Script” action can execute the Fabric command on a server. As long as no local LLMs are involved, a Raspberry Pi should suffice. This way, a shortcut could also work on an iPad or iPhone. I’m currently working on that, so stay tuned.\nFeel free to leave criticism, corrections, and praise in the comments.\n","date":"August 25, 2024","externalUrl":null,"permalink":"/2024/08/25/summarizing-websites-with-fabric-and-apple-shortcuts/","section":"Posts","summary":"Introduction # In my previous article, I explained the first steps for using Fabric to work more efficiently with LLMs. This was primarily done through the command line interface. As I promised in that article, I now want to show how Fabric can be integrated into an Apple Shortcuts workflow.\n","title":"Summarizing Websites with Fabric and Apple Shortcuts","type":"posts"},{"content":"","date":"August 24, 2024","externalUrl":null,"permalink":"/tag/ai/","section":"Tags","summary":"","title":"AI","type":"tags"},{"content":" Introduction to Fabric # The quality of results when using Large Language Models (LLMs) like Ollama or ChatGPT heavily depends on the quality of the prompts used. This understanding has led to the emergence of specialized professions like Prompt Engineers, whose task is to configure LLMs optimally to achieve the best possible results for specific requirements or contexts. In addition, hundreds of articles have been published with promising titles like “The 100 Best Prompts for Generating a Job Application for a Top-Manager Position.”\nFabric, the tool introduced here, aims to simplify and optimize the prompt creation process to obtain the best results from a LLM. This article explains the installation and basic usage.\nWhat is Fabric? # The Fabric project by Daniel Miessler was developed to enable LLM users to refocus on content instead of getting lost in countless prompt experiments. Fabric offers a library of over 140 so-called patterns tailored to specific tasks and problems. Examples include \u0026ldquo;extract_wisdom,\u0026rdquo; which extracts insights and key points from a text or YouTube video, and \u0026ldquo;create_coding_project,\u0026rdquo; which helps create the framework for a development project. The patterns describe in great detail which steps are performed with the input, the role the LLM should play, what it should pay special attention to, and how the output should be structured.\nFabric combines the input, whether it’s a text or a task context, with the chosen pattern and passes it to an LLM. This can either be done locally, as with LLMs provided by Ollama, or through cloud services like OpenAI, Claude, or Google.\nAs of late August 2024, Fabric is only a command-line tool. The previous Python version had a GUI and server interface, but these are not currently available.\nInstallation of Fabric # The installation is done through the project\u0026rsquo;s GitHub repository. Fabric is written in Go, and some additional tools are needed to run the examples. Therefore, some preparations are necessary before installation. Since the installation and later usage happen in the Terminal program, some experience with the command line is recommended. Feel free to ask any open questions in the comments; I will try to answer them as quickly as possible.\nPreparation for Installation # First, go, git, and ffmpeg may need to be installed. I use the package manager Homebrew for this purpose. If Homebrew is installed on the Mac, the necessary tools can be quickly installed in the Terminal with the following command:\nbrew install git go ffmpeg If the programs were already installed, no reinstallation will occur.\nAfter installing GO on my Mac, the search paths were not added to the .zshrc file. For a go installed with brew, a slightly different path for GOROOT is needed than described in the instructions on GitHub. To add these search paths, open the ~/.zshrc file in an editor:\n# I use nano as an editor nano ~/.zsh Then scroll to the end of the file and enter the following:\n# Set Go Path export GOROOT=\u0026#34;$(brew --prefix golang)/libexec\u0026#34; export GOPATH=$HOME/go export PATH=$GOPATH/bin:$GOROOT/bin:$HOME/.local/bin:$PATH: If Go was not installed with Homebrew, the GOROOT might look different. However, I cannot validate this:\nexport GOROOT=/usr/local/go With ⌃x⌃y the editor is closed and the file is saved. Now, with the command\nsource ~/.zshrc the changes are made known to the system.\nSteps to Install Fabric # First, the latest version of Fabric is installed from the GitHub repository using the go command:\ngo install github.com/danielmiessler/fabric@latest Then, the setup is started with the following command:\nfabric --setup If an error occurs when running fabric --setup, indicating that Fabric was not found, it may be due to incorrect entries in the ~/.zshrc file, or the source command was not executed. Alternatively, you can close the Terminal window and try running the setup again in a new window.\nDuring the setup process, you will first be prompted to enter the API keys for services like Groq, Gemini, Anthropic, OpenAI, and Azure. If you don\u0026rsquo;t plan to use any of these services, you must at least install Ollama and provide the Ollama URL, which is typically http://localhost:11434. After entering the information for one or more of these services, a list of all available LLMs will be generated, from which you can select the default LLM. Following this, you will be asked to enter the YouTube API key. For the final prompts under the \u0026ldquo;Patterns Loader\u0026rdquo; section, I accepted the suggested values.\nOnce these inputs are completed, the patterns are downloaded and installed in $HOME/.config/fabric/patterns. Additionally, a .env file is created in the $HOME/.config/fabric directory, where the provided information is stored. A file named unique_patterns.txt contains a list of all patterns. In the context folder, you can store text files that provide additional context when invoking Fabric. This allows you to define general supplementary information once and apply it across different patterns as needed.\nThe purpose of the sessions folder, which is also created during setup, is still unclear to me.\nBasic Usage of Fabric # Fabric is a command-line tool that adheres to the Unix philosophy of flexibly combining small, specialized programs to create more complex workflows. Programs are connected using the pipe symbol (|), where the output (stdout) of one program becomes the input (stdin) of the next. In a workflow with Fabric, any command-line tool that generates output on stdout or consumes input via stdin can be utilized. For example, echo can be used for text input, or cat can be used to pass a text file. Additionally, results can be written to a file using \u0026gt; or appended to a file with \u0026gt;\u0026gt;.\nThe following command line demonstrates how to create a simple workflow with echo and Fabric that processes a text and generates a prompt suggestion for DALL-E or Stable Diffusion to create a logo:\necho \u0026#34;Two parrots on a skyscraper rooftop\u0026#34; | fabric --stream --pattern create_logo In this example, the echo command outputs the text “Two parrots on a skyscraper rooftop,” which is then passed to the Fabric command via the pipe symbol (|). Fabric processes this text using the create_logo pattern, sends the result to the LLM, which in turn generates a prompt suggestion that is displayed in the command line. The LLM, in this case, GPT-4o-mini, generated the following prompt:\nA simple, vector graphic logo featuring two stylized parrots perched on the edge of a minimalist skyscraper rooftop. The design should emphasize elegance and simplicity, using clean lines and a limited color palette to convey a modern urban feel I manually submitted the command to ChatGPT and received the following image:\nThis approach allows for seamless integration of different command-line tools into a cohesive workflow with Fabric, providing flexibility and power in handling various text processing tasks.\nThe following example demonstrates how to create a summary of a webpage using Fabric (Note that wget and pandoc may need to be installed using Homebrew):\nwget -qO - https://example.com/my-blog-article | pandoc -f html -t plain | fabric --stream --pattern summarize In this example:\nwget downloads the webpage content. The HTML code is passed to pandoc, which converts it to plain text. The plain text is then piped to Fabric, which uses the summarize pattern to process the text with the LLM, and the summary is output. To process a specific section of text from a document and directly reinsert the result back into the document, the pbpaste and pbcopy commands on macOS are particularly useful. These commands allow you to pass the clipboard content to Fabric, then copy the output back to the clipboard, which can subsequently be pasted directly into the document using ⌘-V.\nHere’s how you can do it:\npbpaste | fabric -sp improve_writing | pbcopy In this workflow:\npbpaste takes the current content of the clipboard and passes it to Fabric. Fabric processes the text using the improve_writing pattern. The processed text is then copied back to the clipboard using pbcopy. You can then paste the improved text back into your document by pressing ⌘-V. This method streamlines the editing process, making it easy to enhance specific sections of your text and quickly reintegrate them into your documents.\nAdvanced Features of Fabric # In the old Python version of Fabric, additional tools like yt for transcribing YouTube videos, ts for transcribing audio files, and save for saving the output to a defined folder were included. As of August 24, 2024, only the yt command has been ported to the new version. It is currently uncertain whether the other tools will be reintroduced.\nHowever, the yt command needs to be installed separately in this version:\ngo install github.com/danielmiessler/yt@latest The yt tool extracts spoken text from a YouTube video, which can then be processed by Fabric.\nHere’s how you can use it:\nyt --transcript https://www.youtube.com/watch?v=UbDyjIIGaxQ | fabric --stream --output $HOME/Video_transcript.md --pattern extract_wisdom In this example, the text from the video \u0026ldquo;You’ve Been Using AI Wrong\u0026rdquo; by NetworkChuck is extracted and analyzed. The key insights, according to the defined rules of the extract_wisdom pattern, are saved in a Markdown file named Video_transcript.md in the home directory.\nThe video \u0026ldquo;You’ve Been Using AI Wrong\u0026rdquo; is what brought Fabric to my attention. It\u0026rsquo;s worth watching, though it discusses the old, Python-based version of Fabric.\nAs a replacement for the save command, which allowed saving the output to a defined location, I use the following shell script. I save it under $HOME/Applications (which is included in my search path) with the name save, and make it executable with the following command:\nchmod +x $HOME/Applications/save Here is the script:\n#!/bin/zsh export PATH=$HOME/Applications/:$PATH: # Define the directory where the file will be saved TARGET_DIR=\u0026#34;$HOME/Documents/fabric_files\u0026#34; # Create the directory if it doesn\u0026#39;t exist mkdir -p \u0026#34;$TARGET_DIR\u0026#34; # Set the current date as a prefix for the filename DATE_PREFIX=$(date +\u0026#34;%Y-%m-%d\u0026#34;) # Set the base filename BASENAME=\u0026#34;note\u0026#34; EXTENSION=\u0026#34;.md\u0026#34; # Generate the initial filename FILENAME=\u0026#34;${DATE_PREFIX}-${BASENAME}${EXTENSION}\u0026#34; # Check if the file exists and find an incremental number COUNTER=1 while [[ -e \u0026#34;${TARGET_DIR}/${FILENAME}\u0026#34; ]]; do FILENAME=\u0026#34;${DATE_PREFIX}-${BASENAME}-${COUNTER}${EXTENSION}\u0026#34; COUNTER=$((COUNTER + 1)) done # Read the text from the pipe and save it to the file cat \u0026gt; \u0026#34;${TARGET_DIR}/${FILENAME}\u0026#34; Now, the result of a Fabric command can easily be saved in the Documents/fabric_files folder under the name 2024-08-23-note.md using the following command:\ncat ~/Documents/Article_Draft.md | fabric -sp summarize | save Useful Commands for Fabric # Before diving into the real magic of Fabric, namely the patterns, here are some important commands:\nfabric --listpatterns # This command lists all available patterns. fabric --listmodels # This command lists all available LLM. fabric --changeDefaultModel # This command allows you to change the default LLM. fabric --model llama3.1:latest -sp summarize # This command temporarily changes the LLM to `llama3.1:latest` for this specific call. fabric --output myFile.md -sp summarize # This command saves the output of the Fabric call to `myFile.md`. fabric --context blogger-support -sp summarize As previously mentioned, you can store files in the ~/.config/fabric/context directory that provide additional information for the Fabric command. For example, in the blogger-support file, you could define additional rules that are helpful in the context of writing a blog article. So these rules can be used not only with one pattern but also with the --context option in various different pattern calls.\ncat ~/.config/fabric/.env #This command shows the current configuration stored in the `.env` file. Additional Help # For more options and explanations, you can use the following commands:\nfabric --help or\nyt --help These commands provide a detailed list of available options and their explanations for both Fabric and the YT tool.\nThe Importance of Patterns in Fabric\nPatterns are the core of Fabric, as they efficiently provide proven prompts that are mixed with your own content and sent to an LLM for processing. These patterns can be easily adapted to your specific needs, or you can convert your own tried-and-true prompts into patterns directory to use with Fabric.\nDuring installation, around 140 patterns are installed (and the number keeps growing). These patterns are typically divided into sections. Most patterns begin with the “IDENTITY and PURPOSE” section, which describes the role the LLM should play and the tasks it has to perform. This is followed by sections with instructions on how the LLM should approach the analysis of the input and what it should pay particular attention to. The “OUTPUT” section describes the format of the output. The final section is the “INPUT,” which will later be supplemented with your input.\nFor example, the write_essay pattern includes the following instruction in the “IDENTITY and PURPOSE” section:\n# IDENTITY and PURPOSE You are an expert on writing concise, clear, and illuminating essays on the topic of the input provided. However, this alone is not sufficient, as the LLM also needs to understand what Paul Graham’s style looks like. Therefore, the pattern includes text examples totaling 9,025 words that define the typical essay style of Paul Graham. Following this, there are also some detailed output instructions.\nThis is, of course, a pattern that begs to be customized. For instance, instead of Paul Graham, you could use your own name, the text examples could be taken from your own writings, and the instructions could be adjusted so that the output is an article for a magazine rather than an essay.\nAs a German native speaker, you might find it especially useful to include an instruction in the “OUTPUT INSTRUCTIONS” section that ensures the output is in German:\n- Make the output in German. When customizing patterns, it’s advisable to make changes in a copy of the pattern folder, which you can then rename to something like my_summary. The developers recommend saving these customized folders in a separate directory and only placing a copy in the patterns folder. This precaution is important because the original patterns, and potentially your customized patterns stored in that folder, may be overwritten during an updates\nUsing Context Files: Another way to adopt Patterns # As mentioned above, using the \u0026ndash;context option is another effective method to tailor the output to your personal needs. Let’s continue with the example of ensuring the output is in German. To do this, create a file in the context directory:\nnano ~/.config/fabric/contexts/german And include the following content:\nMake the output in German Now, whenever you call Fabric with the \u0026ndash;context=german option alongside any pattern, the output will be in German.\nFor example:\necho \u0026#34;Why is the sky is blue\u0026#34; | fabric --context german --pattern create_academic_paper In this case, Fabric will process the input and generate the output in German, regardless of the pattern used. This approach provides a flexible and reusable way to ensure consistent output across various tasks and patterns.\nBut using context files in Fabric offers far more possibilities than simply setting a language preference. The context feature allows you to include a wide range of instructions that can enhance or modify the behavior of multiple patterns, making it a powerful tool for customizing how Fabric processes your input.\nFor example, suppose you want to consistently generate academic content with a formal tone, (still) ensure that the output is in German, and include citations in APA style. You can achieve this by creating a context file that encapsulates all these requirements:\nnano ~/.config/fabric/contexts/academic_german Then, include the following content:\nMake the output in German Use a formal academic tone Include citations in APA style Ensure the content is well-structured with clear headings and subheadings Now, whenever you invoke Fabric with this context, it will apply these instructions in addition to the pattern’s default behavior:\necho \u0026#34;The effects of climate change on Arctic wildlife\u0026#34; | fabric --context academic_german --pattern create_academic_paper | pandoc -f latex -o output.pdf This example creates the paper in German and uses pandoc to convert fabric’s output directly to a PDF.\nContext files can be expanded to include any instructions that are useful to you, such as:\nTarget audience considerations: Tailoring content for specific readers, like industry professionals or a general audience. Specific writing styles: Adopting the style of a particular author or publication. Formatting guidelines: Ensuring consistent formatting, such as bullet points, lists, or paragraph styles. By leveraging the power of context files, you can create versatile, reusable configurations that extend and enrich the functionality of Fabric patterns, making your workflows more efficient and tailored to your exact needs.\nOptimizing the Fabric Call # In the old version of Fabric, a file was included that created an alias definition for each Fabric pattern call and made these aliases available through the initialization of the .zshrc file. Since the new version no longer provides this functionality, I have recreated it as a shell script. In this example, as a German speaker, I added the context file from above to ensure that all output is in German.\n#!/bin/bash # Fixed path to the directory to be scanned input_dir=\u0026#34;$HOME/.config/fabric/patterns\u0026#34; # Check if the path is a valid directory if [ ! -d \u0026#34;$input_dir\u0026#34; ]; then echo \u0026#34;The directory $input_dir does not exist or is not a valid directory.\u0026#34; exit 1 fi # Filename for the .inc file output_file=\u0026#34;$HOME/.config/fabric/fabric-bootstrap.inc\u0026#34; # Initialize the .inc file echo \u0026#34;# Automatically generated aliases\u0026#34; \u0026gt; \u0026#34;$output_file\u0026#34; # Loop through the subdirectories in the specified directory for dir in \u0026#34;$input_dir\u0026#34;/*/; do # Check if it is indeed a directory if [ -d \u0026#34;$dir\u0026#34; ]; then # Remove the trailing slash and the path to get only the folder name folder_name=$(basename \u0026#34;$dir\u0026#34;) # Create an alias in the form: alias foldername=\u0026#34;fabric -sp foldername\u0026#34; echo \u0026#34;alias $folder_name=\\\u0026#34;fabric -C=german -sp $folder_name\\\u0026#34;\u0026#34; \u0026gt;\u0026gt; \u0026#34;$output_file\u0026#34; fi done echo \u0026#34;The file $output_file was successfully created.\u0026#34; Next, add the following entry at the end of your ~/.zshrc file:\n# Created by `Fabric Installation` on 2024-08-06 12:45:30 if [ -f \u0026#34;/Users/leifjp/.config/fabric/fabric-bootstrap.inc\u0026#34; ]; then . \u0026#34;/Users/leifjp/.config/fabric/fabric-bootstrap.inc\u0026#34;; fi Activate the new .zshrc with:\nsource ~/.zshrc Now, a command like:\nwget -qO- https://example.com/my-blog-article | pandoc -f html -t plain | summarize will output the summary in German instead of requiring:\nwget -qO- https://example.com/my-blog-article | pandoc -f html -t plain | fabric -sp summarize This approach works with any pattern without needing modification. Of course, you can also add additional general instructions to the context file.\nConclusion and Outlook # I hope this brief introduction to Fabric makes getting started a bit easier. In a future post, I will demonstrate how to further simplify the use of Fabric and how it can be integrated with Apple’s Shortcuts.\nIf you have any questions, feedback, or ideas regarding Fabric and its installation, please feel free to use the comments section.\n","date":"August 24, 2024","externalUrl":null,"permalink":"/2024/08/24/installation-and-getting-started-with-fabric-the-prompt-optimizer/","section":"Posts","summary":"Introduction to Fabric # The quality of results when using Large Language Models (LLMs) like Ollama or ChatGPT heavily depends on the quality of the prompts used. This understanding has led to the emergence of specialized professions like Prompt Engineers, whose task is to configure LLMs optimally to achieve the best possible results for specific requirements or contexts. In addition, hundreds of articles have been published with promising titles like “The 100 Best Prompts for Generating a Job Application for a Top-Manager Position.”\n","title":"Installation and Getting Started with Fabric – The Prompt Optimizer","type":"posts"},{"content":"","date":"August 24, 2024","externalUrl":null,"permalink":"/tag/ollama/","section":"Tags","summary":"","title":"Ollama","type":"tags"},{"content":"","date":"August 24, 2024","externalUrl":null,"permalink":"/tag/techtools/","section":"Tags","summary":"","title":"TechTools","type":"tags"},{"content":"As a German blogger who sometimes writes English articles with screenshots from apps in English, it was always a little cumbersome to switch the whole system to English to get these screenshots. But meanwhile, there is another solution for this problem. You can change the language for single applications to another language, as long as other languages are supported by the app.\nIn the System Settings, you can find under General → Language \u0026amp; Region, in the lower group, the single entry “Applications.” Press the +-Button, and now you can add an application and choose a different language, as long as the app supports different languages:\nOnly the languages supported by the application are displayed in the menu. If no other language is supported, this will be indicated. However, there might be languages that appear here even though the language resources are not fully implemented by the application. Obsidian is a bad example of this, as the Arabic setting only switches from right to left - at least it does this. If you accept the change of language, the application will restart and from now on, it will start with that language until you choose another one or delete the entry in the list.\nYou may have noticed that the drop-down box with the languages is in German, although the user interface of the system extensions in the background is in English. The reason for this is that I switched the system extensions to English for this screenshot, but it didn’t change every UI element. Nevertheless, switching the language works even if “System Settings” do not appear in the list of applications in the language settings.\nThis is possible because you can also switch the application languages on the command line:\nopen -a System\\ Settings --args -AppleLanguages \u0026#39;(en)\u0026#39; Additional Remarks # Terminate Running Applications: If the application does not appear in the desired UI language, it may still be running in the background. Terminate the application before executing the command to change its language. Using Language Abbreviations: Programs can be started in other supported languages by replacing the abbreviation ‘(en)’ with the corresponding country code, e.g., ‘(fr)’ for French or ‘(dk)’ for Danish. Temporary Language Change: Changing the application language using this method is only temporary. After closing and restarting the app, it will start again in the language set in macOS. Apple Shortcuts App: The action names in the Apple Shortcuts app are displayed in the language you choose. If you are doing this from a non-English macOS setting, you need to call the apps by their English names. With Apple applications, you can assume that they support all necessary languages. For other apps, you can use the terminal:\nls -d /Applications/Pages.app/Contents/Resources/*lproj This lists all supported languages like this:\n/Applications/Pages.app/Contents/Resources/de.lproj The deat en.lprojis the country code for Germany, which can then be used with one of the two command line variants:\nopen -a Pages --args -AppleLanguages \u0026#39;(de)\u0026#39; or\nopen -a /Applications/Pages.app --args -AppleLanguages \u0026#39;(de)\u0026#39; Attention: It is essential to ensure that there is only one space before the country code, otherwise the application will not start in the other language!\nIf you are looking for one of the standard Apple applications, most of them are now stored in /System/Applications\nShortcuts make life easier # If you are like me, writing and discussing about one specific application not only in another languages as the macOS language, then all these approaches are still too complicated, so why not using a shortcut?\nIn my case this app is the Shortcut app, so I have a shortcut to switch it to English:\nThere are only two actions needed:\nQuit the App Run Shell Script In the shortcut “Detail,” I switch the “Pin in Menu Bar” on. You can also assign a keyboard shortcut as you wish.\nIn the case of changing the Shortcut app language, you can’t use the play button in the app, it doesn’t work.\nThat’s all for now. I would be very happy if you would leave criticism, comments, and suggestions in the comments. Thanks.\n","date":"June 17, 2024","externalUrl":null,"permalink":"/2024/06/17/starting-a-mac-app-in-a-different-language/","section":"Posts","summary":"As a German blogger who sometimes writes English articles with screenshots from apps in English, it was always a little cumbersome to switch the whole system to English to get these screenshots. But meanwhile, there is another solution for this problem. You can change the language for single applications to another language, as long as other languages are supported by the app.\n","title":"Starting a Mac App in a different language","type":"posts"},{"content":"","date":"June 15, 2024","externalUrl":null,"permalink":"/tag/launchd/","section":"Tags","summary":"","title":"launchd","type":"tags"},{"content":"On the German side of my blog, I wrote three articles about using launchd as a scheduler for shortcuts, creating a 1-click shortcut to sync a folder from a Mac to a Synology NAS using rsync, and in the third using rsync and launchd to schedule a backup that includes saving deleted files from the source to a special folder on the Synology NAS. In this article, I will combine these topics into one guide.\nI will explain how to use rsync to save a copy on another server, specifically a Synology NAS. I will show you how to turn this shell command into a shortcut, and finally, how to extent it into a real backup solution that runs periodically using the launchd framework on macOS.\nLet’s start with the basic rsync command creation.\nSSH and Rsync Setup # To copy the Obsidian Vault, the rsync command with ssh as the transfer protocol is used. Therefore, it is necessary to enable ssh on both the Mac and the Synology NAS.\nOn macOS, ssh is usually installed by default. If not, it can be easily installed via Homebrew. There are plenty of instructions available online if assistance is needed.\nOn the Synology side, rsync must be enabled via the Synology Control Panel:\nOnce ssh is set up on both the Mac and the Synology, test the connection. Depending on the router setup, the Synology can be accessed using an internal hostname like synology.lan or a fixed IP address. It is recommended to use a fixed IP address. In this case, the Synology is reachable at 192.168.1.80. To test the connection:\nssh user:password@192.168.1.80 If the username on both the Mac and Synology is the same, use:\nssh 192.168.1.80 The first time you log on, the following message will appear:\nThe authenticity of host \u0026#39;192.168.1.80 (192.168.1.80)\u0026#39; can\u0026#39;t be established. ED25519 key fingerprint is SHA256:yourkeyhere. This key is not known by any other names. Are you sure you want to continue connecting (yes/no/[fingerprint])? Warning: Permanently added \u0026#39;192.168.1.80\u0026#39; (ED25519) to the list of known hosts. leif@192.168.1.80\u0026#39;s password: This is a security feature because the Mac has no prior record of the server’s public key. Answering “yes” stores this public key in the ~/.ssh/known-hosts file. This helps prevent man-in-the-middle attacks by identifying the server. If another machine uses the same IP address and presents a different key, SSH will warn about the key mismatch and prevent the connection. After confirming with “yes,” the Synology password is required for login. After entering the password, the following text may appear:\nUsing terminal commands to modify system configs, execute external binary files, add files, or install unauthorized third-party apps may lead to system damages or unexpected behavior, or cause data loss. Make sure you are aware of the consequences of each command and proceed at your own risk. Warning: Data should only be stored in shared folders. Data stored elsewhere may be deleted when the system is updated/restarted. leif@192.168.1.80:~$ Type exit to return to the Mac in your terminal session.\nThis is the basic setup to access the Synology with ssh. However, typing the password every time can be inconvenient, especially for script access. Additional steps are needed to enable passwordless access.\nStep 1: Creating a Public and Private Key Pair for Server Access # Using keys for server access enhances security and enables the automatic login needed for scripts. Setting up a key pair is easy:\nssh-keygen -a 420 -f ~/.ssh/synology-tutorial.ed25519 -C \u0026#34;My Synology Tutorial key\u0026#34; This generates the key pair:\nPrivate Key: ~/.ssh/synology-tutorial.ed25519\nPublic Key: ~/.ssh/synology-tutorial.ed25519.pub\nThe -a 420 option sets the number of key derivation function rounds to 420, enhancing security by making it harder for an attacker to brute-force the passphrase.\nThe -f ~/.ssh/synology-tutorial.ed25519 option specifies the location and name of the private key. The public key will be saved with the same name and location, but with a .pub extension.\nThe -C \u0026quot;My Synology Tutorial key\u0026quot; option adds a comment to the key, making it easier to identify the key’s purpose or the owner when viewing the public key file.\nDuring key generation, the command will prompt for setting a passphrase. It is recommended to set a passphrase different from your Mac or server password for added security. A passphrase can be longer and more complex than a typical password (e.g. it can also contains spaces). It is recommended to use a strong, unique passphrase to maximize security.\nAlthough it is possible to use a single key pair for multiple servers, creating a specific key pair for each server makes managing access easier and allows revocation of a key pair for one server without invalidating connections to others.\nStep 2: Copying the public key to the server # As the next step, the public key needs to be copied to the server:\nssh-copy-id -i ~/.ssh/synology-tutorial.ed25519.pub 192.168.1.80 The -i option specifies the key that should be copied to the server. Because the username on the Mac is the same as on the Synology, there is no need to specify the username in the command. If the usernames differ, use user@192.168.1.80 to specify the username. You will be asked for the users password on the server, not for the passphrase you defined when generating the keys.\nNow it’s time to check if everything is working:\nssh -i ~/.ssh/synology-tutorial.ed25519 192.168.1.80 This command will prompt for the passphrase set during key generation and should allow login without asking for the server’s password. However, this still substitutes a password with a possibly more complex passphrase. In the next step, the process of logging into the Synology using an alias and without any credentials will be explained.\n3. Creating a ssh-config file # Creating an SSH config file centralizes the management of SSH connections. It simplifies connections and eliminates the need to repeatedly enter passwords or passphrases, which is especially useful when using SSH in scripts. For example:\nssh synology can be used in scripts instead of full connection details.\nHere is the SSH config used for this article:\nHost synology HostName 192.168.1.80 AddKeysToAgent yes UseKeychain yes User leif PreferredAuthentications publickey IdentityFile ~/.ssh/synology-tutorial.ed25519 Host synology: Defines an alias for this configuration, allowing connection to the Synology using the alias instead of the full hostname or IP address. HostName: Specifies the actual hostname or IP address of the Synology. This tells the SSH client where to connect. AddKeysToAgent yes: Adds the key passphrase to the SSH authentication agent (ssh-agent) when the configuration is first used. UseKeychain yes: A macOS-specific option to store the passphrase in the keychain. This is convenient on a Mac, as the ssh-agent only stores the passphrase during the session, while UseKeychain stores it across sessions. User leif: Specifies the username to use when connecting to the Synology. PreferredAuthentications publickey: Specifies the authentication method to use. In this case, it should be publickey. IdentityFile ~/.ssh/synology-tutorial.ed25519: Specifies the private key file to use for authentication. Before testing this configuration, there is one more command that might be helpful because it will explicitly store the passphrase to the keychain and ssh-agent:\nssh-add --apple-use-keychain ~/.ssh/synology-tutorial.ed25519 Now, its possible to test the connection with the alias:\nssh synology Possible Issue: Permissions\nDuring a test on a fresh copy of macOS on a virtual machine, I encounter an issue that was not present on my working Mac set up previously:\n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: UNPROTECTED PRIVATE KEY FILE! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ Permissions 0644 for \u0026#39;/Users/leif/.ssh/synology-tutorial.ed25519.pub\u0026#39; are too open. It is required that your private key files are NOT accessible by others. This private key will be ignored. After some research, it was found that the permissions were not set correctly. The fix was to change the permissions for the folder:\nchmod 700 ~/.ssh and for all files inside the folder:\nchmod 600 ~/.ssh/* After applying these fixes, everything should work correctly.\nThe Backup Script # For the backup script, I have the following requirements:\n1. rsync Command # Choose rsync because it:\nSynchronize two folders by only copying changes and preserves all file and folder attributes. Synchronize files and folder from a local machine to a server. Delete files and folders in the destination that were deleted in the source, using the \u0026ndash;delete option. Archive deleted files and folders in backup folders. 2. Backup Structure # The folder tree inside the Synology Home-folder should look like this. Besides the folder with the current Obsidian Vault, there are backup folders named using the format yyyy-mm-dd_hh-mm-ss:\nmyVault/ ├── 2024-06-08_16-06-49 ├── 2024-06-08_17-06-49 ├── 2024-06-08_18-06-49 └── current 3. Logging # Log each rsync execution with a timestamp, command output, and error messages in a log file (/tmp/myVault.log). 4. Limited Number of backup folders # If the number of backups exceeds a defined limit, delete the oldest backups to conserve storage space. 5. 7. Conditional Execution # The backup script should only run if the Synology NAS is reachable. If the NAS is not reachable (e.g., not connected to the local network), the script should exit without attempting to run the backup or delete old backups. Complete Backup Script # Here is the complete script for backing up the Obsidian Vault folder to a Synology NAS:\n#!/bin/bash # Check if Synology NAS is reachable if ping -c 1 192.168.1.80 \u0026amp;\u0026gt; /dev/null; then # Log the start of the backup echo -e \u0026#34;\\n\\n$(date +\u0026#34;%Y-%m-%d %H:%M:%S\u0026#34;)\u0026#34; \u0026gt;\u0026gt; /tmp/myVault.log # Define backup variables SOURCE=\u0026#34;/Users/leif/Documents/10 Obsidian/myVault/\u0026#34; DESTINATION=\u0026#34;synology:/volume1/homes/leif/myVault/current\u0026#34; BACKUP_DIR_BASE=\u0026#34;/volume1/homes/leif/myVault\u0026#34; MAX_BACKUPS=30 TIMESTAMP=$(date +%Y-%m-%d_%H-%M-%S) BACKUP_DIR=\u0026#34;${BACKUP_DIR_BASE}/${TIMESTAMP}\u0026#34; # Run rsync with backup options rsync -avz --delete --backup --backup-dir=\u0026#34;${BACKUP_DIR}\u0026#34; --exclude=\u0026#39;.DS_Store\u0026#39; --filter \u0026#39;P @eaDir/\u0026#39; -e ssh \u0026#34;$SOURCE\u0026#34; \u0026#34;$DESTINATION\u0026#34; \u0026gt;\u0026gt; /tmp/myVault.log 2\u0026gt;\u0026amp;1 # Check number of backup folders and delete oldest if necessary BACKUP_COUNT=$(ssh synology \u0026#34;ls -1 ${BACKUP_DIR_BASE} | grep -E \u0026#39;^[0-9]{4}-[0-9]{2}-[0-9]{2}_[0-9]{2}-[0-9]{2}-[0-9]{2}$\u0026#39; | wc -l\u0026#34;) if [ \u0026#34;$BACKUP_COUNT\u0026#34; -gt \u0026#34;$MAX_BACKUPS\u0026#34; ]; then echo \u0026#34;The number of backups ($BACKUP_COUNT) exceeds the maximum ($MAX_BACKUPS). The oldest backups will be deleted.\u0026#34; \u0026gt;\u0026gt; /tmp/myVault.log ssh synology \u0026#34;ls -1 ${BACKUP_DIR_BASE} | grep -E \u0026#39;^[0-9]{4}-[0-9]{2}-[0-9]{2}_[0-9]{2}-[0-9]{2}-[0-9]{2}$\u0026#39; | sort | head -n -${MAX_BACKUPS} | xargs -I {} rm -rf ${BACKUP_DIR_BASE}/{}\u0026#34; \u0026gt;\u0026gt; /tmp/myVault.log 2\u0026gt;\u0026amp;1 fi else # Log if server is not reachable echo \u0026#34;SERVER is not reachable. Backup will not be performed.\u0026#34; \u0026gt;\u0026gt; /tmp/myVault.log fi The Script Line-by-Line Breakdown # if ping -c 1 192.168.1.80 \u0026amp;\u0026gt; /dev/null; then This line checks if the Synology NAS is reachable by sending one ICMP packet (ping) to the IP address 192.168.1.80. If the NAS responds, the script continues; otherwise, it exits. The if-clause evaluates the return code of the ping command: when the ping gets a response, the return code is 1 (true); if not, the return code is 0 (false).\necho -e \u0026#34;\\n\\n$(date +\u0026#34;%Y-%m-%d %H:%M:%S\u0026#34;)\u0026#34; \u0026gt;\u0026gt; /tmp/myVault.log This line logs the current date and time to /tmp/myVault.log, indicating when the backup process started. To structure the log, this command writes two newlines before the timestamp. All other log entries will written directly behind the previous line.\nSOURCE=\u0026#34;/Users/leif/Documents/10 Obsidian/myVault/\u0026#34; DESTINATION=\u0026#34;synology:/volume1/homes/leif/myVault/current\u0026#34; BACKUP_DIR_BASE=\u0026#34;/volume1/homes/leif/myVault\u0026#34; MAX_BACKUPS=30 TIMESTAMP=$(date +%Y-%m-%d_%H-%M-%S) BACKUP_DIR=\u0026#34;${BACKUP_DIR_BASE}/${TIMESTAMP}\u0026#34; These lines define the source directory (SOURCE), the destination directory on the Synology NAS (DESTINATION), the base directory for backups (BACKUP_DIR_BASE), the maximum number of backups to keep (MAX_BACKUPS), and the timestamp format for backup directories (TIMESTAMP and BACKUP_DIR).\nrsync -avz --delete --backup --backup-dir=\u0026#34;${BACKUP_DIR}\u0026#34; --exclude=\u0026#39;.DS_Store\u0026#39; --filter \u0026#39;P @eaDir/\u0026#39; -e ssh \u0026#34;$SOURCE\u0026#34; \u0026#34;$DESTINATION\u0026#34; \u0026gt;\u0026gt; /tmp/myVault.log 2\u0026gt;\u0026amp;1 This line runs rsync with the following options:\n-a: Archive mode to preserve file attributes. -v: Verbose mode to log detailed output. -z: Compress data during transfer. --delete: Delete files from the destination that have been deleted from the source. --backup: Enable backups of deleted files. --backup-dir=\u0026quot;${BACKUP_DIR}\u0026quot;: Specify the backup directory for deleted files. --exclude='.DS_Store': Exclude .DS_Store files from the backup. --filter 'P @eaDir/': Protect the @eaDir directory from being deleted. This directory is created by the Universal Search on the Synology. Since it’s not part of the source directory, it would otherwise always be deleted, and it contains a lot of files, so this would take time during every run of the script. -e ssh: Use SSH for data transfer. \u0026quot;$SOURCE\u0026quot; and \u0026quot;$DESTINATION\u0026quot;: Source and destination directories. The output and any errors are appended to /tmp/myVault.log.\nBACKUP_COUNT=$(ssh synology \u0026#34;ls -1 ${BACKUP_DIR_BASE} | grep -E \u0026#39;^[0-9]{4}-[0-9]{2}-[0-9]{2}_[0-9]{2}-[0-9]{2}-[0-9]{2}$\u0026#39; | wc -l\u0026#34;) if [ \u0026#34;$BACKUP_COUNT\u0026#34; -gt \u0026#34;$MAX_BACKUPS\u0026#34; ]; then echo \u0026#34;The number of backups ($BACKUP_COUNT) exceeds the maximum ($MAX_BACKUPS). The oldest backups will be deleted.\u0026#34; \u0026gt;\u0026gt; /tmp/myVault.log ssh synology \u0026#34;ls -1 ${BACKUP_DIR_BASE} | grep -E \u0026#39;^[0-9]{4}-[0-9]{2}-[0-9]{2}_[0-9]{2}-[0-9]{2}-[0-9]{2}$\u0026#39; | sort | head -n -${MAX_BACKUPS} | xargs -I {} rm -rf ${BACKUP_DIR_BASE}/{}\u0026#34; \u0026gt;\u0026gt; /tmp/myVault.log 2\u0026gt;\u0026amp;1 fi These lines perform the following actions:\nCount the number of existing backup folders in BACKUP_DIR_BASE that match the timestamp format. If the count exceeds MAX_BACKUPS, log a message indicating that the oldest backups will be deleted. Delete the oldest backups, retaining only the latest MAX_BACKUPS folders. There is a little unix (pipe) magic involved, eg. the script call a function on the Synology and store the result in a variable inside the script on the Mac. It pipes the result of an ls command to an grep, that filters with a regex expression only the directory that follow the backup naming convention, and then count the number of lines aka number of backup folder.\nin the second part, if there are more then $MAX_BACKUPS, filters the folders again, sorts them by name and thus by age), deletes all newer folder names from the list, and then pipes the result to a command that deletes the folders by adding each list item to an rm -rf command.\nelse echo \u0026#34;SERVER is not reachable. Backup will not be performed.\u0026#34; \u0026gt;\u0026gt; /tmp/myVault.log fi This handles the else part If the Synology NAS is not reachable. It log a message indicating that the backup will not be performed.\nSaving and Running the Script # 1. Save the Script # Save the script in your personal Applications folder ~/Applications as, for example, backup.sh, and make it executable with the following command:\nchmod +x ~/Applications/backup.sh 2. Create an Empty Log File # Create an empty log file to store the script’s output:\ntouch /tmp/myVault.log 3. Run the Script # You can now run the script:\n~/Applications/backup.sh 4. Check the Log # Check the log to ensure everything runs smoothly without any errors.\ncat /tmp/myVault.log During the first run, all files will be copied to your Synology, resulting in a long list of messages. For subsequent runs, the script will only log changes, so it might be a good idea to delete the log after the first run if everything was fine and then create a new one.\nCreating a 1-Click Backup Solution with Apple Shortcuts # Now we have a script that works very well when called in the terminal. To create a 1-click backup solution, we can integrate this script into an Apple Shortcut.\nSo, my first Idea was to copy the script into a “Run Shell Script” action within an Apple Shortcut:\nThis works fine, when pressing the play button in the shortcut app. However, if executed via the menu bar, you may encounter error messages in the log file, such as\nrsync error: some files could not be transferred (code 23) at /AppleInternal/Library/BuildRoots/91a344b1-f985-11ee-b563-fe8bc7981bff/Library/Caches/com.apple.xbs/Sources/rsync/rsync/main.c(996) [sender=2.6.9] It took some time to find the cause of this error. The “Shortcuts” application had been given the necessary permissions to edit “Files and folders” or “Full disk access” in the system settings under “Privacy and security”. Therefore, the script could run within this application. However, a shortcut called from the menu bar no longer runs in the Shortcuts application and should therefore be given these permissions itself. But this isn\u0026rsquo;t possible anymore, because Apple allows only real applications to have these permissions. The solution is to encapsulate the script in an application using Automator, Apple Script Editor, or Platypus, which I found in this article: launchd - How to run a LaunchAgent that runs a script which…\nI decided to go with Automator to turn the script into a application:\nOpen Automator: Start Automator and create a new document. Select Document Type: Choose “Application” as the document type. Add Action: Search for the action “Run Shell Script”. Copy Script: Copy the script into the “Run Shell Script” action. Save the Application: Save the result in ~/Applications as, for example, ObsidianBackup. After saving the script in Automator as application, grant it the necessary permissions in the “Privacy \u0026amp; Security” System Settings:\nGo to “System Preferences” \u0026gt; “Security \u0026amp; Privacy” \u0026gt; “Privacy”. Select “Files and Folders” and add the application again. You can also simply click the application icon twice. Normally, you will be asked to allow access to the specific folder, in this case, Documents.\nBy following these instructions, the script can be executed with a single click using Apple Shortcuts, ensuring it runs smoothly and with the necessary permissions.\nCreate an empty new shortcut an add only one action \u0026ldquo;Open App\u0026rdquo;. Choose ObsidianBackup as app. Done! If the app is not in the drop-down menu, start the app once by clicking the icon. You might also need to restart the Shortcuts app, but then the app should appear in the menu.\nWith that, the backup can just be started with a click on the Shortcuts menu.\nBTW, I was wondering why all my other shortcuts which manipulate Obsidian notes run without any permission problems, as well as some Python scripts I run via the Alfred app. This is because these operations run inside apps which I have allowed to manipulate files or folders with the necessary permissions\nCreating a Launchd \u0026lsquo;plist\u0026rsquo; File # Now we can back up the Obsidian Vault or any other folder with a click in the menu bar. But how can we run the script automatically, e.g., every hour? The solution for running scripts periodically on macOS is the launchd system and service manager. launchd uses property list (plist) files to define services, specifying details like when they should start, their run conditions, and any dependencies. Here’s the plist file to run the ObsidianBackup.app every hour:\n\u0026lt;?xml version=\u0026#34;1.0\u0026#34; encoding=\u0026#34;UTF-8\u0026#34;?\u0026gt; \u0026lt;!DOCTYPE plist PUBLIC \u0026#34;-//Apple//DTD PLIST 1.0//EN\u0026#34; \u0026#34;http://www.apple.com/DTDs/PropertyList-1.0.dtd\u0026#34;\u0026gt; \u0026lt;plist version=\u0026#34;1.0\u0026#34;\u0026gt; \u0026lt;dict\u0026gt; \u0026lt;key\u0026gt;Label\u0026lt;/key\u0026gt; \u0026lt;string\u0026gt;com.leif.ObsidianBackup\u0026lt;/string\u0026gt; \u0026lt;key\u0026gt;ProgramArguments\u0026lt;/key\u0026gt; \u0026lt;array\u0026gt; \u0026lt;string\u0026gt;/usr/bin/open\u0026lt;/string\u0026gt; \u0026lt;string\u0026gt;-W\u0026lt;/string\u0026gt; \u0026lt;string\u0026gt;/Users/leif/Applications/ObsidianBackup.app\u0026lt;/string\u0026gt; \u0026lt;/array\u0026gt; \u0026lt;key\u0026gt;RunAtLoad\u0026lt;/key\u0026gt; \u0026lt;true/\u0026gt; \u0026lt;key\u0026gt;StartInterval\u0026lt;/key\u0026gt; \u0026lt;integer\u0026gt;3600\u0026lt;/integer\u0026gt; \u0026lt;/dict\u0026gt; \u0026lt;/plist\u0026gt; Save this file as ~/Library/LaunchAgents/com.leif.ObsidianBackup.plist. This ensures that the backup task will only run when you are logged in with your user account. The name of the plist file and the Label key should be the same. The ProgramArguments key defines the command line with which our ObsidianBackup app will be executed. Each part of the command line, separated by a space, is an item in the array. Although we save it as ObsidianBackup, the name at the command line level is ObsidianBackup.app. The RunAtLoad key instructs launchd to start the program when you log in, and the StartInterval defines the time between runs of the backup in seconds.\nNow start the service with:\nlaunchctl load ~/Library/LaunchAgents/com.leif.ObsidianBackup.plist You can check if the service is running with:\nlaunchctl list | grep com.leif.ObsidianBackup and by looking into the log file /tmp/myVault.log. If something goes wrong, you can stop the job with:\nlaunchctl unload ~/Library/LaunchAgents/com.leif.ObsidianBackup.plist If you want to delete the service, first unload it and then delete the file:\nrm ~/Library/LaunchAgents/com.leif.ObsidianBackup.plist Conclusions and open questions # With this setup, you should be able to easily run an hourly backup of your Obsidian Vault or any other folder on your Mac.\nDuring the development of the script, with some help from ChatGPT 4o, I encountered two issues that I haven’t resolved yet.\nSpaces in Folder Paths: I usually make my backups in the folder /volume1/home/leif/98 Backups, but I had issues with the space in the folder name when using variables for the DESTINATION and BACKUP_DIR_BASE. To work around this, I created a folder without spaces on my Synology home directory.\nPermissions with Dedicated Shared Folder: Due to the problem mentioned above and the issue with @eaDir, I tried creating a dedicated shared folder that would not be indexed by “Universal Search”. However, I encountered some permissions problems. Despite setting all permissions correctly (as far as I understood), the permissions issues persisted. As result I stay with the solution with a folder with no spaces in my Synology home directory.\nIf anyone has tips for solving these issues, they would be greatly appreciated.\nAdditional Considerations\n• Excluding the .obsidian Folder:\nThe current script copies the .obsidian settings folder as well. Most changes occur in this folder while working in Obsidian, so it might be a good idea to skip this folder. The notes are the critical data to save, while settings and plugins can be reinstalled if necessary.\n• Adjusting MAX_BACKUPS**:**\nThe MAX_BACKUPS=30 value is just a guess and should be adjusted according to your specific needs.\nFeel free to add any comments, corrections, or criticisms.\n","date":"June 15, 2024","externalUrl":null,"permalink":"/2024/06/15/periodic-backup-of-a-mac-folder-on-a-synology-nas/","section":"Posts","summary":"On the German side of my blog, I wrote three articles about using launchd as a scheduler for shortcuts, creating a 1-click shortcut to sync a folder from a Mac to a Synology NAS using rsync, and in the third using rsync and launchd to schedule a backup that includes saving deleted files from the source to a special folder on the Synology NAS. In this article, I will combine these topics into one guide.\n","title":"Periodic Backup of a Mac Folder on a Synology NAS","type":"posts"},{"content":"To test the new ChatGPT 4.0, I wanted to create a shortcut that would save my Obsidian Vault to my Synology NAS at the push of a button. Once we had a solution, I wondered why this backup process shouldn\u0026rsquo;t be automated and periodic.\nChatGPT 4.0 suggested using a shell script called via the launchd system service to run the shortcut. launchd automatically starts programs or scripts on a schedule. While it might seem over-engineered to wrap a command-line command in a shortcut and then call it via a shell script, I found the process interesting. Since there\u0026rsquo;s not much information available online, I created this general guide.\nStep 1: Creating a shortcut # For this article, I have created a very simple shortcut that displays the current time in the notification center:\nI have slightly adapted the output format for the date, as can be seen on the screenshot.\nYou can now test in the terminal whether the shortcut works as desired:\nshortcuts run notify You should see the current time as notification.\nOnce this has worked, the second step can be tackled.\nStep 2: Create a Shell Script # To execute the short command with launchd, it is easiest to wrap the call in a shell script that looks like this:\n#!/bin/bash /usr/bin/shortcuts run notify I saved this shell script as notify.sh in the folder /User/leif/Applications and make it executable:\nchmod +x /User/leif/Applications/notify.sh Step 3: Create a launchd plist File # A plist file is required to start the script with launchd. This file must be created in the directory ~/Library/LaunchAgents. For my example it looks like this:\n\u0026lt;?xml version=\u0026#34;1.0\u0026#34; encoding=\u0026#34;UTF-8\u0026#34;?\u0026gt; \u0026lt;!DOCTYPE plist PUBLIC \u0026#34;-//Apple Computer//DTD PLIST 1.0//EN\u0026#34; \u0026#34;http://www.apple.com/DTDs/PropertyList-1.0.dtd\u0026#34;\u0026gt; \u0026lt;plist version=\u0026#34;1.0\u0026#34;\u0026gt; \u0026lt;dict\u0026gt; \u0026lt;key\u0026gt;Label\u0026lt;/key\u0026gt; \u0026lt;string\u0026gt;com.leif.notify.plist\u0026lt;/string\u0026gt; \u0026lt;key\u0026gt;ProgramArguments\u0026lt;/key\u0026gt; \u0026lt;array\u0026gt; \u0026lt;string\u0026gt;/Users/leif/Applications/notify.sh\u0026lt;/string\u0026gt; \u0026lt;/array\u0026gt; \u0026lt;key\u0026gt;StartInterval\u0026lt;/key\u0026gt; \u0026lt;integer\u0026gt;15\u0026lt;/integer\u0026gt; \u0026lt;key\u0026gt;RunAtLoad\u0026lt;/key\u0026gt; \u0026lt;true/\u0026gt; \u0026lt;key\u0026gt;StandardOutPath\u0026lt;/key\u0026gt; \u0026lt;string\u0026gt;/tmp/notify.log\u0026lt;/string\u0026gt; \u0026lt;key\u0026gt;StandardErrorPath\u0026lt;/key\u0026gt; \u0026lt;string\u0026gt;/tmp/notify.err\u0026lt;/string\u0026gt; \u0026lt;/dict\u0026gt; \u0026lt;/plist\u0026gt; Explanation of the entries:\nLabel: The name of the job. ProgramArguments: The path to the shell script that runs the shortcut. RunAtLoad: Ensures the job is loaded into the job list at login. StartInterval: The interval in seconds at which the job runs (here: 15 seconds). StandardOutPath/StandardErrorPath: Paths to the files for logging output information. Step 4: Start the Job # With the following command, the plist file is registered with launchd, so the job can be started:\nlaunchctl load ~/Library/LaunchAgents/com.leif.notify.plist After that, the job can be started, which usually happens at system startup due to the RunAtLoad parameter:\nlaunchctl start com.leif.notify.plist To check if the job is running, type this:\nlaunchctl list | grep com.leif.notify.plist If something doesn\u0026rsquo;t work, you can find relevant information in the log files defined above.\nSome additional notes: # To stop a job, it can be \u0026ldquo;unloaded\u0026rdquo; with the following command:\nlaunchctl unload ~/Library/LaunchAgents/com.leif.notify.plist This command stops the job and removes it from the list of active launchd jobs.\nAfterward, the job can be completely deleted with the command:\nrm ~/Library/LaunchAgents/com.leif.notify.plist It is recommended to make a backup of the plist file beforehand.\nFor more configuration options, such as running a job at a specific time, refer to resources like A launchd Tutorial or the detailed About Daemons and Services.\nConclusion # I hope this guide has been helpful and inspiring for further ideas. I will present my solution for backing up my vault, which will run without using Shortcuts, in another post. If you have any errors to report, additions, or other remarks, feel free to leave a comment.\n","date":"May 16, 2024","externalUrl":null,"permalink":"/2024/05/16/periodic-execution-of-apple-shortcuts-with-launchd/","section":"Posts","summary":"To test the new ChatGPT 4.0, I wanted to create a shortcut that would save my Obsidian Vault to my Synology NAS at the push of a button. Once we had a solution, I wondered why this backup process shouldn’t be automated and periodic.\n","title":"Periodic Execution of Apple Shortcuts with launchd","type":"posts"},{"content":"For bookmarking websites during my information research, I increasingly move from tools like Instapaper and Omnivore to Obsidian as the place to save and organize my bookmarks.\nIn this article, I want to show a few solutions using Apple Shortcut together with the Shortcut extension \u0026ldquo;Actions for Obsidian\u0026rdquo; from Carlo Zottman. These range from a simple one-line bookmarks to slightly more complex methods that also save a selection from within a browser window. Let\u0026rsquo;s start with the simple one.\n1. Simple Bookmark # The first shortcut just adds a line which consist only of the creation date and the clickable title plus a empty line at the top of a dedicated Obsidian note, in my case \u0026ldquo;98 Administration/Bookmarked/Bookmarks\u0026rdquo;.\nThe shortcut workflow includes several actions:\nReceive URLs and Articles input from \u0026ldquo;What\u0026rsquo;s On Screen\u0026rdquo;. If no content is found, the shortcut will Stop and Respond with \u0026ldquo;No Content to capture\u0026rdquo;. Get Article from Shortcut Input: It captures an article from the provided input. Set variable url to URL: This action assigns the URL of the article in the variable url. Set variable title to Name: This stores the article\u0026rsquo;s name in the variable title. Current Date: Captures the current date. Text: Constructs a text string that includes the date, title, and URL. Prepend Text to note: Adds this constructed text to a specific note titled \u0026ldquo;98 Administration/Bookmarked/Bookmarks\u0026rdquo; in the \u0026ldquo;ObsidianNotes\u0026rdquo; vault after the headline \u0026ldquo;#### Bookmarks\u0026rdquo;, ensuring it starts on a new line and focuses on the Bookmarks at the end, which makes Obsidian active. This last action is part of the \u0026ldquo;Actions for Obsidian\u0026rdquo; extension, which integrates seamlessly with the shortcut to activate Obsidian. The Bookmarks file needs to have the headline \u0026ldquo;#### Bookmarks\u0026rdquo; as a marker, so the actions find the place to include the bookmark just captured. You can use any headline and size you prefer. Ideally, I would prefer an invisible marker, which is achievable in Markdown using syntax like %%text%%; however, the \u0026ldquo;Actions for Obsidian\u0026rdquo; extension supports only headlines for this purpose.\n2. Bookmark with Preview Image and Excerpt # In a lot of case, the first bookmarking style might be enough, but I also love to have some more context about the web pages, that I had bookmarked later on. Therefore, I developed a second style that captures both an image and the excerpt. This approach is particularly useful for visual referencing and quick content review, enabling me to recall the essence of the web page without needing to revisit it immediately.\nTo achieve such a layout, the use of a table is obvious. Unfortunately, Markdown does not offer the possibility to create the required structure at this point. Fortunately, you can also simply use an HTMl table directly. With one restriction, which I will explain below.\nNext code shows the HTML-Template:\n\u0026lt;table style=\u0026#34;border: none; border-collapse: collapse;\u0026#34;\u0026gt; \u0026lt;tr\u0026gt; \u0026lt;td style=\u0026#34;font-size: 1.2em; font-weight: bold; padding-left: 10px; padding-right: 10px;\u0026#34;\u0026gt; [DATUM] \u0026lt;/td\u0026gt; \u0026lt;td\u0026gt; \u0026lt;a href=\u0026#34;URL\u0026#34;\u0026gt; \u0026#34;[TITLE]\u0026#34; \u0026lt;/a\u0026gt; \u0026lt;/td\u0026gt; \u0026lt;/tr\u0026gt; \u0026lt;tr\u0026gt; \u0026lt;td\u0026gt; \u0026lt;img src=\u0026#34;[IMG]\u0026#34; width=\u0026#34;200px\u0026#34; style=\u0026#34;padding: 10px;\u0026#34;\u0026gt; \u0026lt;/td\u0026gt; \u0026lt;td style=\u0026#34;padding-right: 10px;\u0026#34;\u0026gt; \u0026lt;p\u0026gt; [EXCERPT] \u0026lt;/p\u0026gt; \u0026lt;/td\u0026gt; \u0026lt;/tr\u0026gt; \u0026lt;/table\u0026gt; It would also be possible to add a background color, but this would have side effects when using the dark mode.\nThe workflow for this shortcut is as follows:\nReceive URLs and Articles from \u0026ldquo;What\u0026rsquo;s On Screen\u0026rdquo;. If nothing is found, the shortcut will Stop and Respond with \u0026ldquo;No Content to capture\u0026rdquo;. Get article from Shortcut Input: Retrieves an article from the input provided. Set variable url to URL: Stores the URL of the article. Set variable title to Name: Stores the title of the article. Set variable img to Main Image URL: Stores the main image URL of the article. Set variable excerpt to Excerpt: Stores a text excerpt from the article. Current Date: Retrieves the current date. Text: Creates an HTML snippet that formats the date, title, URL, image, and excerpt into a table layout for insertion into Obsidian. Uses the same call of the action \u0026ldquo;Prepend text to note as above\u0026rdquo; I have been using this approach for several months, initially not as an Apple Shortcut, but as an Alfred Workflow with Python scripting. This method provides better coverage for the preview image and excerpt than the Shortcut\u0026rsquo;s \u0026ldquo;Article\u0026rdquo; object. However, using Python in a shortcut on iOS/iPadOS is not so easy, therefore this method is beneficial as it works across all Apple platforms.\nThe restriction I mentioned above is something I didn\u0026rsquo;t recognize until I wrote this article and tested the scripts again. There is a difference in how HTML tables are rendered, depending on the modes and themes that are used. I always work in the \u0026ldquo;Editing View\u0026rdquo; combined with \u0026ldquo;Live Preview,\u0026rdquo; so I hadn\u0026rsquo;t mentioned it before. The results appear as expected in the Standard Theme when using \u0026ldquo;Editing View\u0026rdquo; with the \u0026ldquo;Live Preview\u0026rdquo; setting:\nBut, when switching to the \u0026ldquo;Reading View,\u0026rdquo; the rendering becomes totally different.\nSo far, I haven’t been able to find the right solution to solve this issue. I\u0026rsquo;ve tried hard and did a lot of research but without a convincing result. If anyone has a tip, I\u0026rsquo;d really appreciate it. The rendering looks a bit better when using the \u0026ldquo;Minimal\u0026rdquo; theme, which shows that different themes can affect how tables in HTML appear. Check how this solution works with your mode and theme. settings. I also looked at the examples from the link shown in the picture; they weren’t very helpful in this case, but the article is still worth reading: Custom CSS for tables - 5 New styles, ready to use in your notes\n3. Capture a Selection with the bookmark # The third solution currently works only in Safari because there is no way to run JavaScript from a shortcut in any other browser. However, I had the opportunity to test a very early version of another promising shortcut extension from Carlo Zottmann called Browser Action which will eventually enable JavaScript execution in almost every browser on a Mac. Thus, in the future, this solution can be easily extended to all browsers. I also implemented a version with the Alfred app that supports all browsers and I discussed this solution on my German-speaking blog, titled \u0026ldquo;Eine Textauswahl im Browser in Obsidian speichern\u0026rdquo;. I haven\u0026rsquo;t translated it yet, so if you are interested, please use a translation app.\nTo capture a section in a browser window the natural method is to use JavaScript. Because I\u0026rsquo;m not a JavaScript expert I created that part with the Help of ChatGPT.I explain the script extensively in my German article about the Alfred app solution. Here, I will only present the essential parts of the scripts and the shortcut itself.\nThis is the JavaScript code:\n/** * Extracts the currently selected HTML from the browser window. * @returns {string} The HTML string of the selected content. */ function getSelectionHtml() { let html = \u0026#34;\u0026#34;; if (window.getSelection) { const sel = window.getSelection(); if (sel.rangeCount) { const container = document.createElement(\u0026#34;div\u0026#34;); for (let i = 0, len = sel.rangeCount; i \u0026lt; len; ++i) { container.appendChild(sel.getRangeAt(i).cloneContents()); } html = container.innerHTML; } else { } } else { } return html; } /** * Converts HTML content into Markdown. * @param {string} html - HTML content to be converted. * @returns {string} The converted Markdown. */ function convertHtmlToMarkdown(html) { const doc = new DOMParser().parseFromString(html, \u0026#39;text/html\u0026#39;); let markdown = convertNode(doc.body); return markdown.trim(); } /** * Converts an HTML node to its Markdown representation. * @param {Node} node - The HTML node to convert. * @returns {string} Markdown representation of the node. */ function convertNode(node) { let markdown = \u0026#39;\u0026#39;; if (node.nodeType === Node.ELEMENT_NODE) { switch (node.tagName) { case \u0026#39;H1\u0026#39;: case \u0026#39;H2\u0026#39;: case \u0026#39;H3\u0026#39;: case \u0026#39;H4\u0026#39;: case \u0026#39;H5\u0026#39;: case \u0026#39;H6\u0026#39;: markdown += `${\u0026#39;#\u0026#39;.repeat(parseInt(node.tagName[1]))} ${node.textContent.trim()}\\n\\n`; break; case \u0026#39;P\u0026#39;: markdown += `${node.textContent.trim()}\\n\\n`; break; case \u0026#39;A\u0026#39;: markdown += `[${node.textContent}](${node.href})`; break; case \u0026#39;UL\u0026#39;: case \u0026#39;OL\u0026#39;: markdown += convertList(node); break; case \u0026#39;IMG\u0026#39;: const alt = node.alt || \u0026#39;Image\u0026#39;; const src = node.src || \u0026#39;\u0026#39;; const title = node.title ? ` \u0026#34;${node.title}\u0026#34;` : \u0026#39;\u0026#39;; markdown += `![${alt}](${src}${title})\\n`; break; case \u0026#39;PRE\u0026#39;: case \u0026#39;CODE\u0026#39;: markdown += `\\`\\`\\`\\n${node.textContent}\\n\\`\\`\\`\\n\\n`; break; case \u0026#39;TABLE\u0026#39;: markdown += convertTableToMarkdown(node); break; default: node.childNodes.forEach(child =\u0026gt; { markdown += convertNode(child); }); break; } } else if (node.nodeType === Node.TEXT_NODE \u0026amp;\u0026amp; node.textContent.trim()) { markdown += node.textContent.trim() + \u0026#39; \u0026#39;; } return markdown; } /** * Converts HTML lists to Markdown. * @param {HTMLElement} list - The list element. * @returns {string} Markdown formatted list. */ function convertList(list) { let markdown = \u0026#39;\u0026#39;; const items = list.children; for (let item of items) { if (item.tagName === \u0026#39;LI\u0026#39;) { const prefix = list.tagName === \u0026#39;OL\u0026#39; ? (Array.from(list.children).indexOf(item) + 1) + \u0026#39;.\u0026#39; : \u0026#39;-\u0026#39;; markdown += `${prefix} ${item.textContent.trim()}\\n`; } } return markdown + \u0026#39;\\n\u0026#39;; } /** * Converts HTML tables to Markdown. * @param {HTMLTableElement} table - The table element. * @returns {string} Markdown formatted table. */ function convertTableToMarkdown(table) { let markdown = \u0026#39;\u0026#39;; const rows = table.querySelectorAll(\u0026#39;tr\u0026#39;); rows.forEach((row, index) =\u0026gt; { let rowMarkdown = \u0026#39;|\u0026#39;; row.querySelectorAll(\u0026#39;th, td\u0026#39;).forEach(cell =\u0026gt; { rowMarkdown += ` ${cell.textContent.trim()} |`; }); markdown += rowMarkdown + \u0026#39;\\n\u0026#39;; // Add header separator for the first row if it contains headers if (index === 0 \u0026amp;\u0026amp; row.querySelector(\u0026#39;th\u0026#39;)) { markdown += \u0026#39;|\u0026#39; + Array.from(row.children).map(() =\u0026gt; \u0026#39; --- \u0026#39;).join(\u0026#39;|\u0026#39;) + \u0026#39;|\\n\u0026#39;; } }); return markdown + \u0026#39;\\n\u0026#39;; } /** * Main function that orchestrates the conversion from HTML to Markdown. * @returns {void} */ function main() { const html = getSelectionHtml(); if (!html) { return; } let markdown = convertHtmlToMarkdown(html); const datum = new Date().toLocaleDateString(); const title = document.title; const url = window.location.href; const header = `\\n\\n\u0026gt;[\\!snippets] ${datum} [${title}](${url})\\n`; markdown = markdown.split(\u0026#39;\\n\u0026#39;).map(line =\u0026gt; \u0026#39;\u0026gt; \u0026#39; + line).join(\u0026#39;\\n\u0026#39;); markdown = header + markdown; return (markdown); } completion(main()); This script fetches the selection from the browser and processes the HTML tags to convert them into the corresponding Markdown. The script converts only the following HTML tags, and from what I see, it does so almost without errors:\n\u0026lt;H1\u0026gt; bis \u0026lt;H6\u0026gt; \u0026lt;p\u0026gt; \u0026lt;a\u0026gt; \u0026lt;img\u0026gt; \u0026lt;pre\u0026gt; und \u0026lt;code\u0026gt; \u0026lt;ul\u0026gt; und \u0026lt;ol\u0026gt; \u0026lt;table\u0026gt; The JavaScript also creates the Markdown that I will use for my special Obsidian note for these snippets:\n\u0026gt;[\\!snippets] 02.02.24: [example website](https://example.com) \u0026gt; This is the first line of the selection \u0026gt; A second line The result on the page looks like this:\nI use a self-defined callout [!snippets]. If you are not familiar with this, you can opt for one of the predefined callouts, such as [!info]. Nevertheless, regardless of which snippet type you use, the backslash \\ before the ! in the code is necessary because using ! alone without the escape symbol produced errors. The two \\n\\n in the code before [\\!snippets] serve to visually separate the blocks in the Obsidian note.\nComment:Just an explanation that the next action sets the Obsidian path to the snippet note. Text: Inputs the text \u0026ldquo;98 Administration/Bookmarked/Snippets\u0026rdquo; to specify the note where the snippet will be included. Set variable note to path of the note: Assigns the previously specified path to a variable named \u0026ldquo;note\u0026rdquo;. This can also be done direct in the prepend call, I use it here just for transparency. Run JavaScript on Active Safari Tab: Executes a JavaScript snippet in the active Safari tab to capture the HTML of the selected text. The script checks if there is a selection and logs details about it, including cloning the contents to ensure it captures a standalone copy. Set variable Highlight to JavaScript Result: Saves the result of the JavaScript execution to a variable named \u0026ldquo;Highlight\u0026rdquo;. Prepend Highlight to note: Adds the captured HTML as markdown content to the specified Obsidian note at the beginning of the section under the headline \u0026ldquo;###### Snippets\u0026rdquo;. That\u0026rsquo;s all # I captured the example screenshots using the Shortcut app on my Mac. However, it\u0026rsquo;s important to note that these shortcuts works seamlessly on iPhone and iPads as well. They may work on the Apple Vision as well, but until Tim Cook sends me a test device, that will remain unconfirmed!\n","date":"May 5, 2024","externalUrl":null,"permalink":"/2024/05/05/three-styles-to-save-bookmarks-in-obsidian/","section":"Posts","summary":"For bookmarking websites during my information research, I increasingly move from tools like Instapaper and Omnivore to Obsidian as the place to save and organize my bookmarks.\nIn this article, I want to show a few solutions using Apple Shortcut together with the Shortcut extension “Actions for Obsidian” from Carlo Zottman. These range from a simple one-line bookmarks to slightly more complex methods that also save a selection from within a browser window. Let’s start with the simple one.\n","title":"Three Styles to Save Bookmarks in Obsidian","type":"posts"},{"content":"Personal data (usually referred to just as „data“ below) will only be processed by us to the extent necessary and for the purpose of providing a functional and user-friendly website, including its contents, and the services offered there.\nPer Art. 4 No. 1 of Regulation (EU) 2016/679, i.e. the General Data Protection Regulation (hereinafter referred to as the „GDPR“), „processing“ refers to any operation or set of operations such as collection, recording, organization, structuring, storage, adaptation, alteration, retrieval, consultation, use, disclosure by transmission, dissemination, or otherwise making available, alignment, or combination, restriction, erasure, or destruction performed on personal data, whether by automated means or not.\nThe following privacy policy is intended to inform you in particular about the type, scope, purpose, duration, and legal basis for the processing of such data either under our own control or in conjunction with others. We also inform you below about the third-party components we use to optimize our website and improve the user experience which may result in said third parties also processing data they collect and control.\nOur privacy policy is structured as follows:\nI. Information about us as controllers of your data\nII. The rights of users and data subjects\nIII. Information about the data processing\nI. Information about us as controllers of your data # The party responsible for this website (the „controller“) for purposes of data protection law is:\nLeif Jensen-Pistorius\nWilhelm Furtwängler Str. 7\nD-76684 Östringen\nGermany\nE-mail: en@ileif.de\nThe controller’s data protection officer is:\nSee above!\nII. The rights of users and data subjects # With regard to the data processing to be described in more detail below, users and data subjects have the right\nto confirmation of whether data concerning them is being processed, information about the data being processed, further information about the nature of the data processing, and copies of the data (cf. also Art. 15 GDPR); to correct or complete incorrect or incomplete data (cf. also Art. 16 GDPR); to the immediate deletion of data concerning them (cf. also Art. 17 DSGVO), or, alternatively, if further processing is necessary as stipulated in Art. 17 Para. 3 GDPR, to restrict said processing per Art. 18 GDPR; to receive copies of the data concerning them and/or provided by them and to have the same transmitted to other providers/controllers (cf. also Art. 20 GDPR); to file complaints with the supervisory authority if they believe that data concerning them is being processed by the controller in breach of data protection provisions (see also Art. 77 GDPR). In addition, the controller is obliged to inform all recipients to whom it discloses data of any such corrections, deletions, or restrictions placed on processing the same per Art. 16, 17 Para. 1, 18 GDPR. However, this obligation does not apply if such notification is impossible or involves a disproportionate effort. Nevertheless, users have a right to information about these recipients.\nLikewise, under Art. 21 GDPR, users and data subjects have the right to object to the controller’s future processing of their data pursuant to Art. 6 Para. 1 lit. f) GDPR. In particular, an objection to data processing for the purpose of direct advertising is permissible.\nIII. Information about the data processing # Your data processed when using our website will be deleted or blocked as soon as the purpose for its storage ceases to apply, provided the deletion of the same is not in breach of any statutory storage obligations or unless otherwise stipulated below.\nContact # If you contact us via email or the contact form, the data you provide will be used for the purpose of processing your request. We must have this data in order to process and answer your inquiry; otherwise we will not be able to answer it in full or at all.\nThe legal basis for this data processing is Art. 6 Para. 1 lit. b) GDPR.\nYour data will be deleted once we have fully answered your inquiry and there is no further legal obligation to store your data, such as if an order or contract resulted therefrom.\nComments and replies from the Fediverse and Bluesky # This website has no comment function of its own and does not store any comment data. New posts are announced on Mastodon (@en_leif@indieweb.social) and Bluesky (@en.ileif.de). Public replies to these announcements can be displayed below the respective post.\nThe replies are only loaded when you click “Show replies”. Your browser then retrieves them directly from indieweb.social (Mastodon) or Bluesky (public.api.bsky.app), and profile pictures from the servers of the respective authors. In the process, your IP address and technical browser data are transmitted to these providers. The legal basis is Art. 6 Para. 1 lit. f) GDPR; our legitimate interest lies in displaying public reactions to our posts. The privacy policies of the respective platforms apply. Anyone who replies there publishes their reply under the terms of that platform. If you delete your reply there, it will no longer appear here either.\nComments by email # Alternatively, you can send us your comment by email. Your message and your email address will only be used to reply to you and will not be published (Art. 6 Para. 1 lit. f) GDPR).\nArchived comments # Comments from the time when this blog was run on WordPress are still displayed (name, website if provided, date, text). Email addresses and profile pictures are not stored or loaded from third-party servers. The legal basis is Art. 6 Para. 1 lit. f) GDPR. If you would like a comment of yours to be removed, an informal message is sufficient.\nServer data # For technical reasons, the following data sent by your internet browser to us or to our server provider will be collected, especially to ensure a secure and stable website: These server log files record the type and version of your browser, operating system, the website from which you came (referrer URL), the webpages on our site visited, the date and time of your visit, as well as the IP address from which you visited our site.\nThe data thus collected will be temporarily stored, but not in association with any other of your data.\nThe basis for this storage is Art. 6 Para. 1 lit. f) GDPR. Our legitimate interest lies in the improvement, stability, functionality, and security of our website.\nThe data will be deleted within no more than seven days, unless continued storage is required for evidentiary purposes. In which case, all or part of the data will be excluded from deletion until the investigation of the relevant incident is finally resolved.\nMatomo # This website uses the open-source web analytics service Matomo.\nWith the help of Matomo, we are able to collect and analyze data on how visitors use our website. This allows us, among other things, to find out when which pages were viewed and from which region the visits come. We also collect various log data (e.g. IP address, referrer, browsers and operating systems used) and can measure whether our website visitors perform certain actions (e.g. clicks, purchases and the like).\nThis analysis tool is used on the basis of Art. 6 Para. 1 lit. f GDPR. The website operator has a legitimate interest in analyzing user behavior in order to optimize both its website and its advertising. If consent has been requested, the processing is carried out exclusively on the basis of Art. 6 Para. 1 lit. a GDPR and § 25 Para. 1 TTDSG, insofar as the consent includes the storage of cookies or access to information on the user\u0026rsquo;s device (e.g. device fingerprinting) within the meaning of the TTDSG. Consent can be revoked at any time.\nIP anonymization # We use IP anonymization when analyzing with Matomo. Your IP address is shortened before the analysis so that it can no longer be clearly assigned to you.\nCookieless analysis # We have configured Matomo so that it does not store any cookies in your browser.\nHosting # We host Matomo exclusively on our own servers, so all analysis data remains with us and is not passed on.\n","date":"April 30, 2024","externalUrl":null,"permalink":"/privacy-policy/","section":"dit und dat","summary":"Personal data (usually referred to just as „data“ below) will only be processed by us to the extent necessary and for the purpose of providing a functional and user-friendly website, including its contents, and the services offered there.\nPer Art. 4 No. 1 of Regulation (EU) 2016/679, i.e. the General Data Protection Regulation (hereinafter referred to as the „GDPR“), „processing“ refers to any operation or set of operations such as collection, recording, organization, structuring, storage, adaptation, alteration, retrieval, consultation, use, disclosure by transmission, dissemination, or otherwise making available, alignment, or combination, restriction, erasure, or destruction performed on personal data, whether by automated means or not.\n","title":"Privacy Policy","type":"page"},{"content":"I have been blogging since the summer of 2023 at the domain https://ileif.de, exclusively in German, covering topics like automation, Obsidian, Apple shortcuts, and all that interesting computer stuff. With this additional blog, I will start posting in English on https://en.ileif.de, mainly covering topics that I have already discussed on my German site. However, my first article will be a comprehensive summary of three ways to save shortcuts in Obsidian, which hasn’t been published in German in this comprehensive manner.\nThus, the first post already indicates that I will likely not be posting just translations here, so it won’t be a straightforward 1:1 version of the German blog. But let\u0026rsquo;s see how it evolves in the end.\nFeel alway free to use the comments, special if I\u0026rsquo;m wrong about something, or if you have better ideas or solutions.\nThat should be enough for now, so have fun and I hope I can help with the one or the other post.\n\u0026ndash; Leif\n","date":"April 29, 2024","externalUrl":null,"permalink":"/2024/04/29/moin/","section":"Posts","summary":"I have been blogging since the summer of 2023 at the domain https://ileif.de, exclusively in German, covering topics like automation, Obsidian, Apple shortcuts, and all that interesting computer stuff. With this additional blog, I will start posting in English on https://en.ileif.de, mainly covering topics that I have already discussed on my German site. However, my first article will be a comprehensive summary of three ways to save shortcuts in Obsidian, which hasn’t been published in German in this comprehensive manner.\n","title":"Hello world!","type":"posts"},{"content":" § 5 German Telemedia Act # Leif Jensen-Pistorius\nWilhelm Furtwängler Str. 7\nD-76684 Östringen\nGermany\nE-mail: en@ileif.de\nEditorially Responsible # Leif Jensen-Pistorius\nQuelle: e-recht24.de translated by myself\n","date":"May 28, 2023","externalUrl":null,"permalink":"/impressum/","section":"dit und dat","summary":"§ 5 German Telemedia Act # Leif Jensen-Pistorius\nWilhelm Furtwängler Str. 7\nD-76684 Östringen\nGermany\nE-mail: en@ileif.de\nEditorially Responsible # Leif Jensen-Pistorius\n","title":"Legal Notice","type":"page"},{"content":"I worked for a large German software company as Chief User Design Expert. My educational background is in cognitive and educational psychology with a little bit of computer science. After almost 30 years of consulting on UI implementation and visual design, on concepts and innovations as UI/UX designer, manager, architect, product expert, I started my early retirement phase in 2020.\nIn 2023 I reactivated my old domain ileif.de and since then I write some stuff about my non-professional life with this computer stuff. At the same time when I resume writing blog posts again, I discovered Obsidian, which I have used since then for collecting and processing information to prepare my articles here. It has also become one of my main topics of interest.\nAnother area will be scripting languages. Alos working for nearly 30 years in the software company I lost my active programming skills, which I had in the 70th and 80th, in Basic, Elan, Pascal, Lisp and as well in Hypercard. So this is the next big topic, using scripting in Python or any shell scripting language to reactive these skills a little bit, because scripting seems a good domain for this. With the advent of AI tools like ChatGPT, an interactive and educational way to rebuild these skills has opened up.\nNevertheless, this blog is primarily meant to be a place where I can save one thing or another (dit und dat, as they say in my birth German hometown) and make it accessible from anywhere. Of course I\u0026rsquo;m happy if I can help others with this \u0026ldquo;dit und dat\u0026rdquo;.\nThe topics I want to cover here will mainly revolve around the use of software and hardware. I may be what is commonly called an Apple fanboy, but I also use Windows, Linux and Android. So maybe I will cover these things as well.\nSome disclaimer # No cookies will be placed on your browser when you browse this site. However, my posts may contain links to other websites or web services that may create cookies when you click on them or, depending on your browser settings, when you preview them. I am not responsible for this. Please disable the corresponding functions in your browser if you wish.\nThe contents of my website are compiled to the best of my knowledge and belief. However, I am not immune to false reports or the like. If you notice anything that is not correct, please let me know by e-mail or in the comments to the articles. Thank you very much.\nFor articles that contain programming instructions and/or other instructions such as tips and tricks, I take no responsibility for any damage to your equipment. I will not publish anything that I have not tried on my own equipment first. However, I cannot exclude the possibility that your equipment may behave differently in certain constellations.\nThe texts are subject to the usual copyright. If you want to use them, please contact me. This also applies to the most of pictures on the website. The article images are done with the help of several image AI programms.\nLastly, I\u0026rsquo;d like to mention that English isn\u0026rsquo;t my first language. Indeed, I was not good at English in school. Working in an international company required me to learn to communicate intensively in English, but without regular practice in speaking and writing, I find I\u0026rsquo;m losing these skills a bit. The role of my native-speaking colleagues has evolved towards AI tools, I now rely on translation tools and AI like ChatGPT to aid in my English writing. Although these tools help correct things I\u0026rsquo;ve gotten wrong before, they will not catch all my mistakes. So, I apologize for any errors in advance.\n","date":"May 28, 2023","externalUrl":null,"permalink":"/about/","section":"dit und dat","summary":"I worked for a large German software company as Chief User Design Expert. My educational background is in cognitive and educational psychology with a little bit of computer science. After almost 30 years of consulting on UI implementation and visual design, on concepts and innovations as UI/UX designer, manager, architect, product expert, I started my early retirement phase in 2020.\n","title":"About Me","type":"page"},{"content":"","externalUrl":null,"permalink":"/tag/shortcuts/","section":"Tags","summary":"","title":"AppleShortcuts","type":"tags"},{"content":"","externalUrl":null,"permalink":"/tag/barcuts-2/","section":"Tags","summary":"","title":"BarCuts","type":"tags"},{"content":"","externalUrl":null,"permalink":"/category/obsidian-2/","section":"Categories","summary":"","title":"Obsidian","type":"categories"},{"content":"","externalUrl":null,"permalink":"/tag/tippstricks/","section":"Tags","summary":"","title":"Tipps\u0026Tricks","type":"tags"},{"content":"","externalUrl":null,"permalink":"/tag/unicode-2/","section":"Tags","summary":"","title":"UniCode","type":"tags"}]