Archive: Perl
October 17, 2007
Change the message on HP printers

A lesser-known feature of the HP Printer Job Language (HPPJL) command set is that you can change the ready message" from "READY" to whatever you like. Yaakov wrote a Perl script that will change the message for you, and he also came up with the clever "INSERT COIN" replacement. Very nice.
You can think up your own funny, confusing or scary messages. My personal favorite is "INSERT COIN" which fits perfectly on the small LCDs. You can even sit in sight of the printer and change the message while watching the reaction of your victim. Don't be surprised, though, if a large fraction don't even notice. I was quite surprised myself but, it appears, some people don't look at what is in front of them.
I haven't been able to test yet (no HP printer here), but if I'm reading the code right, you can actually do this right from the command line using telnet. Just telnet to port 9100 and type in the following:
\e%-12345X\@PJL JOB \@PJL RDYMSG DISPLAY="MESSAGE HERE" \@PJL EOJ \e%-12345X
INSERT COIN: changing the "Ready Message" on HP printers - [via] Link
HP LaserJet Commands (PDF) - Link
Posted by Jason Striegel |
Oct 17, 2007 09:50 PM
Perl |
Permalink
| Comments (10)
| TrackBack
| Digg It
| Tag w/del.icio.us
June 21, 2007
Whistle to control your computer
R2D2 was on to something. Think easier speech recognition with reduced error rates:
Use Linux® or Microsoft® Windows®, the open source sndpeek program, and a simple Perl script to read specific sequences of tonal events -- literally whistling, humming, or singing at your computer -- and run commands based on those tones. Give your computer a short low whistle to check your e-mail or unlock your your screensaver with the opening bars of Beethoven's Fifth Symphony. Whistle while you work for higher efficiency.
This ought to be nostalgic for all of you who remember trying to whistle a successful modem handshake sequence. (Someone please tell me I'm not the only nerd in the room who did this for kicks.)
Whistle while you work to run commands on your computer - Link
Posted by Jason Striegel |
Jun 21, 2007 09:49 PM
Linux, Perl, Windows |
Permalink
| Comments (0)
| TrackBack
| Digg It
| Tag w/del.icio.us
April 10, 2007
AppleTV Perl plugin




Phil @ Make writes: Erica has a special treat for Perl folks with Apple TVs!
On Sunday, with a hundred better things to do but no incentive to do them, I put together an Apple TV plug-in that allows you to run any Perl script you place into a folder in your home directory. (/Users/frontrow/perlbin).The plug-in is here - Link (zip).
The idea is this: a lot of people know how to write Perl who don't want to learn to program Cocoa. And you can add new scripts from your normal office work computer (via ssh) but have them all available from Apple TV. You can do date & time, calendars, stock quotes, weather, and so forth. Scrape web pages, subscribe to RSS feeds, whatever.
Related:
- HOW TO - Run AppleTV on a Mac mini - Link.
- AppleTV OS on a Mac mini - Link.
- AppleTV hack weekend - Link.
Posted by |
Apr 10, 2007 06:00 AM
AppleTV, Mac, Perl |
Permalink
| Comments (0)
| TrackBack
| Digg It
| Tag w/del.icio.us
February 26, 2007
Translate SQL Syntax Between Databases
SQL::Translator is an interesting Perl module that, among other things, can convert database table definitions to and from several DB platforms. Essentially, this could allow you to write and maintain your table definition code for a single platform, say MySQL, and then use Translator to output table structure into Oracle, Sybase, or PostgreSQL dialects.
Manipulation of data, such as SELECT, INSERT, UPDATE and DELETE are not yet supported, so you're still on your own there if you're writing platform agnostic code. That said, this is an incredibly useful tool. Just consider this example that Chris Dolan posted on use Perl:
MySQL understands this syntax:create table book (
id int,
author_id int,
FOREIGN KEY fk_author_id (author_id) REFERENCES author (id)
) TYPE=InnoDB;but not this nicer syntax (it silently ignores the "references" clause):
create table book (
id int,
author_id int references author (id),
) TYPE=InnoDB;Perl to the rescue! I can write my schema in the latter syntax and use SQL::Translator to rewrite into the supported syntax.
References:
- MySQL foreign key syntax translator (4 line perl script!)
- SQL::Translator on CPAN
Posted by Jason Striegel |
Feb 26, 2007 12:14 AM
Data, MySQL, Perl |
Permalink
| Comments (0)
| TrackBack
| Digg It
| Tag w/del.icio.us
February 25, 2007
Linux Commands You've Never Used
# lsof | grep TCP portmap 2587 rpc 4u IPv4 5544 TCP *:sunrpc (LISTEN) rpc.statd 2606 root 6u IPv4 5585 TCP *:668 (LISTEN) sshd 2788 root 3u IPv6 5991 TCP *:ssh (LISTEN) sendmail 2843 root 4u IPv4 6160 TCP badhd:smtp (LISTEN) vsftpd 9337 root 3u IPv4 34949 TCP *:ftp (LISTEN) cupsd 16459 root 0u IPv4 41061 TCP badhd:ipp (LISTEN)
Here's a short list of useful Linux shell programs, many of which you may have never known about. I've got a new favorite shell command, lsof (shown above), which displays information on every open file handle. - Link.
If I could add one to the list, it'd have to be the short and sweet command line search and replace using perl:
perl -pi -e 's/searchpattern/replacewith/g' *.html
Do you have a favorite command line secret? Please share it in the comments.
Posted by Jason Striegel |
Feb 25, 2007 12:30 AM
Linux, Perl |
Permalink
| Comments (6)
| TrackBack
| Digg It
| Tag w/del.icio.us
January 5, 2007
Command Line Zip for Windows
Go-to Hacks author Paul Bausch shares another productivity problem he's solved for himself with a bit of hacking:
Windows doesn't have a command line utility for compressing files (that I know of), and I had to come up with a way to automate some file transfers today. So I whipped up a tiny Perl script that will zip up a file.He adds that his hack works well with Windows batch files and will save him a bunch of bandwidth. If Paul's homegrown fix looks like something you could use too, check out his site for the code.
Posted by |
Jan 5, 2007 04:38 AM
Perl, Windows |
Permalink
| Comments (2)
| TrackBack
| Digg It
| Tag w/del.icio.us
Bloggers
Welcome to the Hacks Blog!
Categories
- Ajax
- Amazon
- AppleTV
- Astronomy
- BlackBerry
- Blogging
- Body
- Cars
- Cryptography
- Data
- Design
- Education
- Electronics
- Energy
- Events
- Excel
- Excerpts
- Firefox
- Flash
- Flickr
- Flying Things
- Food
- Gaming
- Gmail
- Google Earth
- Google Maps
- Government
- Greasemonkey
- Hacks Series
- Hackszine Podcast
- Halo
- Hardware
- Home
- Home Theater
- iPhone
- iPod
- IRC
- iTunes
- Java
- Kindle
- Knoppix
- Language
- LEGO
- Life
- Lifehacker
- Linux
- Linux Desktop
- Linux Multimedia
- Linux Server
- Mac
- Mapping
- Math
- Microsoft Office
- Mind
- Mind Performance
- Mobile Phones
- Music
- MySpace
- MySQL
- NetFlix
- Network Security
- olpc
- OpenOffice
- Outdoor
- Parenting
- PCs
- PDAs
- Perl
- Philosophy
- Photography
- PHP
- Pleo
- Podcast
- Podcasting
- Productivity
- PSP
- Retro Computing
- Retro Gaming
- Science
- Screencasts
- Security
- Shopping
- Skype
- Smart Home
- Software Engineering
- Sports
- SQL
- Statistics
- Survival
- TiVo
- Transportation
- Travel
- Ubuntu
- Video
- Virtualization
- Visual Studio
- VoIP
- Web
- Web Site Measurement
- Windows
- Windows Server
- Wireless
- Word
- World
- Xbox
- Yahoo!
- YouTube
Archives
Recent Posts
- HOWTO fly in the US without a wallet
- Run homebrew games on the PSP Slim
- Edit binary files in Vi
- Dell Inspiron 1525 HackBook Pro
- Ken Schwaber on Scrum
- Memcached and high performance MySQL
- iPhone SDK tutorial - simple RSS reader
- Shield your files with Reed-Solomon codes
- Photos of the Large Hadron Collider
- Magnetic stripe card spoofer
www.flickr.com
|





Recent comments