Wednesday, May 11, 2011

My Latest Leet Program

Just for fun today I did an update of an EnglishToLeetSpeak translator I had written a couple years ago.  I noticed that when I posted my update, my post count was almost ironic.  :-)

For a sample of how it works, look at this paragraph from my previous post:

Before:

Spent some time today installing a barebones (ie. no desktop) version of Ubuntu on an old Acer Aspire One netbook.  Feels weird to refer to it as old, as it was only a few years ago....


After:

S|>en† So]V[e †!]V[e †o])ay !nS†aLL!nG a (3aRe(3oneS (!e. no ])eS|<†o|>) veRS!on of µ(3µn†µ on an oL]) aceR aS|>!Re one ne†(3oo|<.  feeLS UUe!R]) †o RefeR †o !† aS oL]), aS !† UUaS onLy a feUU yeaRS aGo....

Here's the code: 

#!/usr/bin/env python
# -*- coding: utf-8 -*-

# leet.py
# an experiment in python to produce a good leet encoder
# that does not use a one-to-one mapping
# mFragin May 2011
# version 1.5 maps first and then substitutes, so
# each example is internally letter consistant

import random, string

myDefinitions = [["4","@","/-\\","∂","λ","a","A"],
["6","I3","ß","|:","(3","/3","b","B"],
["¢","(","©","c","C"],
["∂","])","[)","T)","cl","d","D"],
["€","£","ë","e","E"],
["]=","ph","|=","f","F"],
["6","(_+","9","(γ","(_-","cj","g","G"],
["/-/","]-[",")-(","|~|","]~[","}{","h","H"],
["!","|",":","i","I"],
["_|","_/","]","j","J"],
["|<","k","K"], ["1","|","|_","l","L"], ["|v|","]V[","(T)","|\\/|","/\\/\\","m","M"], ["|\\|","]\\[","~","n","N"], ["0","[]","¤","Ω","o","O"], ["|o","|>","p","P"],
["(_,)","0_","O,","q","Q"],
["12","®","|2","r","R"],
["5","$","§","s","S"],
["+","-|-","†","t","T"],
["|_|","L|","µ","u","U"],
["\\/","√","v","V"],
["vv","\\V/","\\X/","UU","w","W"],
["%","><","}{","x","X"], ["Ψ","¥","y","Y"], ["2","z","Z"]] myKeys = string.ascii_lowercase # Make a dictionary of the keys and values myDict =dict(zip(myKeys, myDefinitions)) # Get a string from user and make it lower case stringToConvert = raw_input("\nEnter a string: ").lower() leetString = "" variations = int(raw_input("\nHow many variations? ")) for i in range(variations): leetString = "" chosenLetters = {} for letter in stringToConvert: if letter in chosenLetters: leetString += chosenLetters[letter] elif letter in string.ascii_lowercase: choice = random.choice(myDict[letter]) leetString += choice chosenLetters[letter] = choice else: leetString += letter print leetString

Saturday, May 7, 2011

Ubuntu Command Line Only Installation

Spent some time today installing a barebones (ie. no desktop) version of Ubuntu on an old Acer Aspire One netbook.  Feels weird to refer to it as old, as it was only a few years ago that netbooks were hot as anything.  Of course then Microsoft felt the need to spread their OS virus onto all the Linux netbooks.  The rest is history--no one uses netbooks anymore.  So I guess Microsoft won, and lost. 

Pretty silly to imagine running Windows on a netbook....

Notes to self:
  1. I used Unetbootin and the Ubuntu Minimal Install iso image.
  2. Installed only the basic command line stuff
  3. Now to add CLISP and a few other things....