mverdone

blog

Python Twitter Tools 1.9.1

January 27, 2013

Many moons have passed, but we are still here, and code is still moving forward.

Python Twitter Tools 1.9.1 is now hereby released.

Mostly a bugfix release, but there are a few improvements:

  • Default to the Twitter 1.1 API, and change docs to show this. Finally.
  • –force-ansi in the command-line tool, if you really really want it.
  • Embolden hashtags and underline @names in command-line output.
  • A _timeout parameter for calls to the API that take a very long time.
  • Archive your mentions or your favorite tweets using the archiver.
  • Save config files in the right place on Windows.
  • More things!

As usual you can get Python Twitter Tools from PyPI by typing pip install twitter, or download it from the homepage.

At this point I rarely do dev work on Python Twitter Tools. I merely evaluate and merge the pull requests submitted by other talented developers. A great big thank you to all of them! Their names reside safely in the Git project history, for all eternity.

No Comments

Python Twitter Tools 1.9.0

August 3, 2012

Hot off the presses, it’s Python Twitter Tools 1.9.0!

This is mostly a bugfix release, with compatibilty with Python 3.3 (currently in beta). But there are some keen new features:

  • compress connections with gzip, leading to a 5x (or better) data transfer rate (thanks to jameslafa).
  • follow redirects in the twitter-archiver (no more nasty t.co URLs) (thanks to blob79)
  • invert the order of tweets that span over 140 chars, so they appear in order in the cmd line tool (thanks Lacrymology).
  • many other fixes and documentation updates

As always you can

pip install twitter

Or download the relase from PyPI.

No Comments

Generation SpaceX

May 22, 2012

Okay look.

I don’t want to “that guy” who complains about SpaceX but there are a couple things I noticed on the SpaceX launch feed that i need to talk about.

We’re you listening at that historic moment as the rocket finally achieved orbit, and the flight controller announced, with a quaver in her throat “Dragon has entered Earth orbit,” and then the entirety of mission control erupted in spontaneous applause and whooping? Wasn’t that a beautiful, human moment in the otherwise sedate history of mission controller jargon that crowds NASA’s air-ground transmissions?

That precisely is the problem.

If you know anything about space flight, or watched Apollo 13, you’d know that astronauts and mission controllers spend interminable hours performing mission simulations. These extremely detailed simulations include almost every eventuality. NASA mission controllers have a checklist for everything. Spacecraft running out of air? Turn to page 452, halfway down, run through the checklist.

When a real space mission finally happens it feels to NASA mission controllers much like a simulation. And so the transmissions are massively sedate and specific. Sure there are occasional moment of cheer, like when you learn that your capsule is not going to miss orbit and kill your astronauts. But still, mirth is kept at minimum.

Think of it this way: you bring your precious car, a beautiful red Cadillac, to a mechanic to be serviced. He changes the oil and when you start your car, he cheers “hot dang it actually works!” is this the kind of mechanic you want to keep visiting?

What about your heart surgeon?

So imagine being an astronaut on a SpaceX capsule. You reach ISS orbit and mission control chimes in “dudes, ladies, y’all made it into orbit! Sweet hey?”

SpaceX needs to grow up to the point that reaching orbit is a dull, regular event. Every time they launch. Then they will be safe for astronauts. I have faith this won’t take too long, mind you.

Another thing: the announcers on the broadcast kept making the same statement: that the launch of the dragon spacecraft was the first time a private company reached Earth orbit. True, sure, but not all that interesting. Companies do much more expensive and daring (at ledt economically) things every single day. The reason we haven’t had a private launch of a manned space vehicle in the past? There was no money in it, and I’m still not sure if there is given that NASA is pretty much the only customer at this point, and their budgets are shrinking week to week. I hope SpaceX can keep in the game for a while until space tourism can become feasible in, maybe, another decade or two. Or three. Or four…

1 Comment

Python Twitter Tools 1.8.0

May 13, 2012

Python Twitter Tools 1.8.0 is now available. This release features two new scripts submitted by GitHub user StalkR:

  • twitter-archive: a command to archive all of a user’s tweets to a file, for archiving, or semantic analysis, or whatever
  • twitter-follow: a command to find all of a user’s followers (or followees) and print them on the command line

StalkR uses these commands and a clever shell script to archive tweets and the tweets of followers for mysterious and intriguing purposes. A very cool use case.

This release also includes bug fixes, and the documentation is now visible on the PyPI project page, because some users had a hard time finding it.

As always you may:

pip install twitter

Or download the release from PyPI.

Python Twitter Tools is five years old now. I will do a retrospective.

No Comments

Article about Instagram in Culture Magazine

April 21, 2012

(Cult)ure Magazine have published one of my screeds, this one about Instagram. Go read it, if you have the inclination.

No Comments

Arcseconds Release: What’s Your Astrological Sign? / Money

April 18, 2012

New release: Arcseconds – What’s Your Astrological Sign / Money; now available on my Bandcamp page.

More Arcseconds stuff coming this year. It’s happening.

2 Comments

Tiger’s Milk

November 6, 2011

