This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/python | |
# Inspired by https://news.ycombinator.com/item?id=38274782#38276107 | |
# Blinks a green circle on top of all windows at 60 BPM because it seems to help people focus? | |
# Requires `pip install pyqt5` | |
import sys | |
from PyQt5.QtWidgets import QApplication, QWidget, QLabel | |
from PyQt5.QtGui import QPixmap, QPainter, QColor, QBrush | |
from PyQt5.QtCore import QTimer, Qt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# We do this with Pages because it's the only thing that can correctly convert rtfd. | |
# textutil works on rtf files with no text in them but not on rtfd. | |
set my_paths to {"/path/to/first/file.rtfd", "/path/to/second/file.rtfd"} | |
repeat with my_path in my_paths | |
tell application "Pages" | |
set my_file to (my_path as POSIX file) | |
set my_name to name of (info for my_file) | |
set doc to open my_file | |
export doc as Microsoft Word to alias (my_path & ".docx" as POSIX file) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/python | |
''' Translate a google drive share link on the clipboard to a download link ''' | |
from pandas.io.clipboard import clipboard_get, clipboard_set | |
in_str = clipboard_get() | |
file_id = '' | |
share_prefix = 'https://drive.google.com/file/d/' | |
share_suffix = '/view?usp=sharing' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/osascript | |
-- Get the size of the Display(s), only useful if there is one display | |
-- otherwise it will grab the total size of both displays | |
tell application "Finder" | |
set _b to bounds of window of desktop | |
set screen_width to item 3 of _b | |
set screen_height to item 4 of _b | |
end tell |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Get all free times from iCal. | |
Requirements: | |
brew install ical-buddy | |
pip install py-dateutil | |
Notes: | |
Run in terminal because it needs calendar permissions. | |
This only handles hourly blocks. I.e. if 30 minutes is filled, we call the entire hour filled. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#fixingUrlFiles.py | |
import os | |
# MacOS Catalina is a little less forgiving about opening .url files that previous OS versions. | |
# If they're in the wrong format, it fails to open them, just showing a blank browser window. | |
# Windows will end .url files with a newline and put a space in before the URL= bit. | |
# This script goes through and changes those bits so Safari will open the files correctly. | |
# Change "/Users/" to a more specific subfolder to save time. | |
print('Fixed the following files:') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Copy a URL to the clipboard that links to the current Mail.app message. | |
-- Bonus: the URL will work on both iOS and macOS. | |
-- By David@Pinney.org on 18 June 2017 | |
on run | |
tell application "Mail" | |
set s to selection | |
if (count of s) is not 1 then | |
display dialog "Please select exactly one message." buttons {"OK"} | |
return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Create a calendar event reminding you to follow up on the currently selected email. | |
-- Note that this puts everything on a calendar named "Todo" and will fail if that calendar doesn't exist. | |
-- By David@Pinney.org on 18 June 2017 | |
on run | |
tell application "Mail" | |
set s to selection | |
if (count of s) is not 1 then | |
display dialog "Please select exactly one message." buttons {"OK"} | |
return |