Thursday, June 20, 2013

How to Block the Sponsored Posts on your Tumblr Dashboard

I was surprised at how intrusive I found the sponsored posts that have started appearing in the stream on my Tumblr dashboard.  Luckily if you run the AdBlockplugin it's super easy to tweak your settings to block the sponsored posts:


First, open your AdBlock menu from the icon.  This should be in the upper-right corner of your browser window (I'm using Chrome on OSX in the example).  Select "Options" and you should see this menu towards the botton of your screen.


You'll want to paste this line of code to the bottom of the "Manually Edit Your Filters" window:
www.tumblr.com##DIV[class="sponsored_post"]
Click the "edit" button, add the line of code, and then click the "paste" button. This will block all sponsored posts that appear on Tumblr.com.

How to Probably get Pandoc Running on a Linux Server

(

Drink-by date: This post was written based based on work I did in June, 2013. The GHC, Haskell, Cabal and pandoc were all current versions installed in Ubuntu 10.04. If you're reading this documentation after June, 2015, consider it out of date.

This blog post was the original inspiration to use Pandoc

)

A few months ago I started putting my resumé on Github. As a freelance software dev it's quicker to send somebody to 1 spot to see both code for projects I work on and descriptive, bulleted-list of accomplishments (without all of the monetization noise of LinkedIn). Recently I spent 5 hours on one of those endlessly-recursive campaigns of compiling things from source code in order to save myself a few minutes of maintaining my online resumé in different formats (pdf and markdown) and since it deals with some bugs in some standard Ubuntu / Debian packages, I'll post instructions here for how I fixed them.

My goal was to be able to update my resumé in markdown, and have run a single deploy script that would commit changes, generate a pdf from the markdown and push the updated markdown and pdf to GitHub. There's a Linux utility called "pandoc" that does this and a whole lot more. It's written in Haskell, a powerful functional programming language that is beloved by academics and high-frequency stock traders and otherwise hasn't broken into mainstream software developement.

My first time around, I did a standard "sudo apt-get install pandoc" on my Ubuntu server and thought I was good to go. The syntax for a basic conversin is simple, and like ffmpeg, the input and output formats are inferred by file extension:

$ pandoc resume.md -o resume.pdf

Except that this yielded the following error:

pandoc: resume.md: hGetContents: invalid argument (Invalid or incomplete
multibyte or wide character)

A character-encoding bug. Removing curly quotes from the markdown file confirmed this since it worked fine if the input document was all ascii. But what's the point of a PDF if you have to limit yourself to ugly straight quotes and spelling "resumé" as "resume"? There was some chatter on google groups that this was an issue with setting the right LANG in your locale, but that in later version of pandoc this bug was fixed. Rather than fiddle with global settings, I opted to upgrade pandoc.

The version of pandoc, as well as Haskell and GHC (the Glasgow Haskell Compiler) are all years out of date in debian / ubuntu. (The computer I was working on was running Lucid 10.04 which is supported through 2015). So geting the latest pandoc woudln't be as simple as an apt-get upgrade, and would require upgrading the GHC, Haskell, the Haskell Package Manager (cabal) and finally pandoc. All of these are source-code installs except for the final upgrade of pandoc.

If you've already tried to install pandoc or Haskell via apt-get you'll need to remove the packages via the following command:

$ sudo apt-get autoremove ghc6

Now we're ready to start the installation process. First, install the dependencies via apt-get:

$ sudo apt-get install libgmp3c2 freeglut3 libedit2 libedit-dev freeglut3-dev libglu1-mesa-dev
pandoc uses LaTeX for formatting, so you'll need to get pdflatex on your system.
$ sudo apt-get install texlive-full

Now you'll want to get the source code to build the GHC and the Haskell Platform. First the GHC. This a standard configure / make install build.

Cabal, the Haskell Package manager, is included in the Haskell Platform

$ wget http://lambda.haskell.org/platform/download/2013.2.0.0/haskell-platform-2013.2.0.0.tar.gz
$ gunzip haskell-platform-2013.2.0.0.tar.gz 
$ tar -xvvf haskell-platform-2013.2.0.0.tar 
$ cd haskell-platform-2013.2.0.0
$ ./configure
$ ./make
$ ./sudo make install

You can also get the source for Cabal from GitHub.

Once you have Cabal up and running, first refresh the packages list:

$ cabal update
Now, you can install pandoc
$ cabal install pandoc
Cabal will install a bunch of dependencies. This will tak a few minutes. Cabal installs executables to ~/.cabal/bin/pandoc - you can symlink this to a directory that's already in your path:
sudo ln -s ~/.cabal/bin/pandoc /usr/local/bin/pandoc

Now you should be ready to go. For some pointers as to how I actually automated the generating of pdf's by committing changes to my resumé, check out this shell script: https://github.com/erstwhile/resume/blob/master/deploy

Friday, June 14, 2013

Constructing "Cloud City" - the Mandelbulber settings

I've gotten into playing with 3D fractal rendering this year, using a program called "Mandelbulber." There's a whole scene that's emerged in the last 4 years around rending animations exploring 3D fractals, since the discovery of the "Mandelbulb" (a 3D mapping of the Mandelbrot Set) in 2009. I was playing around with a hybrid fractal (combining several algorithms into 1 system) a few months ago when I discovered something that reminded me of the "Cloud City" gas-mining station from the final act of "The Empire Strikes Back". The color palette comes from a photo of the hallway runner in my house, hence the name "Rugs in the 4th Dimension" This is a closeup flythrough of one of the many "trees" that appear throughout the system: You can get the Mandelbulber settings for this algorithm and explore it via Github.

Saturday, June 8, 2013

James Tenney - Melody, Ergodicity, Indeterminacy

James Tenney (1934-2006) was probably the first composer to develop an aesthetic for computer music, realizing that electronic music almost forced the composer to accept noise as “music” and to abandon the idea of absolute control over a composition. He came to accept Cage's passion for randomness, but from a different angle: computer music can be “unpredictable” (rather than “random”).

Sunday, April 14, 2013

Going to try using a Git Repo on Dropbox

Making another attempt to get my Supercollider coding practices in line with something sane that resembles how I write code in other languages. When I write code in SC I usually work off of the same set of files on a Dropbox folder so I can sketch something on my laptop, and then have those changes automatically deployed to my "rendering" machine (an 8-core Mac Mini) or my "livestream" machine (an older-generation Mac Mini running Nicecast, Supercollider, and nothing else). While Dropbox provides automatic backups and deployment, it doesn't provide version control, so I end up committing the cardinal sin of using filenames for version control ("20130410-livestream.scd" or the like). So I'm going to try setting up a git repo in the Dropbox with the source code for the Livestream project and see how that works out.

The more difficult issue here is doing version control in a system that's designed to run entirely as a REPL - how does Smalltalk do version control? Periodic snapshots of object instances? In sclang, you can use Object.archive to dump the state of an object to a text file and from there use Git or whatever to save. Which is kind of a kludge - in Smalltalk you're running in a virtual machine that is a Smalltalk object, with no files. So where do you keep the snapshots?

Here's some StackOverflow conversations on using Git with Dropbox:
Using Git and Dropbox together effectively?
Is this plain stupid: GIT Sharing Via DropBox?

And a tutorial:
How to use Dropbox as a git repository.