LOLCODE for Windows Administration scripts. Useful and amusing.

Everyone loves Easter Eggs. Finally, something useful and stress relieving (I couldn't deal with another batch file!)

//-------------server.lol | module java

HAI
BTW look at SVN
CAN HAS STDIO?
CAN HAS JAVA?
I HAS A bufClass ITZ JAVA "java.lang.StringBuffer"
I HAS A plainText ITZ bufClass!!new
I HAS A html ITZ bufClass!!new
I HAS A dateClass ITZ JAVA "java.util.Date"
I HAS A date ITZ dateClass!!new
I HAS A dateFormatClass ITZ JAVA "java.text.SimpleDateFormat"
I HAS A dateStamp ITZ dateFormatClass!!new WIF "MM/dd/yyyy @ HH::mm::ss Z"
I HAS A server ITZ JAVA "bar.foo.serverhealth.ServerHealth"

HOW DUZ I CHECKSERVER YR srvr
    I HAS A tmpServer ITZ server!!checkServer WIF srvr
    BOTH SAEM tmpServer AN "OK"
    O RLY?
    YA RLY
        plainText!!append WIF srvr
        plainText!!append WIF " | OK\r\n"
        html!!append WIF "<tr><td>"
        html!!append WIF srvr 
        html!!append WIF "</td><td>OK</td></tr>"
    NO WAI
        plainText!!append WIF "ERROR "
        plainText!!append WIF srvr
        plainText!!append WIF " | "
        plainText!!append WIF tmpServer
        plainText!!append WIF "\r\n"
        html!!append WIF "<tr><td>"
        html!!append WIF srvr
        html!!append WIF "</td>"
        html!!append WIF "<td bgcolor='yellow'>"
        html!!append WIF tmpServer
        html!!append WIF "</td></tr>"
    OIC
IF U SAY SO

BTW This is the header
plainText!!append WIF "Server Health Notification | "
plainText!!append WIF dateStamp!!format WIF date 
plainText!!append WIF "\r\n"
html!!append WIF "<html><body><h4>Server Health Notification "
html!!append WIF dateStamp!!format WIF date
html!!append WIF "</h4><table border='1' cellspacing='1'                cellpadding='1'><tr><td>URL</td><td>Status</td>"

BTW Set the URLs here...
CHECKSERVER "http:://www.foo.bar"
CHECKSERVER "https:://www.foo.bar/Bank"
CHECKSERVER "http:://application.foo.bar/"
CHECKSERVER "https:://application.foo.bar/JobSystemWeb/"
CHECKSERVER "https:://application.foo.bar/WebSubmission/"
CHECKSERVER "http:://abq.foo.bar/"
CHECKSERVER "https:://abq.foo.bar/Bank/"

html!!append WIF "</table></body></html>"

VISIBLE plainText!!toString
VISIBLE html!!toString

BTW This sends the emails
I HAS A USERNAME ITZ "[email protected]"
I HAS A PASSWORD ITZ "password"
I HAS A PORT ITZ "465"
I HAS A EMAILSERVER ITZ "secure.server.foo"

BTW This is a mail server
server!!setFrom WIF "[email protected]"  
server!!setSubject WIF "Server Health Notification" 
server!!setMessage WIF plainText!!toString
server!!setHtml WIF html!!toString
server!!setServer WIF EMAILSERVER
server!!setUser WIF USERNAME
server!!setPassword WIF PASSWORD
server!!setPort WIF PORT

server!!sendEmail WIF "[email protected]"

KTHXBYE 

(formatted--enjoy, the module is http://www.public.iastate.edu/~bkail/lolcode/)

Posted Aug 27, 2010, 9:38 PM UTC · edited

7720
Amendmen7•

These are the ramblings of a syphilitic brain, but still preferable to writing batch files =)

41
[deleted]•

Anything, be it COBOL, BRAINFUCK INTERCAL, is preferable to batch files. Fuck. Knowing that the horrid mess called batch files exists gives me the rage.

"Ah, here I am on Windows needing to run this program on this collection of files." BAM, you're fucked.

4
zdarlight•

What about Powershell?

5
warpstalker•

Windows script host. At least you can use Javascript.

5
[deleted]•

I prefer it to batch files, but it's not on every Windows and on those Windowsen that are non-genuine, you can't download it.

2
ILikeBumblebees•

Syntax looks a bit like LOLBOL.

27
wartexmaul•

Fortrofl Rofltran

16
Amendmen7•

Looks similar to PLOL/SQL

5
wartexmaul•

PostGrease SquirreL

Pythong

4
ricecake•

If it weren't for the fact that the keywords are bile, LOLCODE seems like a not-bad language.

16
coveritwithgas•

They can always pull a MUMPS and start accepting one-letter abbreviations for everything. From the File I/O in Every Programming Language results:

FILEIO ;
    N F,L1,L2
    S F="FILEIO.TXT"
    O F:"WNS" U F W "hello" C F
    O F:"WAS" U F W !,"world" C F
    O F:"RS" U F R L1,L2 C F W L2,!
    Q

. . . top response being "The hell?"

11
econnerd•

perl 6, it's finally here!

14
Djatha•

I am wondering: would it be possible to create a modern verbose language akin to natural language. Kind of a revival of MATHMATIC and COBOL of the 1950s?

Time and time again I am surprised by the readability of LOLCODE programs compared to similar programs written in whatever language. And that while I am used to those languages.

5
[deleted]•
7
nicponim•

I love PASCAL too :)

2
Djatha•

Ah, the good old days. Unfortunately Object Pascal (Delphi) is just not a good as the old language. Maybe there are some improvement in Free Pascal?

2
Boy_Bishop•

The inventor of Pascal, Niklaus With, has been promoting his next modern language called Oberon, which supports garbage collection, objects and reflection. Maybe that could be it?

1
makis•

wonderful!

2