Skip to content

Instantly share code, notes, and snippets.

@craigeley
craigeley / insert_location.py
Last active August 29, 2015 13:56
A Pythonista script that simply copies latitude and longitude to the clipboard
# -*- coding: utf-8 -*-
# To call script, use the follwing URL Action:
# - <pythonista://insert_location.py?action=run&argv=nav>
import location
import urllib
import webbrowser
import time
import clipboard
@craigeley
craigeley / hours_to_day_one.rb
Last active August 29, 2015 13:56
Takes a comma separated text file and imports all of the lines into individual day one entries. For more information, see:
#!/usr/bin/ruby
# Reads an hourly log file with comma separated values
# Change the path to your Day One folder on line 43
# Change the path to your text file in line 45
require 'time'
require 'erb'
require 'date'
starred = false
@craigeley
craigeley / tasks_to_logbook.rb
Last active August 29, 2015 13:57
This script finds TaskPaper items in a specific folder completed with this format: "@done(yyyy-mm-dd HH:MM)", moves and converts them into Sifttter format, and then deletes them.
#!/usr/bin/env ruby
# encoding: utf-8
require 'time'
files = Dir["/Users/USERNAME/Dropbox/Listacular/*.taskpaper"]
projects = []
found_completed = false
files.each do |file|
@craigeley
craigeley / tasks_to_busy_cal.rb
Last active August 29, 2015 14:00
Allows you to mirror Taskpaper enrties to BusyCal as Reminders
# Mirror TaskPaper Files in BusyCal by Craig Eley 2014
#!/usr/bin/env ruby
# encoding: utf-8
require 'time'
files = Dir["/Users/Path/To/Listacular/*.taskpaper"]
item = ''
due = ''
@craigeley
craigeley / foursquare_checkin.py
Last active August 29, 2015 14:05
A Pythonista script that logs you into Foursquare. See http://craigeley.com/08-18-2014/foursquare-pythonista/ for more information.
# -*- coding: utf-8 -*-
# To call script, use the follwing URL Action:
# - <pythonista://foursquare_checkin.py?action=run>
# Replace the information in lines 21-23 with your actual client and authorization codes.
import location
import re
import sys

Keybase proof

I hereby claim:

  • I am craigeley on github.
  • I am craigeley (https://keybase.io/craigeley) on keybase.
  • I have a public key whose fingerprint is CC2E 4AE9 28DA E157 B92B 8836 A6B7 72EA 445E 9C04

To claim this, I am signing this object:

@craigeley
craigeley / read_later.rb
Last active December 15, 2015 02:14
A simple Ruby script that uses the Readability API to save articles for offline viewing and storage. Create a Readability API key at https://www.readability.com/settings/account
#!/usr/bin/ruby
require 'json'
require 'erb'
require 'open-uri'
# Uncomment these lines if you are having encoding issues on OS X Yosemite
# if RUBY_VERSION =~ /2.0.0/
# Encoding.default_external = Encoding::UTF_8
# Encoding.default_internal = Encoding::UTF_8
@craigeley
craigeley / foursquare_location_data.rb
Last active December 15, 2015 02:14
Best used with Hazel to grabs location data from the Foursqure API after an IFTTT-generated file changes in your Dropbox.
#!/usr/bin/ruby
# encoding: utf-8
# Grab Foursquare location data from an IFTTT-generated text file
# Because of the Grep searches, this will work best with this recipe: https://ifttt.com/recipes/187849
# Change line 15 with the location of your IFTTT file
# Make sure to change line 25 with your personal client ID and secret generated by Foursquare
# Once you have the data, you can output or write it however you like.
require 'open-uri'
@craigeley
craigeley / sb-writing.rb
Last active December 23, 2015 04:59
Scans a folder for writing files and updates an HTML file stored in Dropbox which can be read by Status Board
#!/usr/bin/env ruby
# sb-writing.rb - Monitor Daily Writing Progress with Status Board
# by Craig Eley <http://craigeley.com> | @craigeley
# Based loosely on tp-dailylog.rb by Brett Terpstra <https://gist.github.com/ttscoff/1913007>
# Finds files modified in the last day from a specific folder
# Sends modification time, title, and word count to an HTML file in a Dropbox Folder
# Add the path to your files on line 13
# Add path to Dropbox and name your HTML file on line 41
# Includes a pencil icon as an image; feel free to adjust in line 25
# Use Lingon or Hazel to set it to run at an interval or when files change
@craigeley
craigeley / recurring_taskpaper_task.rb
Last active February 28, 2016 18:43
Set this script to run at various times using launchd to automatically add lines to TaskPaper files if they don't exist. A solution for recurring tasks for plain-text task management.
#!/usr/bin/ruby
# Change to your filepath in lines 9 and 12
# Add your exact search term to line 9
# Add your exact to-do in line 13
require 'time'
today = Time.now.strftime('%Y-%m-%d')
if File.readlines('/Users/USERNAME/Dropbox/Listacular/list.taskpaper', encoding: 'UTF-8').grep(/TERM/).any?
exit