Skip to content

Instantly share code, notes, and snippets.

View kristianfreeman's full-sized avatar
🙃

Kristian Freeman kristianfreeman

🙃
View GitHub Profile
@kristianfreeman
kristianfreeman / applist.md
Created August 8, 2012 20:23
app list for App.net

Safari - Yup. I like Chrome, but I don't like Google. Lesser of two evils here, people.

Dropbox — all my documents are saved right into Dropbox. Nothing else. The retention length is long enough that I've literally never had a problem losing a file.

NValt - all my thoughts go here. Anything of any sort of length. My library card number? Hi NValt. My 10 page essay about Psychology? Hello NValt. All synced through Dropbox.

Transmission - things are acquired here. Don't ask questions.

Hazel - I have some complicated recipes being filtered through Hazel for keeping my Downloads folder relatively clean, as well as meticulously organizing my media collection for access from my Apple TV and other iOS devices.

@kristianfreeman
kristianfreeman / adn.rb
Created August 11, 2012 17:20
App.net backup
# requires "appnet.json" (exported from ADN) in the same folder
require 'json'
require 'date'
json = File.read('appnet.json')
parsed = JSON.parse(json)
f = File.new("appdotnet.txt", "a")
@kristianfreeman
kristianfreeman / dayone-adn.rb
Created August 11, 2012 18:10
Export into my Day One format for App.net posts
require 'json'
require 'date'
json = File.read('appnet.json')
parsed = JSON.parse(json)
f = File.new("dayoneappdotnet.txt", "a")
@kristianfreeman
kristianfreeman / gistsnip.md
Created August 13, 2012 20:15
TE snippet for iTunes Now Playing Output

A simple TextExpander snippet for pasting a nice-looking version of your "Now Playing" from iTunes. Uses Applescript — if you have a different music player (Spotify, for example), it probably has similar Applescript support.

For example: ♫ "My Favourite Things" - John Coltrane (The Very Best of John Coltrane, 2000)

set the_string to ""

tell application "iTunes"
   if player state is playing then
      set the_string to "\"" & name of current track & "\""

if artist of current track is not "" then

@kristianfreeman
kristianfreeman / subtitle-search
Created August 18, 2012 05:28
alfred search for subs on open subtitle
@kristianfreeman
kristianfreeman / instagram-captions.md
Created August 24, 2012 04:37
Adding captions to Instagram photos with Slogger/Day One

One of my gripes with Slogger is that when Instagram photos are added, they have no text captions. This makes sense though — the built-in system for adding photos is really as simple as passing the image as an argument.

Still, there had to be a way to make this work! I decided that with a little tweaking of my current IFTTT script, I could get captions included in my Day One entries.

The best way to do this is to setup your IFTTT script to download photos to Dropbox with good file-names. Mine's really simple; it's just CAPTION.jpg. Yep. With the text parsing I'm doing, this works just fine. If I want to sort by date, I can simply sort in Finder by "Date Added". No complaints there. Now for the code.

Let's start with slogger_image.rb, the file used for importing Instagram photos.

After line 12, we see where the file is added as a variable:

@kristianfreeman
kristianfreeman / applescript-markdown-urls.md
Created August 30, 2012 04:35
Applescript TE snippet for automation of Safari link pulling
set linkText to "%fill:text%"

try
    tell application "Safari"
        set currentURL to URL of current tab of front window
    end tell
    set link to "[" & linkText & "](" & currentURL & ") "
    return link
on error

"None"

@kristianfreeman
kristianfreeman / depart
Created September 5, 2012 08:02
Using mencoder to combine AVIs... legal AVIs.
#!/bin/sh
echo "Checking for mencoder..."
if ! type "mplayer" > /dev/null; then
echo "mencoder not found. Attempting install with brew"
if ! type "brew" > /dev/null; then
echo "Homebrew not installed. Fail."
exit
fi
@kristianfreeman
kristianfreeman / tent.rb
Created October 2, 2012 03:48
Tent.is posts to Day One
## Tent.io work
require 'json'
require 'time'
# Change these to suit your needs
# You probably don't want my posts.
username = "kmf"
post_location = "/Users/kristian/Dropbox/ifttt/tent"
Dir.chdir post_location
square = File.new "foursquare.kml"
date_array = Array.new
square.readlines.each do |line|
date = line.match(/<updated>\w*, \S* \w* \S* \S* \+0000<\/updated>/)
date_array << date
end
puts date_array