Skip to content

Instantly share code, notes, and snippets.

@Zettt
Zettt / round time.scpt
Created February 2, 2011 20:56
Short TextExpander snippet to round the current time to a quarter hour.
set currentHour to hours of (current date)
set currentMinute to minutes of (current date)
if (currentMinute ≥ 0) and (currentMinute ≤ 7) then
set currentMinute to "00"
else if (currentMinute > 7) and (currentMinute ≤ 23) then
set currentMinute to "15"
else if (currentMinute > 23) and (currentMinute ≤ 37) then
set currentMinute to "30"
else if (currentMinute > 37) and (currentMinute ≤ 52) then

Keybase proof

I hereby claim:

  • I am zettt on github.
  • I am zettt (https://keybase.io/zettt) on keybase.
  • I have a public key ASAEMOLtmYzMeH7C9fffIxFRfc8f9xURmBnh9c5hkgz7pQo

To claim this, I am signing this object:

-- Things to Pomodoro App for iPad
-- This script asks Things for the currently selected todos
-- and generates a Pomodoro App for iPad compatible JSON file
-- for you to import in to the app (using Dropbox)
--
-- Created by Thomas on 2011-02-17
-- Inspired by Andreas on 2011-02-17
-- Modified by Andreas on 2011-02-17
-- Original: https://gist.github.com/832075
-- https://gist.github.com/831942
@Zettt
Zettt / Open Disk Images.sh
Created April 13, 2011 18:53
Hazel script that will open .dmg files in the background without any interaction required. (It auto-accepts any confirmation dialog.)
#!/bin/sh
file="$1"
extension=${file##*.}
if [[ $extension == "dmg" ]]; then
echo "yes" | hdiutil attach "$1"
fi
@Zettt
Zettt / rtime.sh
Created July 13, 2011 21:01
Inserts rounded time (15 minutes). Can be called from, e.g. TextExpander.
#!/bin/sh
hours=`date "+%H"`
let minutes=`date "+%M"`
if [[ $minutes -ge 0 ]] && [[ $minutes -le 7 ]]; then
minutes="00"
elif [[ $minutes -gt 7 ]] && [[ $minutes -le 23 ]]; then
minutes="15"
elif [[ $minutes -gt 23 ]] && [[ $minutes -le 37 ]]; then
@Zettt
Zettt / dayprojects.applescript
Last active February 19, 2019 04:25
Day Projects for OmniFocus
-- Day Projects
--
-- Created by Zettt on 2011-11-28
-- Mac OS X Screencasts.
--
-- This script creates "Day Projects" in OmniFocus.
--
-- I use these "Day Projects" to put stuff, that I need to
-- do on a specific day, but aren't big enough to be their own project.
-- Things like "Call the doctor on Wednesday" or
@Zettt
Zettt / weekprojects.applescript
Last active September 23, 2018 11:48
Week Projects: This is a week-based version of my previous Day Projects script (https://gist.github.com/Zettt/1401813)
-- Week Projects
--
-- Created by Zettt on 2015-12-28
-- zCasting 3000.
--
-- This script creates "Week Projects" in OmniFocus.
--
-- I use these "Week Projects" to put stuff, that I need to
-- do during a specific week, but aren't big enough to be their own project.
-- Things like "Call the doctor on Wednesday" or
@Zettt
Zettt / spotifyplayback.scpt
Created May 23, 2015 08:07
Playhead forward/backward - Because Spotify has stupidly removed the possibility to skip forward and backward using keyboard shortcuts, we now have to resort to do this via AppleScript. Well, it could be harder. The script below jumps 3 seconds ahead. Bind to keyboard shortcuts such as →. You may use ⇧→ to skip 10 seconds. This is how it was in …
tell application "Spotify"
if player state is playing then
set playPos to player position + 3.0
set player position to playPos
end if
end tell
@Zettt
Zettt / Search DuckDuckGo in Google Chrome.py
Created November 23, 2012 18:01
Search DuckDuckGo in Google Chrome for iOS
import webbrowser
import urllib
# http://duckduckgo.com/?q=asdf
ddg_url = "googlechromes://duckduckgo.com/?"
query_url = "q="
# input
prompt = "> "
query = raw_input("Query: \n" + prompt)
@Zettt
Zettt / notification center.scpt
Created September 18, 2014 13:08
Toggle Notification Center's Do Not Disturb on OS X Yosemite. Brought to you by Automator.
-- Toggle Notification Center's DND on Yosemite
tell application "System Events"
option key down
delay 0.1
try
click menu bar item "Notification Center" of menu bar 2 of application process "SystemUIServer"
end try
try
click menu bar item "NotificationCenter, Do Not Disturb enabled" of menu bar 2 of application process "SystemUIServer"