Skip to content

Instantly share code, notes, and snippets.

View pdxmph's full-sized avatar

Mike Hall pdxmph

View GitHub Profile
@pdxmph
pdxmph / mailnotes2evernote.scpt
Created November 29, 2011 17:07
Convert Mac Mail Notes to Evernote (Applescript)
tell application "Mail"
set theMessages to every message of the mailbox "NoteMigrate"
repeat with thisMessage in theMessages
set myTitle to the subject of thisMessage
set myText to the content of thisMessage
set myCreateDate to the date sent of thisMessage
tell application "Evernote"
create note with text myText¬
@pdxmph
pdxmph / mailnote2evernote.rb
Created November 29, 2011 17:04
Convert Mac Mail Notes to Evernote
#!/usr/bin/env ruby
require 'rubygems'
require 'appscript'
include Appscript
en = app("Evernote")
mail = app("Mail")
notes_folder = mail.mailboxes["Imported Notes"]
@pdxmph
pdxmph / Compliance Filter Counts.rb
Created December 5, 2011 22:55
Compliance Filter Counts
#!/usr/bin/env ruby -wKU
require "rubygems"
require "appscript"
include Appscript
mail = app("Mail")
account = mail.accounts["Social Media Today"].get
inbox = account.mailboxes["INBOX"].get
@pdxmph
pdxmph / MailChimp Retrieve Preview of a Template.rb
Created December 21, 2011 00:09
MailChimp: Retrieve Preview of a Template
#!/usr/bin/env ruby
require "rubygems"
require "hominid"
require "net/http"
require "yaml"
config = YAML.load(File.open('smt_config.yml'))
api_key = config["mail_chimp"]["api_key"]
@pdxmph
pdxmph / autotweet_feed.rb
Created January 11, 2012 22:21
autotweet an rss feed
require "rss/1.0"
require "rss/2.0"
require "open-uri"
require "yaml"
require "sqlite3"
require "bitly"
require "active_record"
ActiveRecord::Base.establish_connection(
@pdxmph
pdxmph / get_ga_views.rb
Created January 17, 2012 07:11
Super-Quick Sinatra "Get the views from GA" server
require "rubygems"
require "sinatra"
require "garb"
require "active_support/all"
Garb::Session.login(google_user, google_password)
$profiles = Garb::Management::Profile.all
$profile = $profiles.detect {|p| p.id == "7294335" }
class PostStats
@pdxmph
pdxmph / db_dump.rb
Created February 28, 2012 18:51
Quick database backup script for a Drupal multisite
#!/usr/bin/env ruby
require "yaml"
require "optparse"
require "ostruct"
require "date"
config_file = File.open(File.expand_path('~') + "/etc/smt_config.yml")
acct_file = File.open(File.expand_path('~') + "/etc/smt_acct.yml")
@pdxmph
pdxmph / cull_inactive_user_feeds.php
Created May 11, 2012 17:52
Cull FeedAPI feed nodes of inactive contributors
<?php
// some counters
$c = 0;
$kept_feeds = 0;
$discarded_feeds = 0;
$too_new_feeds = 0;
// maximum inactive period in days
$last_published_cutoff = 180;
@pdxmph
pdxmph / mlion_notes_to_evernote.scpt
Created July 28, 2012 09:23
Mountain Lion Notes to Evernote
tell application "Notes"
set theNotes to every note of the folder "Notes"
repeat with thisNote in theNotes
set myTitle to the name of thisNote
set myText to the body of thisNote
set myCreateDate to the creation date of thisNote
tell application "Evernote"
create note with html myText ¬
@pdxmph
pdxmph / oo_to_org.rb
Created August 6, 2012 16:55
Simple OmniOutliner outline to org mode
#!/usr/bin/env ruby
require "rubygems"
require "appscript"
include Appscript
oo = app("OmniOutliner Professional")
outline = oo.documents[1].get