Skip to content

Instantly share code, notes, and snippets.

View n8henrie's full-sized avatar

Nathan Henrie n8henrie

View GitHub Profile
#!/bin/bash
# Original post at http://n8henrie.com/2012/12/pinboard-backups-with-curl-and-launchd/
curl -k -u "[username]:[password]" "https://api.pinboard.in/v1/posts/all?format=json" -o "/Users/[username]/Dropbox/[pathToBackup]/[filename].json"
#!/bin/bash
# Original post at http://n8henrie.com/2013/01/pastebin-backups-with-curl-and-launchd
curl -c "/tmp/pastebinCookie.txt" -d "submit_hidden=submit_hidden&user_name=[username]&user_password=[password]&submit=Login" "http://pastebin.com/login" && curl -b "/tmp/pastebinCookie.txt" "http://pastebin.com/backup.php" -o "/Users/[pathToBackupLocation]/pastebinBackup.zip" && rm "/tmp/pastebinCookie.txt"
#!/bin/bash
set -e
#Originally posted at http://n8henrie.com/2013/01/automator-shell-script-uploading-images-to-wordpress-server
## This script was made as a service in Automator, may need adjustments to function otherwise.
## Look for portions that need to be replaced with your info, as denoted by [*stuff*]
for f in "$@"
do
<?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>Label</key>
<string>com.n8henrie.morningUpdates</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/morningUpdates.sh</string>
<string>parameter1</string>
--Originally posted at http://n8henrie.com/2013/01/quicksilver-action-to-format-phone-numbers
--Corresponding bash script at http://pastebin.com/Dje7s4A7
property pathToShellScript : "/Users/.../fixPhoneNumbers.sh"
using terms from application "Quicksilver"
on process text str
set result to do shell script "echo \"" & str & "\" | " & quoted form of pathToShellScript
#!/bin/bash
set -euf -o pipefail
# For more information: http://n8henrie.com/2013/02/2021/send-drafts-ios-content-to-quicksilver-or-clipboard-on-osx
# If file is empty just exit
[ -s "$1" ] || exit 0
# To send it to the clipboard:
-- Relevant post here: http://n8henrie.com/2012/08/show-or-hide-hidden-files-on-your-mac-with-applescript/
set question to display dialog "Show or hide hidden files?" & return & "Don't that forget this will relaunch Finder." buttons {"Show hidden files", "Hide hidden files", "Cancel"}
set theAnswer to button returned of result
if theAnswer is "Show hidden files" then
do shell script "defaults write com.apple.Finder AppleShowAllFiles TRUE && killall Finder"
end if
if theAnswer is "Hide hidden files" then
do shell script "defaults write com.apple.Finder AppleShowAllFiles FALSE && killall Finder"
end if
<?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">
<!-- Original post at http://n8henrie.com/2012/12/pinboard-backups-with-curl-and-launchd/ -->
<dict>
<key>Label</key>
<string>com.n8henrie.pinboardBackup</string>
<key>ProgramArguments</key>
<array>
<string>/Users/[username]/Dropbox/[pathToScript]/pinboardBackup.sh</string>
javascript:window.location='pythonista://Import Pythonista Script from Bookmarklet?action=run&argv='+encodeURIComponent(document.location.href);
on run {}
set counter to 0
set theTask to text returned of (display dialog “This script will duplicate a task a given number of times and number the tasks accordingly.” default answer “Please enter the name of the task.”)
try
set repeatTimes to text returned of (display dialog “How many total times do you need to do this task?” default answer “Please enter a number with no text and no punctuation.”) as integer
on error
display dialog “Whups, I don’t think that worked. Try an integer next time.”
return
end try
set taskNote to text returned of (display dialog “If you’d like the task to have a note, enter it below.” default answer “”) as string