Posts

Showing posts from January, 2025

Extract subimages from multi-image HEIC files as JPEG in Shortcuts on iOS and macOS

A shortcut for iOS and macOS that can for example be used to extract all the subimages from Apple's multi-image wallpapers. Can also be used to batch convert both single-image and multi-image files to JPEG. There doesn't seem to be any image conversion app on the App Store that's able to extract subimages from multi-image HEIC file, only the main image. Same with the Convert Image action in Shortcuts app. There's also a Get Frames from Image action, but that's only for animated GIF and photo burst files, according to the description. It actually accepts HEIC files as well, but unfortunately only the main image get's extracted here too. What about tricking the action to extract the subimages by changing the file extension to gif , without the resulting images ending up as GIFs, despite the foreboding extension name? That's exactly what this shortcut is doing.

URL scheme for viewing currently stored website data on iOS Safari

If you want to view or delete website data for specific sites in Safari for iOS, use the following URL to get directly to the page you finally arrive on after locating the Website Data button somewhere on the page you opened after locating the Advanced button somewhere on the page you opened after locating the Safari button somewhere on the page you opened after locating the Apps button somewhere on the Settings main page: prefs:root=SAFARI&path=ADVANCED/REMOVE_WEBSITE_DATA

Take a screenshot of the current macOS window with a single click or keyboard shortcut

A macOS shortcut that copies a screenshot of the current app's frontmost window to the clipboard. To make the shortcut run from a keyboard shortcut, click the 'i' button at the top of the sidebar, then the 'Add Keyboard Shortcut' button, and then press your keyboard combination. You have to wait some time for the keyboard shortcut to be activated systemwide (less than a minute), but if you restart the app you want the screenshot from, it will work immediately. Get the shortcut here .

Web inspector and JavaScript console bookmarklet that bypasses CSP (Content Security Policy)

Great if you're a Safari user on iOS and don't want to connect your device to a Mac to have this functionality. Works on most CSP-restricted pages, except pages with maximum security policies like github.com and developer.mozilla.org. The bookmarklet contains the entire Eruda library as a base64-encoded string in order to bypass the script-src-elem CSP restrictions. If you have concern about the safety of the bookmarklet, you can always decode the base64 string and compare it to the original script (v3.4.1) here . View the bookmarklet here .

iOS/macOS Shortcuts: Run JavaScript actions without data: URLs, third-party apps or APIs

It's already possible to run JavaScript code natively in Shortcuts app through the data: URL method 1 , but this one is less complicated and easier to remember. 1. Inside a Text action, create an HTML document containing script code that writes its output to a visible element 2. Either convert the document with the Make Rich Text from HTML action or use the Set Name action and set the name to <name>.html 3. Convert the result from the previous step with the Make PDF 2 action (use default settings) 4. Instead of using the Get Text from Input action to extract the text, use the Combine Text [with newlines] action which also converts the input to plain text. This is because the length of the output could cause multiple PDF pages being produced, which end up becoming separate items in a list that you would have needed to combine either way. Example here 1 "Using JavaScript in your shortcuts"—reddit.com 2 This is the action that executes all scripts in the d...

Python dialog box bookmarklet for running code in current web browser tab

With this bookmarklet you can run Python code inside a dialog box on the web page you're currently viewing. Works on most pages, but not on pages with strict content security policies. javascript:(function(){ async function main() { let pyodide = await loadPyodide(); await pyodide.loadPackage("micropip"); var logBackup = console.log; var logMessages = []; console.log = function() { logMessages.push.apply(logMessages, arguments); logBackup.apply(console, arguments); }; a = await pyodide.runPythonAsync(_code); var a; wait(function() { return a }, function() { _input.value = logMessages.join("\n") }); setTimeout(function() { a = 1 }, 0); function wait(condition, callback) { if (typeof condition() !== "undefined") { callback(); } else { setTimeout(function () { wait(condition, callback); }, 0) } }; _cancel.innerText = "Close"; _return.style.display = "inline"; }; function callback() { _style = `<style>body:has(#mydialog[open]) { o...

Crop image to circle or heart in Shortcuts on iOS and macOS

A shortcut for iOS and macOS that converts an image to the shape of a circle, heart, square or app icon. The source image can be any aspect ratio — just make sure what you want to include is in the middle part of the image. Click here to download the shortcut.

Spoof user agent bookmarklet

Opens the current web page in a new tab with the user agent of your choice. Doesn't work on every site (ex. DuckDuckGo) and stops working as soon as you navigate away from the page. Some sites use other detection methods so they still see the real user agent. Tested to work on iOS browsers and macOS Safari, but failed to do any spoofing at all on macOS Chrome. javascript:(function(){ _ua = prompt('Enter a user agent string', `Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Mobile Safari/537.3`); if (! _ua) { throw '' }; _xhr = new XMLHttpRequest(); _xhr.open('GET', document.location, false); _xhr.setRequestHeader('User-Agent', _ua); _xhr.onreadystatechange = function() { if (_xhr.readyState == 4 && _xhr.status == 200) { return } }; _xhr.send(); _win = window.open('about:blank', '_blank'); _win.document.write(_xhr.responseText) })() /*www.no-op.co*/