Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Code Catacombs

( #1747=superdoc: print w/replies, xml ) Need Help??

This section is now closed for posting code. Please use Cool Uses For Perl instead.

Code Categories
Audio Related ProgramsFTP stuffNT Admin
CGI ProgrammingFun StuffWin32 Stuff
Chatterbox ClientsGUI ProgrammingMiscellaneous
CryptographyHTML UtilityText Processing
Database ProgrammingUtility ScriptsNetworking Code
E-Mail ProgramsWeb StuffPerlMonks Related Scripts

New Code
Perl wrapper for unrar.dll
on Mar 19, 2009 at 07:09
0 replies by nikosv
The unrar.dll library is written in C and provides functions for extracting/uncompressing rar archives. In the developer distribution there are code examples on interfacing with the library in many languages but not in Perl, so I wrote one which is going to be included in the development edition after Winrar 3.9 gets released. It offers an example of Perl interfacing with C libraries, mapping C structures to Perl structures, using raw pointers from Perl and how to use of Win32 low level API calls. To use it you need to : 1. have the Win32::API module installed 2. get unrar.dll from and place it inside your Windows\System32 directory it as : for listing the contents of the file : perl L filename.rar for extracting contents of file : perl X filename.rar Any suggestions/comments/corrections are welcome
on Mar 18, 2009 at 22:33
0 replies by repellent
I have packaged up Term::ReadLine::Perl with bindkeys for most common terminals I have encountered and still use:
  • xterm
  • rxvt
  • linux - Linux native terminal
  • cons25 - FreeBSD native terminal
  • PuTTY

These bindkeys are tied to actions I personally would expect, such as:
  • Ctrl-Up arrow to search readline history.
  • Ctrl-Left arrow would move the readline cursor left word-by-word.
  • Shift-Right arrow removes the word to the right of the readline cursor, and stores it into the paste buffer.
  • Alt-Down arrow to slap down the paste buffer.
  • Home and End keys move the cursor to the beginning and end of the readline, respectively.
  • Delete key chews the character under the cursor, not the character before the cursor.
  • etc.


Instead of use Term::ReadLine::Perl;
just use Term::ReadLine::Perl::Bind;

Add this line to ~/.perldb to have the debugger's readline act the same way:
use Term::ReadLine::Perl::Bind;

Microsoft consoles are not supported. See the description on Win32::Console::ANSI.
Multiple / Mapping Search and Replace
on Mar 17, 2009 at 08:42
3 replies by VinsWorldcom
Ever want to search and replace, but on many terms and don't want to run a SAR routine over and over again for each instance? Script searches and replaces text in columns based on a mapfile. The output is a tab delimited text file.
"Divide" challenge app
on Mar 12, 2009 at 03:46
0 replies by grizzley

Application visualizing "Divide" challenge. Run it without params - you can play the board loaded from __DATA__ section. Pass dimension (integer) as first param - program will generate random board for you, which you can paste into __DATA__ section.

The goal is to place all connections marked green between left and right side nodes, and red connections between nodes on one side.

TODO: canvas size scaling
refresh canvas on resize
draw initial connections (right now you must click 'Swap' to see initial board)
try to connect lines to nodes - this could allow automatic redrawing and resizing
more colors for connections
small random offsets to coordinates of buttons to avoid labels' overlapping

Parse Excel Spreadsheets To Single
on Mar 11, 2009 at 13:11
0 replies by VinsWorldcom
This started when a colleague asked for an easy way to get some values from the same cells out of 100+ Excel sheets and put them in a single Excel workbook, 1 row for each sheet's data.

Cisco Router Action Performing Perl Script
on Mar 11, 2009 at 08:50
0 replies by VinsWorldcom

Script will interface with Cisco router via SNMP or Telnet, supporting regular login or username, and perform actions. SNMP supports a get config, put config and a save config ("wr mem" for IOS). SNMP mode also supports get and clear VTY line function and a get interface list and monitor interface utilization function, including CPU, memory and proxy ping.

Telnet mode supports the issuing of commands from a file. The only default command issued in TELNET mode is "terminal length 0" for IOS or "set length 0" for CatOS. Therefore, show commands can be in the commands file along with config commands (on IOS, as long as preceded by a "config term" and followed by an "end" and "wr mem" if save is desired). Telnet mode supports log file of session transcript.

Password decrypt and encrypt mode is provided for Cisco passwords. Type 7 (not "enable secret") are decrypted or encrypted to the 16 possible encryptions. Type 5 ("enable secret") are encrypted or decrypted by dictionary brute force.

Server mode is provided for simple service listening mode.

Greyhawk Deity Tool
on Mar 09, 2009 at 21:09
3 replies by bellaire
An example of things I do when bored at work. Not a terribly good example of much else. We use the names of Greyhawk deities for our internal projects, and scanning the Wikipedia page to find them was getting old. So, uh, this thing grabs the page markup using LWP::UserAgent, does some simple parsing, and internalizes the result for easy searches.

Update: As requested, made some minor adjustments to the usage description which should improve its clarity.
Data Sampler (Extract sample from large text file)
on Mar 06, 2009 at 16:12
1 reply by roboticus

I frequently find the need to test programs on *real* data. But some of the datasets I have to deal with are rather ... large.

So this program lets me generate much smaller datasets to develop with.

Update: 20090306: I edited the first print statement to remove the trace information.

Recombine still image sequences into movies
on Feb 25, 2009 at 12:51
4 replies by zentara
Want to make a highly succesful how-to to put on You-Tube? Or maybe speed up looking thru your security camera still images?

Here you go....put a sequential list of jpg's in a subdir, and run this script on it. The output flv is conveniently named as 111****.flv so as to be at the top of your dir list. :-)

A sample of me fixing a lamp is lamp_fix

RedHat Security Audit
on Feb 18, 2009 at 09:17
1 reply by redleg7
Recently went thru a security audit and used this script to check some basic secuity issues on the RedHat boxes.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (1)
As of 2022-01-28 06:20 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (73 votes). Check out past polls.