Skip to content

Instantly share code, notes, and snippets.

@pdxmph
pdxmph / panopticon_dummies.rb
Created August 9, 2012 20:30
Panopticon random YAML entry generator
#!/usr/bin/env ruby
require "forgery"
require "yaml"
1..10.times do |p|
entry = Hash.new
entry['note'] = Forgery::LoremIpsum.text( :sentence, 2,{:random => 1})
entry['date'] = Forgery::Date.date(:future => false,:min_delta => 0,:max_delta => 10)
@pdxmph
pdxmph / panopticon.rb
Last active October 10, 2015 01:37
Gather Evernote notes, flagged mail and recent bookmarks.
#!/usr/bin/env ruby
require "rubygems"
require "appscript"
include Appscript
require "active_support"
require "rss/1.0"
require "rss/2.0"
require "open-uri"
require "bitly"
require "cgi"
@pdxmph
pdxmph / automator_org.rb
Created September 4, 2012 20:35
append Automator input to org-mode inbox
inbox = File.open("/Users/Mike/Dropbox/org/inbox.org", "a")
ARGF.each do |f|
task = f.split("|")
line = "\n\n* TODO #{task[0].strip}\n"
line << "DEADLINE: <#{task[1].strip}>\n" if task[1]
inbox << line
end
inbox.close
@pdxmph
pdxmph / package-list.el
Created November 15, 2012 20:07
Install a list of Emacs packages
(defvar mph-packages
'(ack-and-a-half auctex clojure-mode coffee-mode deft expand-region
gist groovy-mode haml-mode haskell-mode inf-ruby
magit magithub markdown-mode paredit projectile python
sass-mode rainbow-mode scss-mode solarized-theme
volatile-highlights yaml-mode yari zenburn-theme)
"A list of packages to ensure are installed at launch.")
(defun mph-packages-installed-p ()
(loop for p in mph-packages
@pdxmph
pdxmph / gist:4156186
Created November 27, 2012 18:48
Fix broken Google Search box
<!-- in WordPress: Appearance -> Editor -> page.php -->
<form action="http://www.google.com/cse" id="cse-search-box">
<div>
<input type="hidden" name="cx" value="017884045025332504017:9pk9oihqlsu" />
<input type="hidden" name="ie" value="UTF-8" />
<input type="text" name="q" class="gsc-input" size="31" />
<input type="submit" name="sa" class="searchbtn" value="Search" />
</div>
@pdxmph
pdxmph / remove_xcode_cli.sh
Created December 10, 2012 01:14
Remove XCode Command Line Tools
RECEIPT_FILE=/var/db/receipts/com.apple.pkg.DeveloperToolsCLI.bom
RECEIPT_PLIST=/var/db/receipts/com.apple.pkg.DeveloperToolsCLI.plist
if [ ! -f "$RECEIPT_FILE" ]
then
echo "Command Line Tools not installed."
exit 1
fi
echo "Command Line Tools installed, removing ..."
@pdxmph
pdxmph / import_notes_app_to_evernote.applescript
Created December 16, 2012 22:39
Imports Notes from the Apple "Notes.app" app 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 ¬
title myTitle ¬
created myCreateDate ¬
#!/usr/bin/ruby
require "rubygems"
require "liquid"
template = <<TEMPLATE
{% assign version = '4.0.2' %}
{% if version contains '3.0' %}
@pdxmph
pdxmph / .dir_colors
Created February 11, 2013 00:43
Directory color mappings for GNU `ls --color=auto`
# Configuration file for dircolors, a utility to help you set the
# LS_COLORS environment variable used by GNU ls with the --color option.
# The keywords COLOR, OPTIONS, and EIGHTBIT (honored by the
# slackware version of dircolors) are recognized but ignored.
# Below, there should be one TERM entry for each termtype that is colorizable
TERM linux
TERM linux-c
TERM mach-color
alias ls="/usr/local/bin/gls"
if [ "$TERM" != "dumb" ]; then
export LS_OPTIONS='--color=auto'
eval \`gdircolors ~/.dir_colors\`
fi