Browse Source

Style tweaks.

master
Ben Kurtovic 10 years ago
parent
commit
603be5dfb8
6 changed files with 63 additions and 71 deletions
  1. +12
    -19
      404.html
  2. +4
    -11
      _layouts/base.html
  3. +13
    -13
      _posts/2014-06-01-obfuscating-hello-world.md
  4. +33
    -27
      css/main.css
  5. BIN
     
  6. +1
    -1
      index.html

+ 12
- 19
404.html View File

@@ -6,27 +6,20 @@
<link rel="stylesheet" href="/css/main.css" type="text/css" />
</head>
<body>
<div id="forkme-box">
<a href="//github.com/earwig">
<img id="forkme" src="/images/forkme.png" title="Fork me on GitHub" alt="Fork me on GitHub" />
</a>
</div>
<div id="everything">
<div id="container">
<div id="header">
<h1 id="head"><a class="incognito" href="/">&iexcl;puno&#8498; &#647;o&#7438; &#58;&#5421;0&#5421;</a></h1>
</div>
<div id="content">
<div id="post">
<p>The page you're looking for doesn't exist &ndash; and I thought I had designed everything so well! *sniff*</p>
<p>Did I delete it? Did I redesign my site and move everything around aimlessly? WAS IT ABDUCTED BY ALIENS!? Who knows? Not my web server.</p>
<p>Well, you're welcome to <a href="/">look around a bit</a>!</p>
</div>
</div>
<div id="footer">
<p>Copyright &copy; 2011&ndash;2014 Ben Kurtovic &bull; <a href="//github.com/earwig/earwig.github.com">View Source</a> &bull; <a href="http://validator.w3.org/check?uri=referer">Valid HTML5</a></p>
<div id="container">
<div id="header">
<h1 id="head"><a class="incognito" href="/">&iexcl;puno&#8498; &#647;o&#7438; &#58;&#5421;0&#5421;</a></h1>
</div>
<div id="content">
<div id="post">
<p>The page you're looking for doesn't exist &ndash; and I thought I had designed everything so well! *sniff*</p>
<p>Did I delete it? Did I redesign my site and move everything around aimlessly? WAS IT ABDUCTED BY ALIENS!? Who knows? Not my web server.</p>
<p>Well, you're welcome to <a href="/">look around a bit</a>!</p>
</div>
</div>
<div id="footer">
<p>Copyright &copy; 2011&ndash;2014 Ben Kurtovic &bull; <a href="//github.com/earwig/earwig.github.com">View Source</a> &bull; <a href="http://validator.w3.org/check?uri=referer">Valid HTML5</a></p>
</div>
</div>
</body>
</html>

+ 4
- 11
_layouts/base.html View File

@@ -9,17 +9,10 @@
<script type="text/javascript" src="https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
</head>
<body>
<div id="forkme-box">
<a href="//github.com/earwig">
<img id="forkme" src="/images/forkme.png" title="Fork me on GitHub" alt="Fork me on GitHub" />
</a>
</div>
<div id="everything">
<div id="container">
{{ content }}
<div id="footer">
<p>Copyright &copy; 2011&ndash;2014 Ben Kurtovic &bull; <a href="//github.com/earwig/earwig.github.com">View Source</a> &bull; <a href="http://validator.w3.org/check?uri=referer">Valid HTML5</a></p>
</div>
<div id="container">
{{ content }}
<div id="footer">
<p>Copyright &copy; 2011&ndash;2014 Ben Kurtovic &bull; <a href="//github.com/earwig/earwig.github.com">View Source</a> &bull; <a href="http://validator.w3.org/check?uri=referer">Valid HTML5</a></p>
</div>
</div>
</body>


+ 13
- 13
_posts/2014-06-01-obfuscating-hello-world.md View File

@@ -10,7 +10,7 @@ weirdest obfuscated program that prints the string "Hello world!". I decided to
write up an explanation of how the hell it works. So, here's the entry, in
Python 2.7:

{% highlight python %}
{% highlight python linenos=table %}

