Skip to content

Instantly share code, notes, and snippets.

@francisfeng
francisfeng / save-tabs-safari-anybox.applescript
Last active August 13, 2025 00:55
Save all tabs of Safari’s current window to Anybox
tell application "Safari"
repeat with tabItem in tabs of window 1
set link to URL of tabItem
tell application id "cc.anybox.Anybox"
save link
end tell
end repeat
end tell
@twio142
twio142 / Alfred Running Apps
Last active June 27, 2024 12:09
An Alfred JXA workflow to list currently running apps, with fuzzy match
#!/usr/bin/osascript -l JavaScript
// Adapted from the original script of @deanishe
// https://git.deanishe.net/deanishe/alfred-quit-apps/src/branch/master/DockApplications.js
ObjC.import('AppKit')
ObjC.import('stdlib')
function run(argv) {
let apps = ObjC.unwrap($.NSWorkspace.sharedWorkspace.runningApplications)
@drewkerr
drewkerr / get-focus-mode.js
Last active January 23, 2026 16:57
Read the current Focus mode on macOS Monterey (12.0+) using JavaScript for Automation (JXA)
const app = Application.currentApplication()
app.includeStandardAdditions = true
function getJSON(path) {
const fullPath = path.replace(/^~/, app.pathTo('home folder'))
const contents = app.read(fullPath)
return JSON.parse(contents)
}
function run() {
@akihikodaki
akihikodaki / README.en.md
Last active March 11, 2026 03:20
Linux Desktop on Apple Silicon in Practice

Linux Desktop on Apple Silicon in Practice

NOTE: Time flies, and it's been almost five years(!) since I wrote this. Beaware the text below is now outdated (e.g., now Asahi Linux has graphics acceleration even better than this). The commands listed are up-to-date.

I bought M1 MacBook Air. It is the fastest computer I have, and I have been a GNOME/GNU/Linux user for long time. It is obvious conclusion that I need practical Linux desktop environment on Apple Silicon.

@geekdada
geekdada / script.js
Last active July 6, 2024 13:50
GoodLinks Script
(function() {
const scheme = 'goodlinks://x-callback-url/save'
const search = new URLSearchParams()
search.append('url', document.URL)
window.open(`${scheme}?${search.toString()}`)
})()
@deanishe
deanishe / workflow-install.py
Last active July 29, 2024 18:06
Script to install/symlink Alfred workflows. Useful for workflow developers.
#!/usr/bin/python
# encoding: utf-8
#
# Copyright (c) 2013 <deanishe@deanishe.net>.
#
# MIT Licence. See http://opensource.org/licenses/MIT
#
# Created on 2013-11-01
#
@deanishe
deanishe / edit_paths.zsh
Last active July 2, 2024 02:52
prepend_path and append_path functions for zsh
# The following functions append/prepend the specified directory to the path variable specified by name
# If the directory is already in the path, it is first removed and then appended/prepended.
# Examples:
#
# Prepend `~/bin` to `$PATH`:
# prepend_path PATH ~/bin
#
# Append `~bin` to `$PATH` instead:
# append_path PATH ~/bin
# (this will remove `~/bin` from the beginning of `$PATH` first)