Skip to content

Instantly share code, notes, and snippets.

--------------------------------------------------
--------------------------------------------------
-- Import tasks from Things to OmniFocus
--------------------------------------------------
--------------------------------------------------
--
-- Script taken from: http://forums.omnigroup.com/showthread.php?t=14846&page=2
-- Added: creation date, due date, start date functionality
-- Empty your Things Trash first.
-- Note that this won't move over scheduled recurring tasks.
@cdzombak
cdzombak / DeferredThings.scpt
Last active December 13, 2023 04:05
OmniFocus-style deferred tasks for Things
use AppleScript version "2.4" -- Yosemite (10.10) or later
on replace_chars(this_text, search_string, replacement_string)
set AppleScript's text item delimiters to the search_string
set the item_list to every text item of this_text
set AppleScript's text item delimiters to the replacement_string
set this_text to the item_list as string
set AppleScript's text item delimiters to ""
return this_text
end replace_chars
@cdzombak
cdzombak / Chrome Tab List to Things.scpt
Created March 15, 2021 17:55
Add browser tab lists as Things tasks
-- RESET VALUES
set urlList to {}
set currentTab to 0
-- SET DATE STAMP
set the dateStamp to ((the current date) as string)
set noteTitle to "URL List from Chrome Tabs on " & the dateStamp
-- PROCESS TABS OF FRONTMOST CHROME WINDOW
tell application "Google Chrome.app"
try
tell application id "com.culturedcode.ThingsMac" to activate
tell application "System Events"
tell process "Things"
click menu item "New Things Window" of menu "File" of menu bar item "File" of menu bar 1
click menu item "Quick Find…" of menu "Edit" of menu bar item "Edit" of menu bar 1
end tell -- Things
end tell -- System Events
on error e number n
display dialog "Error " & n & ": " & e
# based on sidekiq.chart.sh by codl <codl@codl.fr>
#
# apt install netdata-plugin-chartsd redis-tools
# put this in /usr/libexec/netdata/charts.d
# chown root:netdata /usr/libexec/netdata/charts.d/sidekiq.chart.sh && chmod +x /usr/libexec/netdata/charts.d/sidekiq.chart.sh
sidekiq_update_every=5
sidekiq_priority=9000
sidekiq_check() {
@cdzombak
cdzombak / com.dzombak.iperf3.plist
Created March 8, 2023 01:21
launchd job to run iperf3 server as a global daemon
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>GroupName</key>
<string>staff</string>
<key>InitGroups</key>
<true/>
<key>Label</key>
<string>com.dzombak.iperf3</string>
@cdzombak
cdzombak / screenlocked.sh
Last active January 20, 2023 14:31
telling if macOS screen is locked from bash script
#!/usr/bin/env bash
set -euo pipefail
# from https://stackoverflow.com/a/66723000
function screenIsLocked { [ "$(/usr/libexec/PlistBuddy -c "print :IOConsoleUsers:0:CGSSessionScreenIsLocked" /dev/stdin 2>/dev/null <<< "$(ioreg -n Root -d1 -a)")" = "true" ] && return 0 || return 1; }
function screenIsUnlocked { [ "$(/usr/libexec/PlistBuddy -c "print :IOConsoleUsers:0:CGSSessionScreenIsLocked" /dev/stdin 2>/dev/null <<< "$(ioreg -n Root -d1 -a)")" != "true" ] && return 0 || return 1; }
if screenIsLocked; then
echo "Screen locked"
@cdzombak
cdzombak / README.md
Created September 28, 2010 21:43
recursive ksort function for PHP
@cdzombak
cdzombak / rss-media-info
Created March 30, 2022 19:34
generate YAML header matter for MP3s attached to Jekyll posts
#!/usr/bin/env bash
if [ "$#" -ne 1 ]; then
echo "usage: rss-media-info path/to/attachment.mp3"
exit 1
fi
read -r -d '' retv <<EOF
itunes_duration: '$(ffmpeg -i "$1" 2>&1 | grep "Duration:" | cut -d ' ' -f 4 | sed s/,//)'
episode_length: $(stat -f%z "$1")
@cdzombak
cdzombak / .last-uls-search-hash
Last active September 15, 2021 00:22
watching for my amateur radio license to appear in the FCC's database!
6be5d57c4d0c622216b38c5ea62195a5