(lambda _, __, ___, ____, _____, ______, _______, ________:
getattr(
@@ -124,7 +124,7 @@ this, but I chose the following:

We're starting to make some progress!

{% highlight python %}
{% highlight python linenos=table %}

getattr(
__import__(True.__class__.__name__[1] + [].__class__.__name__[2]),
@@ -208,7 +208,7 @@ function:
Now we can stick this into our code from before, replacing some variable names
along the way (`f` &rarr; `_`, `n` &rarr; `__`):

{% highlight python %}
{% highlight python linenos=table %}

getattr(
__import__(True.__class__.__name__[1] + [].__class__.__name__[2]),
@@ -246,7 +246,7 @@ and stick it in. We'll also refactor out the `256` into an argument that gets
passed to our obfuscated `convert()` along with the number. This requires
adding an argument to the combinator:

{% highlight python %}
{% highlight python linenos=table %}

getattr(
__import__(True.__class__.__name__[1] + [].__class__.__name__[2]),
@@ -273,7 +273,7 @@ to recreate them each time they're used. If we can implement, say,
a function that takes variables containing the numbers from 1 to 8, and replace
occurrences of integer literals in the body with these variables:

{% highlight python %}
{% highlight python linenos=table %}

(lambda n1, n2, n3, n4, n5, n6, n7, n8:
getattr(
@@ -301,7 +301,7 @@ We can get the number of arguments a function takes via its `code` object:

Build a tuple of functions with argcounts between 1 and 8:

{% highlight python %}
{% highlight python linenos=table %}

funcs = (
lambda _: _,
@@ -353,7 +353,7 @@ Then, into anonymous-recursive form:
For fun, we'll factor out argcount operation into an additional function
argument, and obfuscate some variable names:

{% highlight python %}
{% highlight python linenos=table %}

(lambda _, __, ___: _(_, __, ___))(
(lambda _, __, ___:
@@ -397,7 +397,7 @@ This happens regardless of whether `_` is actually defined in the global scope.

Putting this into practice:

{% highlight python %}
{% highlight python linenos=table %}

(lambda _, __, ___: _(_, __, ___))(
(lambda _, __, ___:
@@ -413,7 +413,7 @@ Putting this into practice:
Now we can substitute the value of `funcs` in, and then using `*` to pass the
resulting list of integers as eight separate variables, we get this:

{% highlight python %}
{% highlight python linenos=table %}

(lambda n1, n2, n3, n4, n5, n6, n7, n8:
getattr(
@@ -460,7 +460,7 @@ right ones will be used. This is also one of the reasons why we refactored
`256` out to where `_` refers to `1` instead of our obfuscated `convert()`
function. It's getting long, so I'll paste only the first half:

{% highlight python %}
{% highlight python linenos=table %}

(lambda _, __, ___, ____, _____, ______, _______, ________:
getattr(
@@ -501,7 +501,7 @@ that's not interesting). We should have some substantial amount of nesting, but
still use most of our numerical variables. Obviously, doing this by hand isn't
fun, so we'll come up with an algorithm. In pseudocode:

{% highlight text %}
{% highlight text linenos=table %}

func encode(num):
if num <= 8:
@@ -550,7 +550,7 @@ Through trial and error, I found this equation to work well:
Translating the pseudocode into Python and making some tweaks (support for the
`depth` argument, and some caveats involving negative numbers), we get this:

{% highlight python %}
{% highlight python linenos=table %}

from math import ceil, log

@@ -601,7 +601,7 @@ decomposition:
Stick this in as a replacement for `802616035175250124568770929992`, and put
all the parts together:

{% highlight python %}
{% highlight python linenos=table %}

(lambda _, __, ___, ____, _____, ______, _______, ________:
getattr(


+ 33
- 27
css/main.css View File

@@ -1,25 +1,44 @@
body {
max-width: 1000px;
margin: auto;
padding: 0 40px 0 40px;
font-family: helvetica, arial, clean, sans-serif;
font-size: 14px;
font-size: 16px;
color: #000;
background: #E0E0E0 url("/images/background.png") repeat top left;
}

p {
line-height: 1.25em;
}

.color-highlight {
color: #040;
}

.highlight { /* syntax highlighter */
.highlight, .highlighttable {
background: #f2f2f2;
border: 1px solid #e8e8e8;
border-radius: 10px;
padding-left: 16px;
line-height: 1.35em;
font-size: 13px;
font-size: 14px;
}

.highlighttable {
width: 100%;
}

.highlighttable .highlight {
border: 0;
}

.linenos {
color: #888;
}

.description {
font-size: 12px;
font-size: 14px;
}

.index-header {
@@ -43,13 +62,13 @@ pre code {
}

div.project {
border: 1px solid #CCC;
border: 1px solid #DDD;
border-radius: 5px;
}

div.project-head {
padding: 3px 12px 6px 12px;
border-bottom: 1px solid #CCC;
padding: 6px 15px 6px 15px;
border-bottom: 1px solid #DDD;
border-radius: 5px 5px 0px 0px;

/* all I want is a simple background gradient without images! */
@@ -63,7 +82,7 @@ div.project-head {
}

div.project-body {
padding: 6px 12px 9px 12px;
padding: 6px 15px 9px 15px;
border-radius: 0px 0px 5px 5px;

background: #F4F4F4;
@@ -76,7 +95,7 @@ div.project-body {
}

div.divider {
border-bottom: 1px solid #AAA;
border-bottom: 1px solid #CCC;
margin-top: 15px;
margin-bottom: 15px;
}
@@ -112,21 +131,15 @@ h1#head {
text-align: center;
}

div#everything {
max-width: 800px;
margin: auto;
padding: 0 40px 0 40px;
}

div#container {
margin: 20px auto 32px auto;
margin: 30px auto 30px auto;
border: 1px solid #999;
border-radius: 10px;
background-color: #FFF;
}

div#header {
margin: 16px 16px 20px 16px;
margin: 30px;
padding: 35px 0px 35px 0px;
border: 1px solid #999;
border-radius: 10px 10px 0px 0px;
@@ -142,11 +155,11 @@ div#header {
}

div#content {
padding: 2px 15px 2px 15px;
padding: 0 30px;
}

div#footer {
font-size: 11px;
font-size: 14px;
text-align: center;
padding: 9px 4px 12px 4px;
color: #222;
@@ -156,7 +169,7 @@ div#post-info {
margin-left: 24px;
}

div#post {
div#post p {
line-height: 1.75em;
}

@@ -184,13 +197,6 @@ ul#post-list {
padding-left: 1em;
}

img#forkme {
position: absolute;
top: 0;
right: 0;
border: 0;
}

img#avatar {
border-radius: 5px;
}


BIN
View File


+ 1
- 1
index.html View File

@@ -35,7 +35,7 @@ title: Home
<a class="invert" href="//github.com/earwig/earwig.github.com">earwig.github.com</a> <span class="description"><i>(Web // started June 2011)</i></span>
</div>
<div class="project-body description">
<i>earwig.github.com</i> is... well... what you're viewing right now. In source code form!
<i>earwig.github.com</i> is the site you're viewing right now in source code form.
</div>
</div>
<div class="divider"></div>


Loading…
Cancel
Save