@@ -7,7 +7,7 @@ | |||
</head> | |||
<body> | |||
<div id="forkme-box"> | |||
<a href="http://github.com/earwig"> | |||
<a href="//github.com/earwig"> | |||
<img id="forkme" src="/images/forkme.png" title="Fork me on GitHub" alt="Fork me on GitHub" /> | |||
</a> | |||
</div> | |||
@@ -24,7 +24,7 @@ | |||
</div> | |||
</div> | |||
<div id="footer"> | |||
<p>Copyright © 2011–2014 Ben Kurtovic • <a href="http://github.com/earwig/earwig.github.com">View Source</a> • <a href="http://validator.w3.org/check?uri=referer">Valid HTML5</a></p> | |||
<p>Copyright © 2011–2014 Ben Kurtovic • <a href="//github.com/earwig/earwig.github.com">View Source</a> • <a href="http://validator.w3.org/check?uri=referer">Valid HTML5</a></p> | |||
</div> | |||
</div> | |||
</div> | |||
@@ -6,11 +6,11 @@ | |||
<link rel="stylesheet" href="/css/main.css" type="text/css" /> | |||
<link rel="stylesheet" href="/css/syntax.css" type="text/css" /> <!-- shamelessly stolen from https://github.com/mojombo/tpw/blob/master/css/syntax.css --> | |||
<script src="/js/date_format.js" type="text/javascript"></script> | |||
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script> | |||
<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="http://github.com/earwig"> | |||
<a href="//github.com/earwig"> | |||
<img id="forkme" src="/images/forkme.png" title="Fork me on GitHub" alt="Fork me on GitHub" /> | |||
</a> | |||
</div> | |||
@@ -18,7 +18,7 @@ | |||
<div id="container"> | |||
{{ content }} | |||
<div id="footer"> | |||
<p>Copyright © 2011–2014 Ben Kurtovic • <a href="http://github.com/earwig/earwig.github.com">View Source</a> • <a href="http://validator.w3.org/check?uri=referer">Valid HTML5</a></p> | |||
<p>Copyright © 2011–2014 Ben Kurtovic • <a href="//github.com/earwig/earwig.github.com">View Source</a> • <a href="http://validator.w3.org/check?uri=referer">Valid HTML5</a></p> | |||
</div> | |||
</div> | |||
</div> | |||
@@ -24,19 +24,19 @@ layout: base | |||
</tr> | |||
<tr> | |||
<td class="about-l light-l">Wikipedia</td> | |||
<td class="about-r light-r"><a href="http://en.wikipedia.org/wiki/User:The_Earwig">[[User:The Earwig]]</a></td> | |||
<td class="about-r light-r"><a href="//en.wikipedia.org/wiki/User:The_Earwig">[[User:The Earwig]]</a></td> | |||
</tr> | |||
<tr> | |||
<td class="about-l dark-l">GitHub</td> | |||
<td class="about-r dark-r"><a href="http://github.com/earwig">earwig</a></td> | |||
<td class="about-r dark-r"><a href="//github.com/earwig">earwig</a></td> | |||
</tr> | |||
<tr> | |||
<td class="about-l light-l">BitBucket</td> | |||
<td class="about-r light-r"><a href="https://bitbucket.org/earwig">earwig</a></td> | |||
<td class="about-r light-r"><a href="//bitbucket.org/earwig">earwig</a></td> | |||
</tr> | |||
<tr> | |||
<td class="about-l dark-l">Twitter</td> | |||
<td class="about-r dark-r"><a href="http://twitter.com/the_earwig">@the_earwig</a></td> | |||
<td class="about-r dark-r"><a href="//twitter.com/the_earwig">@the_earwig</a></td> | |||
</tr> | |||
<tr> | |||
<td id="about-bl" class="about-l light-l">Tumblr</td> | |||
@@ -49,9 +49,9 @@ layout: base | |||
<td id="right-box"> | |||
<div id="avatar-box"> | |||
<img id="avatar" src="https://secure.gravatar.com/avatar/1b21804852ac50fee9f8e03cfa0da786?s=140" title="Earwig" alt="Earwig" /> | |||
<img id="avatar" src="//secure.gravatar.com/avatar/1b21804852ac50fee9f8e03cfa0da786?s=140" title="Earwig" alt="Earwig" /> | |||
</div> | |||
<p id="about-me-top">I'm Ben Kurtovic, a student, software developer, and <a href="http://en.wikipedia.org/">Wikipedian</a> who occasionally messes around with game production. I'm the guy behind <a href="https://github.com/earwig/mwparserfromhell">mwparserfromhell</a> and <a href="http://en.wikipedia.org/wiki/User:EarwigBot">EarwigBot</a>.</p> | |||
<p id="about-me-top">I'm Ben Kurtovic, a student, software developer, and <a href="//en.wikipedia.org/">Wikipedian</a> who occasionally messes around with game production. I'm the guy behind <a href="//github.com/earwig/mwparserfromhell">mwparserfromhell</a> and <a href="//en.wikipedia.org/wiki/User:EarwigBot">EarwigBot</a>.</p> | |||
<p>On this page, you can find my identities on a few other sites, check out the projects I'm working on, and read some of my incessant ramblings in blog form.</p> | |||
<h2 class="index-header">Posts</h2> | |||
<ul id="post-list"> | |||
@@ -59,10 +59,10 @@ layout: base | |||
<li class="post">{{ post.date | date: "%b %d, %Y" }}: <a class="invert" href="{{ post.url }}">{{ post.title }}</a><br /><span class="description">{{ post.description }} (<a href="{{ post.url }}#disqus_thread" data-disqus-identifier="{{ post.id }}"></a>)</span></li> | |||
{% endfor %} | |||
</ul> | |||
<h2 class="index-header"><a class="incognito" href="https://twitter.com/the_earwig">Tweets</a></h2> | |||
<div id="follow-button-box"><a href="https://twitter.com/the_earwig" class="twitter-follow-button" data-show-count="false" data-dnt="true">Follow @the_earwig</a> | |||
<h2 class="index-header"><a class="incognito" href="//twitter.com/the_earwig">Tweets</a></h2> | |||
<div id="follow-button-box"><a href="//twitter.com/the_earwig" class="twitter-follow-button" data-show-count="false" data-dnt="true">Follow @the_earwig</a> | |||
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script></div> | |||
<a class="twitter-timeline" data-dnt="true" href="https://twitter.com/the_earwig" data-widget-id="392426863047364608" data-chrome="noheader" data-tweet-limit="5">Tweets by @the_earwig</a> | |||
<a class="twitter-timeline" data-dnt="true" href="//twitter.com/the_earwig" data-widget-id="392426863047364608" data-chrome="noheader" data-tweet-limit="5">Tweets by @the_earwig</a> | |||
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script> | |||
</td> | |||
</tr> | |||
@@ -76,7 +76,7 @@ layout: base | |||
(function () { | |||
var s = document.createElement('script'); s.async = true; | |||
s.type = 'text/javascript'; | |||
s.src = 'http://' + disqus_shortname + '.disqus.com/count.js'; | |||
s.src = '//' + disqus_shortname + '.disqus.com/count.js'; | |||
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(s); | |||
}()); | |||
</script> |
@@ -21,9 +21,9 @@ layout: base | |||
var disqus_developer = 1; | |||
(function() { | |||
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; | |||
dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js'; | |||
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js'; | |||
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); | |||
})(); | |||
</script> | |||
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript> | |||
<noscript>Please enable JavaScript to view the <a href="//disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript> | |||
</div> |
@@ -12,13 +12,13 @@ Because of [this](http://git.io/Nw-rLQ), doing this: | |||
>>> site = wiki.get_site() | |||
>>> page = site.get_page("User:EarwigBot/Sandbox") | |||
>>> page.edit("I can has content?", "BOT: Testing new framework", minor=True) | |||
>>> | |||
>>> | |||
{% endhighlight %} | |||
...produces | |||
[this](http://en.wikipedia.org/w/index.php?title=User%3AEarwigBot%2FSandbox&diff=prev&oldid=446401978). | |||
Clearly a MASSIVE DEVELOPMENT. | |||
[this](//en.wikipedia.org/w/index.php?title=User%3AEarwigBot%2FSandbox&diff=prev&oldid=446401978). | |||
Clearly a MASSIVE DEVELOPMENT. | |||
After 5,800 lines of code, 54 files, and over 200 commits, EarwigBot can | |||
actually edit Wikipedia! | |||
@@ -30,7 +30,7 @@ EarwigBot's wiki toolset from `copyvios.mako`, and the config file is written, | |||
so running the detector is trivial once it works. The only thing left here is | |||
to have the tool produce relatively eye-pleasing output, perhaps with a | |||
"details" section showing the Markov chains formed from the two sources and | |||
comparing them visually. Not necessary at all, but a nice touch. | |||
comparing them visually. Not necessary at all, but a nice touch. | |||
Unfortunately, there's still a bit more work to do on EarwigBot before he's | |||
ready for his first release (0.1!). Aside from the copyvio stuff above, which | |||
@@ -48,10 +48,10 @@ Now that that's covered, let's look at something (mostly unrelated) I finished | |||
a couple days ago: dynamic backgrounds for | |||
[my new toolserver site](http://toolserver.org/~earwig/rewrite)! You can see it | |||
in action a bit better on [this page](http://toolserver.org/~earwig/earwigbot). | |||
The background is the the [Wikimedia Commons](http://commons.wikimedia.org/) | |||
[Picture of the Day](http://commons.wikimedia.org/wiki/Commons:Picture_of_the_day), | |||
The background is the the [Wikimedia Commons](//commons.wikimedia.org/) | |||
[Picture of the Day](//commons.wikimedia.org/wiki/Commons:Picture_of_the_day), | |||
loaded and displayed with JavaScript. | |||
[Here's the code for it](https://github.com/earwig/toolserver/blob/master/static/js/potd.js), | |||
[Here's the code for it](//github.com/earwig/toolserver/blob/master/static/js/potd.js), | |||
a good deal more code than I had expected to write. | |||
Here's what we have to do: | |||
@@ -5,10 +5,9 @@ description: Fun with functional programming in Python. | |||
--- | |||
A few months ago, I got first place in | |||
[this Code Golf contest](http://codegolf.stackexchange.com/q/22533) to create | |||
the 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: | |||
[this Code Golf contest](//codegolf.stackexchange.com/q/22533) to create the | |||
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: | |||
{% highlight python %} | |||
@@ -73,9 +72,9 @@ sys.stdout.write("Hello world!\n") | |||
{% endhighlight %} | |||
But let's use something lower-level: | |||
[`os.write()`](https://docs.python.org/2/library/os.html#os.write). We need | |||
`stdout`'s [file descriptor](https://en.wikipedia.org/wiki/File_descriptor), | |||
which is `1` (you can check with `print sys.stdout.fileno()`). | |||
[`os.write()`](//docs.python.org/2/library/os.html#os.write). We need | |||
`stdout`'s [file descriptor](//en.wikipedia.org/wiki/File_descriptor), which is | |||
`1` (you can check with `print sys.stdout.fileno()`). | |||
{% highlight python %} | |||
@@ -85,7 +84,7 @@ os.write(1, "Hello world!\n") | |||
{% endhighlight %} | |||
We want a single expression, so we'll use | |||
[`__import__()`](https://docs.python.org/2/library/functions.html#__import__): | |||
[`__import__()`](//docs.python.org/2/library/functions.html#__import__): | |||
{% highlight python %} | |||
@@ -180,9 +179,9 @@ convert = lambda num: chr(num % 256) + convert(num // 256) if num else "" | |||
{% endhighlight %} | |||
Now we use | |||
[anonymous recursion](https://en.wikipedia.org/wiki/Anonymous_recursion) to | |||
turn this into a single expression. This requires a | |||
[combinator](https://en.wikipedia.org/wiki/Combinatory_logic). Start with this: | |||
[anonymous recursion](//en.wikipedia.org/wiki/Anonymous_recursion) to turn this | |||
into a single expression. This requires a | |||
[combinator](//en.wikipedia.org/wiki/Combinatory_logic). Start with this: | |||
{% highlight pycon %} | |||
@@ -238,7 +237,8 @@ some random function: | |||
{% endhighlight %} | |||
What we're _really_ doing here is looking at the | |||
[line number table](http://svn.python.org/projects/python/branches/pep-0384/Objects/lnotab_notes.txt) of the `code` object contained within the function. Since it's anonymous, there | |||
[line number table](http://svn.python.org/projects/python/branches/pep-0384/Objects/lnotab_notes.txt) | |||
of the `code` object contained within the function. Since it's anonymous, there | |||
are no line numbers, so the string is empty. Replace the `0` with `_` to make | |||
it more confusing (it doesn't matter, since the function's not being called), | |||
and stick it in. We'll also refactor out the `256` into an argument that gets | |||
@@ -481,8 +481,8 @@ function. It's getting long, so I'll paste only the first half: | |||
Only two more things are left. We'll start with the easy one: `256`. | |||
<span>\\(256 = 2^8\\)</span>, so we can rewrite it as `1 << 8` (using a | |||
[left bit shift](http://stackoverflow.com/a/141873)), or `_ << ________` with | |||
our obfuscated variables. | |||
[left bit shift](//stackoverflow.com/a/141873)), or `_ << ________` with our | |||
obfuscated variables. | |||
We'll use the same idea with `802616035175250124568770929992`. A simple | |||
divide-and-conquer algorithm can break it up into sums of numbers which are | |||
@@ -490,7 +490,7 @@ themselves sums of numbers that are shifted together, and so on. For example, | |||
if we had `112`, we could break it up into `96 + 16` and then | |||
`(3 << 5) + (2 << 3)`. I like using bit shifts because the `<<` reminds me of | |||
`std::cout << "foo"` in C++, or | |||
[`print` chevron](https://docs.python.org/2/reference/simple_stmts.html#the-print-statement) | |||
[`print` chevron](//docs.python.org/2/reference/simple_stmts.html#the-print-statement) | |||
(`print >>`) in Python, both of which are red herrings involving other ways of | |||
doing I/O. | |||
@@ -5,34 +5,34 @@ title: Home | |||
<div class="project"> | |||
<div class="project-head"> | |||
<a class="invert" href="https://github.com/earwig/earwigbot">earwigbot</a> <span class="description"><i>(Python // started April 2009)</i></span> | |||
<a class="invert" href="//github.com/earwig/earwigbot">earwigbot</a> <span class="description"><i>(Python // started April 2009)</i></span> | |||
</div> | |||
<div class="project-body description"> | |||
<i>EarwigBot</i> is a <a href="http://python.org/">Python</a> robot that edits <a href="http://en.wikipedia.org/">Wikipedia</a> and interacts with people over <a href="http://en.wikipedia.org/wiki/Internet_Relay_Chat">IRC</a>. It has <a href="https://github.com/earwig/earwigbot-plugins">a separate repository for plugins</a>. | |||
<i>EarwigBot</i> is a <a href="//python.org/">Python</a> robot that edits <a href="//en.wikipedia.org/">Wikipedia</a> and interacts with people over <a href="//en.wikipedia.org/wiki/Internet_Relay_Chat">IRC</a>. It has <a href="//github.com/earwig/earwigbot-plugins">a separate repository for plugins</a>. | |||
</div> | |||
</div> | |||
<div class="divider"></div> | |||
<div class="project"> | |||
<div class="project-head"> | |||
<a class="invert" href="https://github.com/earwig/mwparserfromhell">mwparserfromhell</a> <span class="description"><i>(Python // started May 2012)</i></span> | |||
<a class="invert" href="//github.com/earwig/mwparserfromhell">mwparserfromhell</a> <span class="description"><i>(Python // started May 2012)</i></span> | |||
</div> | |||
<div class="project-body description"> | |||
<i>MWParserFromHell</i> is an easy-to-use and outrageously powerful <a href="http://python.org/">Python</a> parser for <a href="http://mediawiki.org/">MediaWiki</a> wikicode. | |||
<i>MWParserFromHell</i> is an easy-to-use and outrageously powerful <a href="//python.org/">Python</a> parser for <a href="//mediawiki.org/">MediaWiki</a> wikicode. | |||
</div> | |||
</div> | |||
<div class="divider"></div> | |||
<div class="project"> | |||
<div class="project-head"> | |||
<a class="invert" href="https://github.com/earwig/copyvios">copyvios</a> <span class="description"><i>(Web // started July 2009)</i></span> | |||
<a class="invert" href="//github.com/earwig/copyvios">copyvios</a> <span class="description"><i>(Web // started July 2009)</i></span> | |||
</div> | |||
<div class="project-body description"> | |||
<a href="https://tools.wmflabs.org/copyvios"><i>Copyvios</i></a> is a copyright violation detector running on <a href="http://tools.wmflabs.org/">Wikimedia Labs</a>. | |||
<a href="//tools.wmflabs.org/copyvios"><i>Copyvios</i></a> is a copyright violation detector running on <a href="//tools.wmflabs.org/">Wikimedia Labs</a>. | |||
</div> | |||
</div> | |||
<div class="divider"></div> | |||
<div class="project"> | |||
<div class="project-head"> | |||
<a class="invert" href="https://github.com/earwig/earwig.github.com">earwig.github.com</a> <span class="description"><i>(Web // started June 2011)</i></span> | |||
<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! | |||
@@ -41,7 +41,7 @@ title: Home | |||
<div class="divider"></div> | |||
<div class="project"> | |||
<div class="project-head"> | |||
<a class="invert" href="https://github.com/earwig/git-repo-updater">git-repo-updater</a> <span class="description"><i>(Python // started June 2011)</i></span> | |||
<a class="invert" href="//github.com/earwig/git-repo-updater">git-repo-updater</a> <span class="description"><i>(Python // started June 2011)</i></span> | |||
</div> | |||
<div class="project-body description"> | |||
<i>Gitup</i> is a console script that allows you to easily pull to multiple git repositories at once. | |||
@@ -50,25 +50,25 @@ title: Home | |||
<div class="divider"></div> | |||
<div class="project"> | |||
<div class="project-head"> | |||
<a class="invert" href="https://github.com/earwig/music-quizzer">music-quizzer</a> <span class="description"><i>(Python // started May 2011)</i></span> | |||
<a class="invert" href="//github.com/earwig/music-quizzer">music-quizzer</a> <span class="description"><i>(Python // started May 2011)</i></span> | |||
</div> | |||
<div class="project-body description"> | |||
<i>MusicQuizzer</i> is a <a href="http://en.wikipedia.org/wiki/Tk_(framework)">Tk</a>-based program that can help you prepare for your music final with randomly-generated listening quizzes. | |||
<i>MusicQuizzer</i> is a <a href="//en.wikipedia.org/wiki/Tk_(framework)">Tk</a>-based program that can help you prepare for your music final with randomly-generated listening quizzes. | |||
</div> | |||
</div> | |||
<div class="divider"></div> | |||
<div class="project"> | |||
<div class="project-head"> | |||
<a class="invert" href="https://github.com/earwig/lobo">lobo</a> <span class="description"><i>(NetLogo // started December 2011)</i></span> | |||
<a class="invert" href="//github.com/earwig/lobo">lobo</a> <span class="description"><i>(NetLogo // started December 2011)</i></span> | |||
</div> | |||
<div class="project-body description"> | |||
<i>Lobo</i> is Logo Bolo: a re-envisioning of <a href="http://en.wikipedia.org/wiki/Bolo_(video_game)">the classic tank game</a> by Stuart Cheshire in NetLogo. | |||
<i>Lobo</i> is Logo Bolo: a re-envisioning of <a href="//en.wikipedia.org/wiki/Bolo_(video_game)">the classic tank game</a> by Stuart Cheshire in NetLogo. | |||
</div> | |||
</div> | |||
<div class="divider"></div> | |||
<div class="project"> | |||
<div class="project-head"> | |||
<a class="invert" href="https://github.com/earwig/func-smash">func-smash</a> <span class="description"><i>(Python // started April 2012)</i></span> | |||
<a class="invert" href="//github.com/earwig/func-smash">func-smash</a> <span class="description"><i>(Python // started April 2012)</i></span> | |||
</div> | |||
<div class="project-body description"> | |||
<i>FuncSmash</i>, a small for-the-hell-of-it project, tries to generate random Python functions using Markov chains. | |||