Skip to content

Instantly share code, notes, and snippets.

hiilppp

Block or report user

Report or block hiilppp

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am hiilppp on github.
  • I am hiilppp (https://keybase.io/hiilppp) on keybase.
  • I have a public key whose fingerprint is 2546 C4BF 700E A88D E278 5DBD 83A5 ABB6 A181 C883

To claim this, I am signing this object:

@hiilppp
hiilppp / title_case.py
Created Aug 16, 2014
Python script for capitalizing titles (according to The Chicago Manual of Style's rules) in Editorial (see http://www.editorial-workflows.com/workflow/5247248250175488/_f57rqO3mos).
View title_case.py
# -*- coding: utf-8 -*-
import linguistictagger
import re
import workflow
def capitalize_(s):
if re.search(r"[A-Z]", s):
return s
else:
@hiilppp
hiilppp / Execute in Drafts.scpt
Last active Jul 7, 2019
AppleScript to be used as Automator Service that sends Drafts Actions as executable Pushover Notifications to your iOS device. The first line of the received text is expected to be the name of a Drafts Action, the rest will be used as input.
View Execute in Drafts.scpt
-- Replace "[Pushover_user_key]" on line #22 with your Pushover accout's user
-- key. (You can find it here: <https://pushover.net/dashboard>)
-- You should probably also replace the app token provided on line #21 with one
-- of your own. (They can be generated here: <https://pushover.net/apps/build>)
-- And, finally, replace "xxxxxx" on line #25 with your Drafts URL Key if you
-- use one. (It can be found under Drafts > Settings > URL Security.)
on URL_encode(a)
@hiilppp
hiilppp / DrafTerm.scpt
Last active Oct 15, 2019
As a text file is added to a directory to which this AppleScript is associated as Folder Action, the content of the received file is executed as shell script and the generated output sent to an iOS device.
View DrafTerm.scpt
-- Replace "[Pushover_user_key]" on line #42 with your Pushover accout's user
-- key. (You can find it here: <https://pushover.net/dashboard>)
-- You should probably also replace the app token provided on line #41 with one
-- of your own. (They can be generated here: <https://pushover.net/apps/build>)
on URL_encode(a)
set safe_characters to "abcdefghijklmnopqrstuvwxyz0123456789~-_."
set hex to {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"}
set a_encoded to ""
@hiilppp
hiilppp / tf2cp.scpt
Created Apr 17, 2014
AppleScript that places the content of a text file on the clipboard as the file is added to a directory to which this script is associated as Folder Action. (Can be used to send text from your iOS device to your Mac's clipboard via Dropbox.)
View tf2cp.scpt
on truncate(a, n)
set a_2 to paragraph 1 of a
set text_item_delimiters to text item delimiters
set text item delimiters to space
set a_2_text_items to text items of a_2
set text item delimiters to text_item_delimiters
set NO_paragraphs_in_a to count paragraphs of a
if (count text items of a_2_text_items) > n then
set text_item_delimiters to text item delimiters
set text item delimiters to space
@hiilppp
hiilppp / entering_range.scpt
Created Apr 16, 2014
AppleScript to unlock your Mac's screen. (Use EventScripts to automatically trigger script when a Bluetooth device (e.g., your iPhone) enters your Mac's range: http://www.mousedown.net/mouseware/EventScripts.html)
View entering_range.scpt
-- You need to create a Keychain item whose name matches what you use in place
-- of "[keychain_item_name]" on line #7 (and whose password is identical to your
-- user account's password).
tell application "System Events"
if ((get name of every process) contains "ScreenSaverEngine") then
set pw to (do shell script "security find-generic-password -l \"[keychain_item_name]\" -w")
tell application "ScreenSaverEngine" to quit
delay 0.5
keystroke pw
@hiilppp
hiilppp / leaving_range.scpt
Created Apr 16, 2014
AppleScript to lock your Mac's screen, pause iTunes (if playing), and sync OmniFocus (if open). (Use EventScripts to automatically trigger script when a Bluetooth device (e.g., your iPhone) leaves your Mac's range: http://www.mousedown.net/mouseware/EventScripts.html)
View leaving_range.scpt
do shell script "defaults write com.apple.screensaver askForPassword 1; defaults write com.apple.screensaver askForPasswordDelay 0"
repeat until (do shell script "defaults read com.apple.screensaver askForPassword") = "1" and (do shell script "defaults read com.apple.screensaver askForPasswordDelay") = "0"
delay 0.5
end repeat
tell application "ScreenSaverEngine" to activate
if application "iTunes" is running then
tell application "iTunes"
@hiilppp
hiilppp / random_reminders.py
Created Apr 2, 2014
Pythonista script that randomly selects a reminder (out of a given list) and schedules a (quiet) notification for that reminder at a random point of time in the future (within a given range). Opening the notification will then schedule a new reminder notification (and, if provided, follow a link).
View random_reminders.py
import notification
from random import randint
import sys
import urllib
import webbrowser
reminders = ["Reminder A", ["Reminder B", "url://"], "Reminder C"]
n = randint(0, len(reminders)-1)
URL = "pythonista://random_reminders.py?action=run"
@hiilppp
hiilppp / urlschemes.sh
Created Feb 20, 2014
Shell script to list the URL schemes associated with apps installed on your Mac.
View urlschemes.sh
#!/bin/sh
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -dump | grep -E "^[[:space:]]*bindings:.+[a-z]+[a-z0-9.+-]*:" | sed -E "s/^[[:space:]]*bindings:[[:space:]]+//" | sort -u
@hiilppp
hiilppp / insert_location.py
Created Jan 5, 2014
Python script to append the current location (either as address or Google Maps link) to the provided text (which may be "") in Pythonista and send the result (back) to Drafts.
View insert_location.py
# -*- coding: utf-8 -*-
# To call script from Drafts, use the follwing URLs as URL Actions:
# - <pythonista://insert_location.py?action=run&argv=[[draft]]&argv=address>
# (Will insert the address of your current location.)
# - <pythonista://insert_location.py?action=run&argv=[[draft]]&argv=link>
# (Will insert a Google Maps link to your current location.)
import location
import re
You can’t perform that action at this time.