Skip to content

Instantly share code, notes, and snippets.

View ivey's full-sized avatar

Michael D. Ivey ivey

View GitHub Profile
@ivey
ivey / tdu
Created March 23, 2009 02:43
du -sk . * | perl -e '$sum=<>;
while (<>) {
($size, $inode)=split;
chop $size;
printf("%30s | %5d | %2.2f%%\n",$inode,$size,$size/$sum*1000);
}' | sort -rn -k 3 | head
namespace :git do
task :unpushed do
ahead = `git log origin/#{branch}..#{branch} --pretty=oneline --abbrev-commit`
unless ahead == ""
puts "Whoa, hoss. Looks like you forgot to push the following SHAs:"
puts ahead
print "Continue with the deploy anyway? [y/N] "
if $stdin.gets.chomp.upcase != "Y"
puts "Good call. `git push` and come back."
exit
I assume you've played w/ mutli-tty by now, but if not, check it out.
alias emacs='/Applications/Emacs.app/Contents/MacOS/bin/emacsclient -t'
This means I can run emacs in a Terminal window and have it run in the same
Emacs process as the GUI app. Same buffers, same settings...just another
window on the same app.
Best reason to compile your own...neither Aquamacs or Carbon Emacs have
multitty support yet, AFAIK.
(defun butterfly ()
"Use butterflies to flip the desired bit on the drive platter.
Open hands and let the delicate wings flap once. The disturbance
ripples outward, changing the flow of the eddy currents in the
upper atmosphere. These cause momentary pockets of higher-pressure
air to form, which act as lenses that deflect incoming cosmic rays,
focusing them to strike the drive platter and flip the desired bit.
You can type `M-x butterfly C-M-c' to run it. This is a permuted
variation of `C-x M-c M-butterfly' from url `http://xkcd.com/378/'."
(interactive)
# Here's the example from the book:
input = ''
while input != 'bye'
puts input
input = gets.chomp
end
puts 'Come again soon!'
require 'fileutils'
class Jekyll < Thor
include FileUtils
method_options :format => :optional
def draft(name)
format = options[:format] || "markdown"
slug = name.downcase.gsub(/ +/,'-').gsub(/[^-\w]/,'').sub(/-+$/,'')
filename = slug + ".#{format}"
# Copyright 2009 Michael Ivey, released to public domain
# Disqus guts lifted from http://github.com/squeejee/disqus-sinatra-importer/tree/master
# I wanted it to run from MySQL and command line, instead of a Sinatra app
require 'rubygems'
require 'feed_tools'
require 'rest_client'
require 'json'
require 'sequel'
(defun add-vendor-directories ()
(interactive)
(mapc '(lambda (dir)
(if (and
(cadr dir)
(not (equal (car dir) "."))
(not (equal (car dir) "..")))
(add-to-list 'load-path (concat "~/.elisp/vendor/" (car dir)))))
(directory-files-and-attributes "~/.elisp/vendor")))
require 'sinatra-merb'
# use_orm :datamapper
# use_test :rspec
# use_template_engine :erb
get "/" do
"<h1>It works!</h1>"
end
curl http://merbcamp.com/video 2>&1 |grep mp4|sed -e 's/.*href="/http:\/\/merbcamp.com/' -e 's/">.*//'|xargs -n 1 wget