<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><description></description><title>I'm just aperson</title><generator>Tumblr (3.0; @aperson)</generator><link>https://aperson.tumblr.com/</link><item><title>So I wrote a bot for Reddit...</title><description>&lt;p&gt;My python has been a little rusty, so I decided to fill a small niche that I found on &lt;a href="http://reddit.com" target="_blank"&gt;Reddit&lt;/a&gt;.  It started off from spending way to much time on &lt;a href="http://reddit.com/r/minecraft" target="_blank"&gt;/r/minecraft&lt;/a&gt;, a subreddit I help moderate.  Every time someone from Mojang would make a tweet, someone would post it to the subreddit.  Another user and I had an informal competition of who could post the content of the tweet in the comments first.  This had a few useful purposes for the community and served for a friendly pissing-contest between a few of us.&lt;/p&gt;

&lt;p&gt;Enter &lt;a href="http://reddit.com/user/tweet_poster" target="_blank"&gt;tweet_poster&lt;/a&gt;.  It has evolved a bit since the beginning where it would just post the tweet in the comments (well, technically, it never *just* did that, but I digress); it now has a small feature-set that is stretched about as far as I can go for a bot that fits as small of a niche that it does.  From it&amp;rsquo;s &lt;a href="http://reddit.com/help/faqs/tweet_poster" target="_blank"&gt;wiki&lt;/a&gt;, it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Finds all context for any given tweet, not just the tweet being replied to like twitter shows [ie: conversation threads].&lt;/li&gt;
&lt;li&gt;Unshortens &lt;em&gt;most&lt;/em&gt; url shorteners [now with more recursion!].&lt;/li&gt;
&lt;li&gt;Turns @replies into links to the @user&amp;rsquo;s profile.&lt;/li&gt;
&lt;li&gt;Turns #tags in to links to a search for that tag.&lt;/li&gt;
&lt;li&gt;For user profile submissions, a comment-ified version will be posted along with the last tweet/conversation by the user.&lt;/li&gt;
&lt;li&gt;Tries to ignore submissions that have the tweet&amp;rsquo;s text as the title.&lt;/li&gt;
&lt;li&gt;Includes a big endian formatted timestamp for each tweet.&lt;/li&gt;
&lt;li&gt;Includes a [Translate] button for easily translating tweets.&lt;/li&gt;
&lt;li&gt;Tries to rehost images linked in tweets to imgur.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The first feature is one that has been there from the beginning and its my favorite.  When you view a tweet that is in reply to someone on twitter you only see the tweet that it&amp;rsquo;s in reply to.  With t_p, you&amp;rsquo;ll see the entire conversation for as long as it went.  The next feature is another favorite and one that took a little work to get right (I am rusty at python, after-all).  I use a web service to unshorten urls, but not just that, it does it recursively (I hate url shorteners being where they&amp;rsquo;re not needed!).  The next two features (the linking of @users and #tags) is just replication of what twitter already does and weren&amp;rsquo;t really hard to implement.&lt;/p&gt;

&lt;p&gt;Next up on the feature list is a somewhat controversial and misunderstood feature: comment-ified profile pages.  Judging by the votes these comments receive, it&amp;rsquo;s not a favorite feature, but appreciated in some submissions.  I think the main problem (and where it&amp;rsquo;s misunderstood) is that people still don&amp;rsquo;t entirely know how to create a direct link to the tweet they&amp;rsquo;re trying to share.  I&amp;rsquo;ve gotten a few comments in t_p&amp;rsquo;s inbox stating that things were wrong and that it linked the wrong tweet, when in fact, the bot did exactly what it was supposed to.  Oh well, I still get people that confuse its comment footer with a claim that I&amp;rsquo;m stating that they&amp;rsquo;re a bot (it says: [This comment was posted by a bot][FAQ][Did I get it wrong?]).  You can&amp;rsquo;t expect &lt;em&gt;everyone&lt;/em&gt; to be sharp on their toes.&lt;/p&gt;

&lt;p&gt;I&amp;rsquo;m trying to figure out better heuristics for my &amp;lsquo;is the tweet in the submission title&amp;rsquo; detection, but the current version works well enough.  All I do is strip all the non-word characters, make everything lowercase, and do a check if the tweet&amp;rsquo;s text is in the title.  Simple, but mostly effective.&lt;/p&gt;

&lt;p&gt;The big endian dates aren&amp;rsquo;t anything special, though there is a small story behind the wording of that line in the feature list:  I had originally called it &lt;a href="http://en.wikipedia.org/wiki/ISO_8601" target="_blank"&gt;ISO 8601&lt;/a&gt; formatted (which it *is*), but some user messaged t_p and argued that I was wrong in calling it that.  They wouldn&amp;rsquo;t give up, so I told them fine, I&amp;rsquo;ll just call it big endian (which is also correct).  I&amp;rsquo;m a internet pendant, but there was nothing worth arguing in that one.  The translate button was a small feature that I didn&amp;rsquo;t think I&amp;rsquo;d be able to add.  I had originally dismissed it as I had read blog posts that the Google translate API was being shutdown (which it is in Dec.).  T_p gets a lot of attention in &lt;a href="/r/starcraft" target="_blank"&gt;/r/starcraft&lt;/a&gt; and in fact they give me the most support there.  Every now and then, they get tweets that are posted in Korean (I wonder why? :) and a translate button was asked for a few times.  Since /r/starcraft has been such a supportive community, I decided to give it a look and found a super simple solution: just throw the tweet&amp;rsquo;s text in a big-ass url and send it to Google translate.&lt;/p&gt;

&lt;p&gt;Last on the feature list is the newest and probably the most involved feature.  Twittpic and yfrog were small challenges to build a regex to yank the direct links to pictures.  After I got those, I had to start work on interfacing with &lt;a href="http://imgur.com/" target="_blank"&gt;imgur&lt;/a&gt;&amp;rsquo;s API.  There was a small quirk I had to work-around with httplib2, but it works and I don&amp;rsquo;t want to deal with it right now.  The real problem I want to solve in that area is finding a way to yank images off of twitter&amp;rsquo;s newish picture hosting service.  If anyone knows a way to do that, let me know :).&lt;/p&gt;

