Skip to content

Instantly share code, notes, and snippets.

Avatar

Owen oparrish

View GitHub Profile
@oparrish
oparrish / feedwrangler-unread.py
Created Feb 10, 2015
Outputs current unread count, feed title, and publish date of last read item in your Feed Wrangler account
View feedwrangler-unread.py
import requests
import json
import time
import sys
def get_feed(access_token, feed_id, offset=0, limit=1000, read='false', published_since='1'):
feed_payload = {'access_token': access_token, 'read': read, 'feed_id': feed_id, 'offset': offset, 'published_since': published_since, 'limit': limit}
feed_r = requests.get('https://feedwrangler.net/api/v2/feed_items/list_ids', params=feed_payload)
feed_data = json.loads(feed_r.text)
@oparrish
oparrish / get_m4a_duration.py
Last active Dec 29, 2015
Output the duration for an M4A
View get_m4a_duration.py
#!/usr/local/bin/python
import sys
from mutagen.mp4 import MP4
m4a_file = sys.argv[1]
m4a = MP4(m4a_file)
length_secs = m4a.info.length
@oparrish
oparrish / SSH.py
Created Nov 14, 2013
AutoKey (https://code.google.com/p/autokey/) script to open a new tab in Terminator with SSH to selected IP.
View SSH.py
import subprocess
import re
try:
host = clipboard.get_selection()
host = host.strip()
pattern = re.compile("^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$")
validHost = pattern.match(host)
if validHost:
@oparrish
oparrish / cue_to_html.rb
Last active Dec 26, 2015
Ruby script to format a CUE sheet as HTML output
View cue_to_html.rb
require 'rubycue'
require 'optparse'
options = {}
opts = OptionParser.new do |opts|
opts.on("-c", "--cue PATH", "Path to chesheet file") do |cue_file|
options[:cue] = cue_file
end
end
@oparrish
oparrish / podcast.rb
Created Mar 31, 2012
Create podcast from directory
View podcast.rb
require 'rss/maker'
require 'optparse'
require 'uri'
options={}
opts = OptionParser.new do |opts|
opts.on("-d", "--directory DIRECTORY", "Director of files") do |directory|
options[:directory] = directory
end
@oparrish
oparrish / audio_tag.rb
Created Mar 6, 2012
Jekyll tag plugin for creating HTML 5 audio element based on a list of source files
View audio_tag.rb
module Jekyll
class AudioTag < Liquid::Tag
def initialize(tag_name, files, tokens)
super
@files = files
end
def render(context)
HTML << '<audio controls="controls">'
@oparrish
oparrish / bootstrap_pagination_helper.rb
Created Sep 28, 2011
Link renderer to be used with will_paginate to render links to work with Twitter Bootstrap
View bootstrap_pagination_helper.rb
module BootstrapPaginationHelper
class LinkRenderer < WillPaginate::ActionView::LinkRenderer
protected
def page_number(page)
unless page == current_page
link(page, page, :rel => rel_value(page))
else
link(page, "#", :class => 'active')
end
@oparrish
oparrish / assets_deploy.rb
Created Sep 20, 2011
Rake task for copying Rails compiled assets to S3
View assets_deploy.rb
require 'aws/s3'
require 'digest/md5'
require 'mime/types'
## These are some constants to keep track of my S3 credentials and
## bucket name. Nothing fancy here.
AWS_ACCESS_KEY_ID = ENV['S3_KEY']
AWS_SECRET_ACCESS_KEY = ENV['S3_SECRET']
AWS_BUCKET = ENV['S3_BUCKET']
@oparrish
oparrish / Script.sh
Created Aug 25, 2011
Bash script for transcoding videos to AppleTV format to be used by an Alfred extension
View Script.sh
#!/bin/bash
#transcode.sh
#By Don Southard aka @binaryghost
#
#[UPDATE 6/01/2011 08:01:15PM]
#Idea and initialcode for Alfred progress bar by Andreas Heiberg
#Completly rewritten code by Don Southard
#
#[UPDATE 6/02/2011 08:58:09PM]
#Support for queueing, added information about queue status and ETA'S and the move the old file to trash feature
@oparrish
oparrish / gist:1134751
Created Aug 9, 2011
Move Message(s) to All Mail
View gist:1134751
tell application "Mail"
set theSelectedMessages to selection
set theMailbox to "[Gmail]/All Mail"
repeat with theMessage in theSelectedMessages
set messageAccount to account of mailbox of theMessage
tell application "Mail"
move the theMessage to mailbox theMailbox of messageAccount
end tell
end repeat
You can’t perform that action at this time.