Archive for the 'coding' Category
A thread on Reddit nudged me to try the Emacs mail readers again. I have tried a bunch of them (Wanderlust, Gnus, mew) but found them either too idiosyncratic or painful to use, and for the most part just read my e-mail by logging into Google directly. However, I just installed mu / mu4e and [...]
Must Have Utilities for Mac OS X
Monday, June 11th, 2012
My list of must-have utilities for Mac OS X: Flycut (General Arcade) — stores your last n clipboards and allows you to easily choose one to paste. Saves a surprising amount of effort (for example, copying username / password? No more switching back and forth — just copy twice, switch to the terminal application, and [...]
Using Markdown with Mutt
Wednesday, August 24th, 2011
This took me a while to figure out, so in the hopes that I can save someone some time, here’s how to use markdown with Mutt: Step 1: Install msmtp (or any other program) On OS X you can do this with “brew install msmtp”. (You can use sendmail or whatever, but msmtp was easy [...]
Ubuntu 11.04 / Buffalo WLI-UC-G300HP
Tuesday, June 28th, 2011
Super quick, just thrown out in the hopes it may save some Googlers some time: I was getting really slow wireless connections on my Buffalo WLI-UC-G300HP adapter with intermittent disconnects. This link had the clearest directions, although: usb_buffer_free and usb_buffer_alloc had changed in the most recent kernel needed to add a device code for my [...]
Editing WordPress Locally
Tuesday, June 14th, 2011
I’ve written before on editing WordPress locally, but recent circumstances (moving my blog to another server) made me take another look at it. I had written a utility previously that was based on git, but on reflection git is unnecessary. So, stripped out most of the code and moved it into wordpress-shuffle, that allow you [...]
Using Google Authenticator For Your Website
Saturday, February 26th, 2011
Google has started offering two-factor authentication for Google logins, using Google Authenticator. They have applications available for iPhone, Android, and Blackberry that give time-based passwords based on the proposed TOTP (Time-based One Time Password) draft standard. The Google code provides a command line program that can generate secret keys as well as a PAM module, [...]
Hadoop Shim To Clojure
Monday, November 8th, 2010
I’ve been working with Hadoop a lot lately in order to do some exploratory data analysis on traffic logs. Hadoop is great; it makes things that were taking 30 minutes run 10x faster, which means that I can iterate a lot faster and experiment with more ways to slice the data. I wanted an easy [...]
Beaujiful Soup
Wednesday, October 27th, 2010
Horrible name, isn’t it? Beautiful Soup is a really nice Python library for extracting content from possibly-sloppy HTML, and I wanted some reasonably close Clojure equivalent. Unfortunately, the standard classes don’t work well with malformed HTML; as an example: [code lang='clojure'] => (require '(clojure [xml :as xml])) => (xml/parse "http://www.google.com") org.xml.sax.SAXParseException: The markup in the [...]
Setting Up Incanter and MySQL
Thursday, January 21st, 2010
Okay, Lein really does make stuff pretty easy. Rather than wrestling with eleventybillion classpaths, just install Lein. Create a new project directory with lein new mydirectory Change the project.clj file that is autogenerated with: [code lang='clojure'] (defproject mydirectory "1.0.0-SNAPSHOT" :description "FIXME: write" :dependencies [[org.clojure/clojure "1.1.0-alpha-SNAPSHOT"] [org.clojure/clojure-contrib "1.0-SNAPSHOT"] [mysql/mysql-connector-java "5.1.6"] [incanter/incanter "1.0-master-SNAPSHOT"]]) [/code] (that is, add [...]
Tethering an iPhone with SSH and Windows 7
Saturday, January 16th, 2010
I don’t need to tether through my iPhone — I always seem to be near a hotspot — but nonetheless I thought that spending 10 minutes to set it up was worth it, because when you need tethering, you really need tethering. If you’re willing to drop $10 bucks there are a couple of apps [...]
A Modest Proposal
Tuesday, September 1st, 2009
Warning: a very rambling article; less a solid proposal than me just exploring an idea that may lead to a dead end in a week or two after I’ve thought about it. I really enjoy Clojure. Everything seems so well thought out and well designed; in a lot of ways it reminds me of Python, [...]
Snippet: Automatic Proxy Creation in Clojure
Friday, August 21st, 2009
The proxy function makes it easy for Clojure to interface with the Java layer, but I was dealing with an interface (the AIM Java API) that had an punitive number of things that needed to be overridden… [code lang="java"] public void OnIdleStateChange(AccSession arg0, int arg1) { } public void OnInstanceChange(AccSession arg0, AccInstance arg1, AccInstance arg2, [...]
Pattern Matching In Clojure
Wednesday, August 12th, 2009
Updated: Note that this is available as a clojars module. Clojure code density seems to be pretty good. There are a fair number of convenient shortforms in the language; for example, associative datatypes all act as a function — so given a hash map you can reference it with (my-hashmap :key). The base language itself [...]
aset is Faster Than aset-int
Saturday, August 8th, 2009
Clojure isn’t the fastest functional lanuage — that title seems to go to Haskell these days, at least for the stuff that I do — but it nonetheless is usually fast enough. It’s a dynamic language, so is perhaps cursed to be somewhat slower always, but nonetheless for the things that I do, it seems [...]
Tokyo Cabinet API for Clojure
Thursday, August 6th, 2009
I’ve been playing with Tokyo Cabinet and Clojure for a bit, and while I will go on about both of them in another blog post (or not), I have to mention that Clojure is such a well designed language that it’s a pleasure to play with. It has much of the same intrinsic power as [...]
Posting To WordPress From Git
Monday, July 27th, 2009
I’ve found WordPress to be pretty decent, aside from the security updates every other week, but for me writing is a very spur of the moment thing; I prefer to be able to go into Emacs and just immediately type anything without having to log into my blog, create a new post, and then suffer [...]
Hacks: Python Calling PHP
Tuesday, July 21st, 2009
(This is almost too stupid to post, but on the off chance that someone actually needs something like this…) I needed to interface with a bunch of data that had PHP wrapper classes, and needed a quick way of being able to interface with PHP from Python. (At this point, you might find it hard [...]
Recovering From A –hard Reset In Git
Saturday, April 18th, 2009
I was switching between git repositories the other day, and managed to do a “git reset –hard HEAD^” in the wrong repository. Which wasn’t bad, since I had most of the files already open in Emacs… but then Emacs calmly told me that it was re-reading the files from disk. But, git had everything still [...]
Stupid Haskell Tricks
Monday, April 13th, 2009
Let’s say that you really, really want some notion of objected oriented programming. So let’s make a class that represents a name, and some simple method calls on it: [code lang="haskell"] data S = S { name :: String } deriving (Show) firstname s = (words (name s))!!0 lastname s = (words (name s))!!1 [/code] [...]
Haskell To WordPress (Snippet)
Friday, April 10th, 2009
A small snippet of code that demonstrates calling into a WordPress XML-RPC server with Haskell and HaxR. [code lang="haskell"] import qualified Data.Map as Map import Data.Maybe import Network.XmlRpc.Client import Network.XmlRpc.Internals server = "http://yourserver.wordpress.com/xmlrpc.php" -- extract multiple posts from the XML response extract :: Value -> [Map String Value] extract xmlresp = let ValueArray rs = [...]