&lt;p&gt;There were a few internal, mini-accomplishments that I figured out (a rewrite, adding a database, and learning some small tricks were among them), but those aren&amp;rsquo;t entirely worth writing about.  I might try to write about them if I ever get around to rewriting them all.&lt;/p&gt;

&lt;p&gt;Anyways, I just wanted to make a smallish write-up on my reddit bot.  It makes more karma on reddit in a month than I do in a year, and I&amp;rsquo;m rather proud of it.&lt;/p&gt;

&lt;p&gt;I&amp;rsquo;ll end this post with a picture of bot&amp;rsquo;s console just after I learned about terminal color codes (it&amp;rsquo;s a little different now):&lt;/p&gt;

&lt;p&gt;&lt;img src="https://64.media.tumblr.com/tumblr_lqodokqKkS1qanby1.png" alt="" title="COLOR ALL THE THINGS!"/&gt;
&lt;em&gt;color all the things!&lt;/em&gt;&lt;/p&gt;</description><link>https://aperson.tumblr.com/post/9536934029</link><guid>https://aperson.tumblr.com/post/9536934029</guid><pubDate>Mon, 29 Aug 2011 00:59:18 -0500</pubDate><category>reddit</category><category>twitter</category><category>python3</category></item><item><title>Maybe I called it too early</title><description>&lt;p&gt;I don&amp;rsquo;t know what combination of things got sound working yesterday, but all I know is I currently don&amp;rsquo;t have anything coming out of my speakers.  Somewhere between uninstalling alsa, installing pulseaudio, and installing vlc some magic happened and I acquired sound.  I&amp;rsquo;ve been pouring through logs but I can&amp;rsquo;t reproduce things or get consistent sound.&lt;/p&gt;

&lt;p&gt;Here&amp;rsquo;s hoping I can figure it out before I go insane trying.&lt;/p&gt;</description><link>https://aperson.tumblr.com/post/3045764556</link><guid>https://aperson.tumblr.com/post/3045764556</guid><pubDate>Tue, 01 Feb 2011 02:13:15 -0600</pubDate><category>linux</category></item><item><title>Sound over HDMI - WORKS!</title><description>&lt;p&gt;I&amp;rsquo;ve never been able to get this working before. Lo and behold, all it took was a purge of all of alsa and installing pulseaudio.  I&amp;rsquo;m so happy that I can use my mediacenter computer again.  I was going nuts using my borrowed dvd player (let alone dvds).&lt;/p&gt;

&lt;p&gt;Huzzah!&lt;/p&gt;</description><link>https://aperson.tumblr.com/post/3030211542</link><guid>https://aperson.tumblr.com/post/3030211542</guid><pubDate>Mon, 31 Jan 2011 07:12:02 -0600</pubDate></item><item><title>Adventures in virtual machines!</title><description>&lt;p&gt;While I was working on building a new server setup, I decided to take notes of the installed size of Ubuntu after every major package I installed.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This is an x64 system.  The installed size is determined via df -h after I clean the package cache&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;command-line install&lt;/strong&gt; (from the &lt;a href="https://help.ubuntu.com/community/Installation/MinimalCD" target="_blank"&gt;minimal install iso&lt;/a&gt;)&lt;em&gt;:&lt;/em&gt;  728M  (hot damn! I thought this was going to be smaller)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;with virtualbox-ose&lt;/strong&gt;:  899M  (not bad, that&amp;rsquo;s still under 1GiB)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;apache2, autofs, openssh-server, sshfs&lt;/strong&gt;:  914M  (yes! cli-only and I can get away running this all under a GiB!)&lt;/p&gt;

&lt;p&gt;So I guess the smallest I can get comfortably get away with is a bit under a GiB.  It&amp;rsquo;s a shame I use this box to watch movies on, and I need X.  I won&amp;rsquo;t bore with any more details, at least until I get the final installed size figured out.&lt;/p&gt;</description><link>https://aperson.tumblr.com/post/2940228080</link><guid>https://aperson.tumblr.com/post/2940228080</guid><pubDate>Wed, 26 Jan 2011 07:19:00 -0600</pubDate></item><item><title>I'm going to try this out again</title><description>&lt;p&gt;I haven&amp;rsquo;t tried to do this in a while, so I decided to nuke everything and start anew with tumblr.  Instead of trying to have a theme, I&amp;rsquo;m just going to wing it and put whatever I feel like here.  No restrictions for me that way.  That could translate into me actually using this instead of losing motivation.&lt;/p&gt;

&lt;p&gt;Here&amp;rsquo;s hoping I keep going.&lt;/p&gt;</description><link>https://aperson.tumblr.com/post/2939509704</link><guid>https://aperson.tumblr.com/post/2939509704</guid><pubDate>Wed, 26 Jan 2011 04:58:08 -0600</pubDate></item></channel></rss>
