Wednesday, October 31, 2007

DO NOT TALK ABOUT FIGHT CLUB



photo by HQ Jon

Tuesday, October 30, 2007

REMOVE SQUIRREL IN TRAY

Monday, October 29, 2007

INSERT BEER

Friday, October 26, 2007

PC LOAD BACON

Check Bacon Tray



photo by bradluyster

Thursday, October 25, 2007

YOU DANCE, I PRINT

Wednesday, October 24, 2007

twitter2hp.rb - post twitter items to your printer

This simple ruby script reads the specified twitter RSS feed and posts the latest item to your HP printer. Use it to post local weather, pithy quotes, or my favorite, the lolprinters twitter feed :-)

Stick it in cron to run every hour or so to keep those messages fresh!


#!/usr/local/bin/ruby

# twitter2hp.rb - loads a twitter RSS feed
# and posts the latest entry
# to the specified hp printer

#change to your printer's IP
printer_ip = '127.0.0.1'
#RSS feed to grab
rss_url = "http://twitter.com/statuses/user_timeline/9547912.rss"

# www.lolprinters.com

# simplified version of the code from
# http://snippets.dzone.com/posts/show/3714
# (removed sqlite data store)

require 'rubygems'
require 'simple-rss'
require 'open-uri'
require 'socket'

#rss feed to post
#http://twitter.com/lolprinters
rss_user_agent = "twitter2hp.rb"
rss = SimpleRSS.parse open(rss_url ,"User-Agent" => rss_user_agent)

# you can use the gsub to strip out the username
# that gets added by twitter
puts "#{rss.items.first.title.gsub(/lolprinters: /, '')}"

hpcommand = <<EOF
\e%-12345X\@PJL JOB"
\@PJL RDYMSG DISPLAY="#{rss.items.first.title.gsub(/lolprinters: /, '')}"
\@PJL EOJ
\e%-12345X
EOF

include Socket::Constants
socket = Socket.new( AF_INET, SOCK_STREAM, 0 )
sockaddr = Socket.pack_sockaddr_in( 9100, printer_ip )
socket.connect( sockaddr )
socket.write( hpcommand )
socket.close


This script uses some code from RSS Twitter Bot. Thanks! I originally spotted the HP ready message hack on this BoingBoing post

STAND BACK 3 FEET

YOUR PRINT REQUEST WAS DEEMED UNWORTHY OF MY TIME



photo by spoodie

Tuesday, October 23, 2007

PC LOAD LETTER



photo by mikeciz

Monday, October 22, 2007

OUT OF VOWELS



photo by toddandina

Friday, October 19, 2007

Ruby Script to Change the Default Message on HP Printers

Yaakov wrote a sweet little Perl script to change the default message on HP printers. Here is the ruby version of this script, which I saved as hpset.rb:

#!/usr/local/bin/ruby

if ARGV.size != 2
puts "Usage: #{$0} [printer_ip_address] \"message\""
puts "Note: don't forget the quotes around your message"
exit
end

hpcommand = <<EOF
\e%-12345X\@PJL JOB"
\@PJL RDYMSG DISPLAY="#{ARGV[1]}"
\@PJL EOJ
\e%-12345X
EOF

require 'socket'
include Socket::Constants
socket = Socket.new( AF_INET, SOCK_STREAM, 0 )
sockaddr = Socket.pack_sockaddr_in( 9100, ARGV[0] )
socket.connect( sockaddr )
socket.write( hpcommand )
socket.close


This thing is a blast. If there is any interest I'll post funny message ideas on this blog from time to time.