This is a recipe for a breakfast milkshake I loved when I was a kid (and probably still love though I haven’t made it lately). Maybe it will tell you something about my childhood, though I’ll leave it to your interpretation as to what.

Tiger’s Milk

Makes 2 portions.

  • 3/4 cup plain yogourt
  • 1 egg (raw)
  • 1–2 tbsp. honey
  • 1 banana
  • 1/2 to 3/4 cup orange juice
  • 3–4 tbsp. brewer’s yeast or nutritional (hippie) yeast

Process in blender or shake in a jar. Drink.

No Comments

Let’s talk about that Nikon social media meltdown

September 29, 2011

Hokay, so, Nikon posted this message on their Facebook wall social media thing and, well, even talking about it is giving it more play than it deserves and this is basically just gossip at this point but… well… seriously, they wrote this:

I mean, what? What?!

Reaction was swift, and justice was served in the only way that thousands of wronged Internet users can provide: a torrential flood of outraged and sarcastic comments.

For those who don’t know the correct way to think about photographic equipment comes by way of an Ansel Adams quote:

The single most important component of a camera is the twelve inches behind it.

The ever respectable Ken Rockwell expanded and expounded on this idea, too.

So it’s mystifying what must have happened inside Nikon for them to post that. I’m still waiting to learn that today was Japanese April Fools’ day and it was all a joke gone wrong.

This is a good a time as any to say that I haven’t used my Nikon in months. A few months ago I picked up a Casio point and shoot, and I’ve had a lot more fun with it, and taken a lot of rewarding photos.

It’s a lot more limited than the Nikon because you can’t really control the lens or shutter without digging into a pile of menus, but 90% of the time it auto-adjusts itself to produce exactly what I would have settled on with an all-manual camera. This frees me to think about the layout and content of a photo, which is a lot more interesting.

Thing is, there is no such thing as a professional camera brand any more. There are very fancy cameras, yes, that require a significant amount of training and skill to use at their fullest. And I know people who I consider professional photographers not only because they make money, but because they can do things with a fancy camera that are way beyond my technical skill. But, both Canon and Nikon are firmly planted in the “pro-sumer” market.

That’s a horrible term, by the way, “pro-sumer”. I actually think amateur is a better product class. To my mind amateur means, “contains the features you need to have fun and take the photos you want.” Pro-sumer means “we put a lot of fancy shit in your camera to distract you from actually taking photos. Please buy more accessories.”

It occurs to me I have talked about this already. But it doesn’t hurt to repeat it: tools are fun, and good tools are worth using, but it’s what you make that matters. It’s sad when a company can’t even pretend that that’s the case.

1 Comment

buildawall: a script for Minecraft

September 14, 2011

I created buildawall — a utility for Minecraft server admins to put a wall around their world.

Minecraft is a terribly addictive (but worthwhile) game where you try to survive in a harsh, unforgiving wilderness made of Lego-like cubes. And once you learn how to survive, then you build the Eiffel tower, or a cool cave fortress, or stuff like that.

Each Minecraft world is driven by a seed — a single number that powers the world-creation algorithm. The world is almost infinitely large. (Much larger than the Earth, in scale). However, the game only creates the parts of the world that you visit. The creation of new world “chunks” always happens just outside your view so you never notice it.

When a new Minecraft update is released, sometimes the world generator is changed. This makes the world seed create a new and different world than it did with the previous version. The player notices this when they enter new terrain and discover jarring discontinuities. Mountains cleaved in half, that sort of thing.

In order to stop this, I created a program that takes the Minecraft world you’ve visited so far and builds a wall around it. The wall creates a psychological and in-game barrier that delineates “old world” from “new world.”

It also poses a challenge to players as the wall is cored with impenetrable material. Players have to build a staircase to get over the wall, or they can tunnel deep below the earth to get under it. The players’ reward for getting around the wall is a new and exciting world.

If you run a multiplayer Minecraft server and are faced with a world-altering version update (such as right now as the game goes from 1.7.3 to 1.8) I would recommend you try buildawall to mark the end of the world and the beginning of the new one.

2 Comments

Whitepaper: Building a shoebox media server on the cheap

September 12, 2011

I wanted a media server for my place because my laptop hard drive is pretty small, and I have a bunch of movies and music scattered about on a bunch of external hard drives. I had a few requirements:

  • Completely silent. No fans.
  • Large storage (~ 3 Tb or more)
  • Support backing up to cloud backup service (eg. Crashplan, Backblaze)
  • Small
  • Cheap
  • Headless

I looked at home NAS units but found that they wouldn’t support cloud storage. (Cloud backup guys refuse to back-up network storage, so the system has to contact the cloud server autonomously). This also ruled out the Apple Time Capsule.

The Mac Mini was ruled out for not having sufficient space, and being too expensive for this purpose, given that most of its shiny features would be wasted on a headless system.

Most off-the-shelf PCs featured large power supplies with fans, which was not what I wanted.

So I decided to build a cheap PC from parts.

The Hardware

Mainboard: ASUS AT4NM10T-I

