Skip to content

Instantly share code, notes, and snippets.

@pdxmph
pdxmph / make_data.rb
Last active May 17, 2022
Populate Jekyll data directories with the jpegs found in _galleries/foo.
View make_data.rb
#!/usr/bin/env ruby
require 'yaml'
require 'mini_exiftool'
# Run this in the root of your jekyll install.
gallery_name = ARGV[0]
target_dir = "_galleries/#{gallery_name}"
data_file = "_data/galleries/#{gallery_name}.yml"
@pdxmph
pdxmph / jekyll_gallery_data.md
Last active May 16, 2022
Using Jekyll data to provide descriptions to a cheesy-gallery gallery
View jekyll_gallery_data.md
@pdxmph
pdxmph / rfc_template.md
Last active Apr 19, 2022
Simple Markdown RFC template
View rfc_template.md

RFC: TEMPLATE

Summary:

**Created: **

**Deadline/Timeframe: **

DACI

**Driver: **

@pdxmph
pdxmph / kcrw_current_track_to_things.rb
Last active May 15, 2020
Save current KCRW Eclectic 24 track to a Things list
View kcrw_current_track_to_things.rb
#!/usr/bin/env ruby
require 'json'
require 'date'
require 'net/http'
require 'rb-scpt'
include Appscript
# Set up things
list = "To read, etc."
View sky-pirates.md

February 6, 2010 at 2:02:28 AM PST

Taking the Dumb Pipe to China

Note: This story finally ended

webex.jpg

So, yesterday I tweeted:

Dialed an 866 WebEx number on my iPhone, getting charged by AT&T for calling China. idontevenknowwhotoblamefail

@pdxmph
pdxmph / increase_itunes_playlist_volume.scpt
Created Aug 9, 2019
Make the tracks in a playlist louder (experimental)
View increase_itunes_playlist_volume.scpt
tell application "iTunes"
set myList to the user playlist "Ride"
set myTracks to the file tracks of myList
repeat with theTrack in myTracks
tell theTrack
set the volume adjustment to "75"
end tell
end repeat
end tell
@pdxmph
pdxmph / sprint_animal.rb
Last active Apr 1, 2019
Animal Sprint Name Generator: takes a letter and a sentiment as arguments. (e.g.`sprint_animal.rb a negative` or `sprint_animal.rb z positive`
View sprint_animal.rb
#!/usr/bin/env ruby
require 'sentimental'
# takes two arguments (starting letter and sentiment, where sentiment should be 'positive,' 'negative,' 'neutral.')
letter = ARGV[0]
sentiment = ARGV[1] || "negative"
analyzer = Sentimental.new(threshold: 0.3)
analyzer.load_defaults
@pdxmph
pdxmph / mutt_scores.md
Last active Mar 24, 2019
Notes on mutt scoring, coloring, and macros
View mutt_scores.md

I spent a lot of time messing around with mutt this week. At first I was just trying to get a working config back in place, so there was some noodling with OfflineIMAP. Then I moved on to cleaning up my authentication stuff: Due to an inconsistency in names on my work and personal computers, I needed to get some hard-coded values out of a few scripts.

Today, I spent a lot of time working on scoring, which is where I think mutt diverges from most other mail clients in the way that's most meaningful to me.

mutt's scoring tools let you assign scores to mail based on just about any characteristic of an email. You can match patterns on subject, sender, recipient, age, read/unread status, attachments, etc. etc. and then use those patterns to increment scores on individual messages.

Here are a few examples:

# Bump people in my aliases
View ruby_get_password.rb
#!/usr/bin/ruby
account = ARGV[0] # account name, e.g. pdxmph@gmail.com
server = ARGV[1] # account server, e.g. imap.gmail.com
user = `whoami`.strip!
keychain_path = "#{ENV['HOME']}/Library/Keychains/login.keychain"
params = {'security' => '/usr/bin/security',
'command' => 'find-internet-password',
'account' => account,
@pdxmph
pdxmph / scoremail.rb
Last active Mar 23, 2019
Mutt scoring script
View scoremail.rb
#!/usr/bin/env ruby
require 'mail'
# read STDIN in binmode to flatten out messages with encoding issues, weird attachments or whatever
mail = Mail.new STDIN.binmode.read
# should be a value like "+20" or "-10"
args = ARGV[0]
# assume you keep your scores file in the same directory as this script and call it `scores`