Skip to content

Instantly share code, notes, and snippets.

View ohammersmith's full-sized avatar

Otto Hammersmith ohammersmith

View GitHub Profile
@ohammersmith
ohammersmith / snippet.txt
Created November 19, 2008 22:00
MacBook Pro kernel panic
This was the kernel panic that gave me the grey screen of death before having Apple replace the main logic board.
Wed Nov 19 16:49:21 2008
panic(cpu 0 caller 0x001A8CEC): Kernel trap at 0x0019c5fa, type 14=page fault, registers:
CR0: 0x80010033, CR2: 0x00000000, CR3: 0x0143d000, CR4: 0x00000660
EAX: 0x00000019, EBX: 0x5be6388c, ECX: 0x00000000, EDX: 0x5be6388c
CR2: 0x00000000, EBP: 0x5be637a8, ESI: 0x00000019, EDI: 0x00000003
EFL: 0x00010202, EIP: 0x0019c5fa, CS: 0x00000008, DS: 0x5be60010
Error code: 0x00000000
@ohammersmith
ohammersmith / gist:32498
Created December 5, 2008 20:24 — forked from tomharris/gist:32495
Using Google Maps API to get coordinates of an address.
require "net/http"
require "uri"
module Google
class Geocode
attr_accessor :address
attr_reader :key, :latutude, :longitude
def initialize( key, address )
@key = key
@ohammersmith
ohammersmith / gist:34038
Created December 9, 2008 19:07
Get time in a way the database likes
Time.now.utc.to_s(:db)
@ohammersmith
ohammersmith / Reasons git would solve world hunger.markdown
Created December 9, 2008 21:52
Reasons git would solve world hunger

Reasons we should upgrade to git.

  • vendor/rails without a Subversion mirror is a pain in my ass.
  • Even if we did have vendor/rails somehow, we couldn't maintain local patches.
  • Merging doesn't suck.
  • That server crash wouldn't have put our source history in jeopardy.
  • "That Guy" can commit as much as he wants without breaking trunk.
  • I won't have to pare down my pr0n and music collection, since my repository will be smaller than a single SVN check out
  • I won't have to pare down my pr0n and music collection, I won't have to check out a dozen different branches.
  • We could use cool git features like annotate.
@ohammersmith
ohammersmith / gist:34352
Created December 10, 2008 15:45
Sniff Windows platform in Ruby
if RUBY_PLATFORM =~ /mswin|mingw/
begin
require 'win32/open3'
rescue LoadError
warn "You must 'gem install win32-open3' to use the github command on Windows"
exit 1
end
else
require 'open3'
end
Yet another file.
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
<<<<<<< HEAD:file5.txt
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
=======
tempor blah blah blah et dolore magna aliqua. baz baz baz baz baz,
>>>>>>> 6be17bd... Adding some baz's to join the blah's.:file5.txt
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
gnod:git-rebase-test otto$ git checkout version_1_0
Switched to branch "version_1_0"
gnod:git-rebase-test otto$ git cherry-pick 6be17bdbf6c87247ac7c2cbeb02ffa760e52cd39
Auto-merged file5.txt
CONFLICT (content): Merge conflict in file5.txt
Automatic cherry-pick failed. After resolving the conflicts,
mark the corrected paths with 'git add <paths>' or 'git rm <paths>' and commit the result.
When commiting, use the option '-c 6be17bd' to retain authorship and message.
@ohammersmith
ohammersmith / gist:35285
Created December 12, 2008 21:54
Does this mean I'm addicted?
root@monitor:~# cd /etc/munin/
root@monitor:/etc/munin# ls
munin-node.conf munin.conf plugin-conf.d plugins templates
root@monitor:/etc/munin# git init
Initialized empty Git repository in .git/
root@monitor:/etc/munin#
def initialize(attributes = nil)
@attributes = attributes_from_column_definition
@attributes_cache = {}
@new_record = true
ensure_proper_type
self.attributes = attributes unless attributes.nil?
self.class.send(:scope, :create).each { |att,value| self.send("#{att}=", value) } if self.class.send(:scoped?, :create)
result = yield self if block_given?
callback(:after_initialize) if respond_to_without_attributes?(:after_initialize)
result
#!/usr/bin/ruby
require 'rubygems'
require 'git'
log = "~/gitlog.txt"
tmp = "/tmp/gitlog"
commit = Git.open('.').log.first
message = [
commit.date.strftime('%D'),