I don’t know what all the gibberish characters mean, but it’s a pretty cheap mainboard with an Intel Atom D425 CPU. It draws very little power and it’s 64 bit and stuff. It has four SATA connectors for hard drives and USB2 or whatever. Curiously it also has a PS/2 mouse/keyboard port, a parallel port, and a COM port. Why? You’d think they’d save some money on components by ditching these features. Whatever.

I guess it also has sound outputs. Oh, and gigabit Ethernet. That’s important.

Hard disk: Seagate 2 Tb “Green” or something

It’s got 2 Tb of storage which is plenty big. It’s 5400 RPM, which is slower than average, but consumes less power and is quieter. That’s important.

I also have a Western Digital 1.5 Tb “Green” hard disk, which I think is a bit louder and power-hungry. That will be the second disk at some point.

Power supply: PicoPSU 160 XT

This is cool: the PicoPSU 160 XT is a tiny, fanless power supply that delivers 160 watts (peak 200 W). That’s quite a bit for a low-power system. I suspect I can get the mainboard and three 3.5” hard disks running from this thing.

The bulk of the power supply is external, like a laptop. I bought it as a kit with the power supply and an external power transformer (110-220 V AC to 12 V DC). The transformer is about the size of the one from the original XBox 360. If you’re not a nerd, that means too big. But it’s fine.

The Software

I got Linux from the Internet.

I used Ubuntu Server 10.04 LTS. Basically, Ubuntu is great and so easy to use some people claim it’s “not Linux”. I’d stay away from 11.04, though. From previous experience it’s pretty buggy, and you don’t need bleeding edge for a media server.

The Installation

As I said, I wanted this to be a headless server, and beside my laptop, I don’t own a keyboard or screen. The challenge was to get a working OS onto the hard disk and then install it in the machine.

To begin, I installed VirtualBox on my mac and set up Ubuntu Server in a virtual machine. (Note: do not use LVM) I bound the virtual hard disk to 8 Gb even though I had a 2 Tb target disk. This is important.

Then, I converted the VirtualBox VDI (virtual disk image) to RAW format. The command is basically this:

VBoxManage internalcommands converthd hard_disk.vdi hard_disk.raw

That gives you an 8 Gb file.

Next, I connected my 2 Tb hard disk to a USB drive enclosure and plugged it in. OS X complained about the unformatted drive, but I told it to shut up. The disk appeared at /dev/disk1 (note: sometimes it was /dev/disk2. If you are doing the same thing as me, this right here is the first step that could hose your laptop if you do it wrong. Make sure you pick the right disk.)

Using the magical dd command, I dumped the raw disk file onto the physical hard disk.

dd if=hard_disk.raw of=/dev/disk1

This took a while.

(Astute readers might wonder why I didn’t direct VBoxManage directly onto the disk. That’s because VBoxManage is a jerk and refuses to write to an existing file.)

Problem: now we have a 2 Tb hard disk with an 8 Gb partition table. Oh, and Apple’s partition table is different from Linux so it’s dicey to go and change it there.

Solution: we need to mount the disk in Linux. It’s possible, albeit slightly insane, to mount a physical disk in a VirtualBox image. Here’s the magic command to do it:

VBoxManage internalcommands createrawvmdk -filename disk.vmdk -rawdisk /dev/disk1

Then I booted disk.vmdk into VirtualBox and got my Linux. Easy.

From there I was able to use fdisk and fiddle with the partition table. The most important tip here is to ensure the starting cylinder/byte of your root partition is unchanged. Swap and stuff can be fixed later.

# In your virtual terminal:
sudo fdisk /dev/sda

After a reboot your partition is bigger but the filesystem is still at 8 Gb. Now you must tell the filesystem to fill the extra space. Linux has an insane feature that lets you resize a filesystem while it is running. No really. Crazy shit.

sudo resize2fs /dev/sda1

This took, like, four hours. Remember, we’re on a slow-ass USB disk here. You could do this after the disk is installed in the media server, actually. Probably would have been smarter.

Finally, I connected the hard disk to the mainboard. I needed an enclosure.

As previously mentioned, all the small enclosures on the market are too small for 3.5” disks, and those that are big enough come with noisy fan-filled PSU’s. I grabbed a shoebox and some duct tape (fact: most duct tape is non-conductive because it’s actually duck tape). I shoved all the pieces in there.

The last step was convincing the mainboard to boot. See, I didn’t have a power button. I looked in the manual and found the power button pins on the mainboard. Then I shorted those pins with a copper coin. The system started up.

(Fact: booting a PC by shorting pins on the mainboard is basically the most bad-ass nerdy thing you can do).

The system booted and didn’t appear on the network. Crap.

I disconnected the disk, reattached it via USB and booted in a virtual box again. By examining logs I found that Ubuntu got confused by the new network adapter and gave it a port of eth1, which was not configured. I modified /etc/network/interfaces and added these lines:

auto eth1
iface eth1 inet dhcp

This finally convinced the PC to connect to the network and I could ssh to it and finish the install.

Results

It works! The thing lives!

I still need to configure Crashplan for offsite storage, and install the second hard disk, but basically the experiment was a wonderful success.

2 Comments