Skip to content

Instantly share code, notes, and snippets.

@lancethomps
lancethomps / close_notifications_applescript.js
Last active April 6, 2025 15:55
AppleScript to close all notifications on macOS Big Sur, Monterey, Ventura, Sonoma, and Sequoia
function run(input, parameters) {
const appNames = [];
const skipAppNames = [];
const verbose = true;
const scriptName = 'close_notifications_applescript';
const CLEAR_ALL_ACTION = 'Clear All';
const CLEAR_ALL_ACTION_TOP = 'Clear';
const CLOSE_ACTION = 'Close';
@zmij
zmij / Readme.md
Created April 23, 2020 11:08
Join next Zoom Meeting

Swift program for getting a zoom app link from current or upcoming event in calendar.

Apple script calling the program and opening zoom.

@rmcdongit
rmcdongit / macOS_SytemPrefs.md
Last active April 22, 2025 07:29
Apple System Preferences URL Schemes

macOS 10.15 System Preference Panes

Below are a list of System Preference pane URLs and paths that can be accessed with scripting to assist users with enabling macOS security settings without having to walk them through launching System Preferences, finding panes, and scrolling to settings. Not all panes have an accessible anchor and some are OS specific.

To find the Pane ID of a specific pane, open the System Preferences app and select the desired Preference Pane. With the pane selected, open the ScriptEditor.app and run the following script to copy the current Pane ID to your clipboard and display any available anchors:

tell application "System Preferences"
	set CurrentPane to the id of the current pane
	set the clipboard to CurrentPane
@zaru
zaru / get_menubar_items.swift
Last active February 9, 2024 19:49
$ swiftc -o get_window_title get_window_title.swift && get_window_title 9999
import Foundation
import AppKit
func main() -> Int {
let argv = ProcessInfo.processInfo.arguments
let pid = Int32(argv[1])!
print(pid)
let appRef = AXUIElementCreateApplication(pid)
var menubar: CFTypeRef?
AXUIElementCopyAttributeValue(appRef, kAXMenuBarAttribute as CFString, &menubar)
@atereshkov
atereshkov / xcode-duplicate-line.md
Last active September 5, 2022 07:49
Xcode 13 duplicate line shortcut (hotkey)

Xcode 13 duplicate line shortcut

  1. Run
sudo chmod 666 /Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Versions/A/Resources//IDETextKeyBindingSet.plist
sudo chmod 777 /Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Versions/A/Resources/
@odrianoaliveira
odrianoaliveira / giscompletion.amazon.com.MD
Last active June 27, 2024 19:30
How-to use the completion.amazon.com API
  • URL: https://completion.amazon.com/api/2017/
  • Resource: suggestions
  • Paramters:
    • session-id: 133-2190809-5709766
    • customer-id: A1CNYR04B8CZOZ
    • request-id: NTH41W0H5GYC8N00NVCS
    • page-type: Gateway
    • lop=en_US
    • site-variant=desktop
  • client-info=amazon-search-ui
@bartleby
bartleby / iOS URL Schemes
Created August 22, 2018 17:48
iOS URL Schemes
URL Schemes
Apple
 
Apple Music     — music://geo.itunes.apple.com/us/albums/<albumID>
                – music://geo.itunes.apple.com/us/artists/<artistID>
 
Apple News      — applenews://
App Store       — itms-apps://itunes.apple.com/app/<appID>
Apple TV        — videos://
@emotality
emotality / duplicate_line_xcode.md
Last active January 24, 2025 13:49
Xcode - Duplicate Line key binding

NOTE (2022-07-09): Xcode finally added this functionality in Xcode 14, please see release notes here:

New Features in Xcode 14 Beta 3
When editing code, the Edit > Duplicate menu item and its corresponding keyboard shortcut now duplicate the selected text — or the line that currently contains the insertion point, if no text is selected. (8614499) (FB5618491)


Xcode line duplicate

Bind keys to duplicate lines in Xcode

@c9iim
c9iim / AXUIElement_in_Swift.swift
Last active May 9, 2023 07:45
AXUIElement in Swift
import Cocoa
protocol AXUIProtocol {
func AXUIWindowArray(processIdentifier pid:pid_t) -> [AXUIElement]
func AXUIWindowArray(bundleIdentifier bid:NSString) -> [AXUIElement]
}
extension AXUIProtocol {
func AXUIWindowArray(processIdentifier pid:pid_t) -> [AXUIElement] {
let windowList : UnsafeMutablePointer<AnyObject?> = UnsafeMutablePointer<AnyObject?>.alloc(1)
@chad3814
chad3814 / gist:2924672
Last active August 29, 2024 05:43
deleting array items in javascript with forEach() and splice()
// This is from my comment here: http://wolfram.kriesing.de/blog/index.php/2008/javascript-remove-element-from-array/comment-page-2#comment-466561
/*
* How to delete items from an Array in JavaScript, an exhaustive guide
*/
// DON'T use the delete operator, it leaves a hole in the array:
var arr = [4, 5, 6];
delete arr[1]; // arr now: [4, undefined, 6]