Skip to content

Instantly share code, notes, and snippets.

@wisnij
Created May 10, 2019 18:22
Show Gist options
  • Save wisnij/b1bbae0dcf6ae479589d3e9b0b8ab77c to your computer and use it in GitHub Desktop.
Save wisnij/b1bbae0dcf6ae479589d3e9b0b8ab77c to your computer and use it in GitHub Desktop.
A simple script to make printers display a silly message
#!/usr/bin/perl
use strict;
use warnings;
use IO::Socket::INET;
my ($host, $msg) = @ARGV;
$host ||= '...';
$msg ||= 'FEED ME A STRAY CAT';
my $port = 9100;
print "setting message on $host to '$msg'\n";
my $sock = IO::Socket::INET->new( PeerAddr => $host,
PeerPort => $port,
Proto => 'tcp' )
or die "$0: $host:$port: $!\n";
print $sock qq(\x1B%-12345X\@PJL RDYMSG DISPLAY = "$msg"\r\n\x1B%-12345X\r\n);
print "done\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment