import this
secret = "Tbbq Wbo! abj tb fvta hc sbe gur znvyvat yvfg bire ng vclguba.bet"
Using Tab-completion, you should have figured out that this
module has the following things
this.c # a character
this.d # a dictionary, mapping letters to letters
this.s # the string of the Zen of Python poem, encoded like our `secret`
this.c # a counter that's only used in creating `this.d`
I found out how this.c
is actually used by looking at source code using this??
this.
this??
this.d
Aha! The last line of the this module is what does the actual decoding!
let's just tweak it a bit
"".join([this.d.get(c, c) for c in secret])
Create the stub default profile (if you haven't already)
$ ipython profile create
This will create the stubs for the default profile
now you can change these defaults.
To find where your profile is stored:
In [1]: import IPython
In [2]: IPython.utils.path.locate_profile()
Example:if you want the _
and __
methods to show up by default when doing tab-completion
%config IPCompleter.omit__names
Another example: you can add your own startup message (or execute your desired commands at startup) like I have:
~/.ipython/profile_default/startup/README
import IPython
IPython.utils.path.locate_profile()
IPython.utils.path.locate_profile()+'/startup/README'
aperture_code = '''"""
,=:;//;:-,.
,;%+,./H#M@MM@@@H: .
,/X@MMMH%-,=%MM@M@@M+ +X/,
-+@MMMM@MMMMX;,-+HM@@M$ ;MM@+-
./@#M@M@HHHXXXXX+- .;X@MX -M@@M@;
.,=:=-=---. =%@, HM@@MM%,
;+%%%$$XH%- ,. XM@@@#@=
:MM@MMMM@;. $M@M@/.-=
$M@@@MM+. /MM$- /@X
-@@@@#X= . :@: :H@M@,
=M@M@; -H/ . ,XMM@@@,
.$#%..+MM% ,+@M@@@@H.
;= ;HM@MX ./HMM@MMMM/
,XM@@@@H. , =$@HHX$%+%/
,XM@@@@@,.H%- .--------=.
.%MM@@M= XMM$:. -+%$$$XXHHH@@@MM%.
=XMMM/ +M@MMH+-,;H#MM@MM@MMMX=
=%M% ;M@@@MM@$=.-$@#M@M@%=
,= =@MMMMMMM#H/,-+$+:,
.-:/+%%%%++=
There is research to be done """
import time
time.sleep(.1)
print __doc__'''
filepath = IPython.utils.path.locate_profile()+'/startup/aperture.py'
with open(filepath, 'w') as f:
f.write(aperture_code)