George V. Reilly

FlyingCloud 0.3.0 released

I just announced the release of Fly­ing­Cloud 0.3.0 on the fly­ing­cloud-users mailing list. I’ll have more to say about Fly­ing­Cloud in future. For now, let’s just say it’s a tool that we use to build Docker images using masterless SaltStack.

I’ll be speaking about Fly­ing­Cloud at Wednesday’s PuPPy meetup.

psutil kill

From Python, I needed to find a process that was performing SSH tunneling on port 8080 and kill it.

The following works in Bash:

ps aux | grep [s]sh.*:8080 | awk '{print $2}' | xargs kill -9

The grep [s]sh trick ensures that the grep command itself won’t make it through to awk.

Here’s what I came up with in Python using psutil:

def kill_port_forwarding(host_port):
    ssh_args = ["-f", "-N", "-L", "{0}:localhost:{0}".format(host_port)]
    for process in psutil.process_iter():
        try:
            if process.name().endswith('ssh'):
        
continue.

Review: Deadpool

Deadpool is the role that Ryan Reynolds was born to play, the "Merc with a Mouth" anti-hero who breaks the fourth wall and breaks heads with equal facility. It’s very funny, very twisted, and very violent, and it fully deserves its R rating.

Wade Wilson, a former mercenary, has terminal cancer. He undergoes a treatment that not only cures his cancer and renders him capable of re­gen­er­at­ing quickly from any wound, but leaves him horribly scarred. The treatment was actually intended to turn him into a super slave. Wanting both revenge and a cure for his dis­fig­ure­ment, he suits up and tracks down his former captors, leaving dozens of dead henchmen in his wake.

As continue.

Review: Crack'd Pot Trail

Title: Crack’d Pot Trail
Author: Steven Erikson
Rating: ★ ★ ★ ½
Publisher: Tor
Copyright: 2009
Pages: 208
Keywords: fantasy
Reading period: 16–28 February, 2016

A disparate group of necro­mancer hunters and artists are trekking through the desert. They’re out of food and the artists must compete not to be eaten by the strongmen by telling stories by the campfire. It’s the Canterbury Tales crossed with Scheherazade. The narrator shows how he skillfully and shame­less­ly ma­nip­u­lat­ed the various parties. His stories within stories sow doubt and dissension. There’s black humor and art criticism and enough suspense to keep you going, once you get past the in­ter­minable beginning.

Review: Ways to Die in Glasgow

Title: Ways to Die in Glasgow
Author: Jay Stringer
Rating: ★ ★ ★ ½
Publisher: Thomas & Mercer
Copyright: 2015
Pages: 289
Keywords: crime, tartan noir, black comedy
Reading period: 7 December 2015—25 February 2016

New private in­ves­ti­ga­tor Sam Ireland is hired to track down a gangster-turned-memoirist. She can’t find him, but she’s not the only one looking. His lethal nephew also wants to find him, after dealing with two hit men. All of this searching is drawing unwelcome attention to long-held secrets, and more blood will be shed.

A darkly amusing, frenetic tour through Glasgow’s underbelly.

Python: Import subclass from dynamic path

I needed to import some plugin code written in Python from a directory whose path isn’t known until runtime. Further, I needed a class object that was a subclass of the plugin base class.

from somewhere import PluginBase

class SomePlugin(PluginBase):
    def f1(self): ...
    def f2(self): ...

You can use the imp module to actually load the module from impl_dir. Note that impl_dir needs to be tem­porar­i­ly prepended to sys.path. Then you can find the plugin subclass using dir and issubclass.

import os, imp

def import_class(implementation_filename, base_class):
    impl_dir, impl_filename = os.path.split(implementation_filename)
    module_name, _ = os.path.splitext(impl_filename)

    try:
 
continue.

Asking for Help

It’s better to stay calm when things aren’t going well. Stress and panic are contagious. When you’re broad­cast­ing stress or panic on all channels, other people start picking it up. If you can keep your cool, others are more likely to remain calm too. Often that’s for the best, but sometimes it backfires because others in­cor­rect­ly believe that everything is still okay.

Knowing when to ask for help is an art. You learn a lot when you persevere and try different things, many of which may fail. The failures will likely show you where your un­der­stand­ing is deficient; you learn some of the many ways in which things can go wrong. If you throw continue.

Toastmasters Speech Contest

I mentioned a few weeks ago that I was going to be the Contest Chair for the In­ter­na­tion­al Speech and Evaluation Contests at Freely Speaking Toast­mas­ters. Those contests were tonight, and I was both Contest Chair and Toast­mas­ter. The contest chair sets up everything be­fore­hand; the toast­mas­ter runs the contest itself; frequently but not nec­es­sar­i­ly the contest chair is also the toast­mas­ter.

I’m happy with how it came off. I managed to recruit two speakers for the Speech contest and three evaluators for the Evaluation contest, all of whom acquitted themselves well. I also recruited three judges, two ballot counters, one timer, a sergeant at arms, and a test speaker to make the contest run. The continue.

Adapting Books for Film and TV

I came across this cartoon today; it reminded me that I’ve been meaning to write about the hit-or-miss nature of adapting books for the screen.

Books and video/film are different media, with different con­ven­tions and needs. Often the most-loved elements of a book are lost when it’s adapted for television or film, upsetting fans.

As J.K. Rowling wrote about one of the Harry Potter movies:

"It is simply impossible to in­cor­po­rate every one of my storylines into a film that has to be kept under four hours long. Obviously films have re­stric­tions – novels do not have con­straints of time and budget; I can create dazzling effects relying on nothing but the in­ter­ac­tion of my own and continue.

Keybase

I was sent an invite to Keybase a few weeks, which I accepted tonight.

Keybase Wants To Make Serious Encryption Accessible To Mere Mortals explains:

From a cryp­to­graph­ic standpoint, PGP is rock solid. In practice, using it is very messy. Its complexity has deterred the vast majority of people who might otherwise benefit from using encryption.

The first problem is es­tab­lish­ing a valid identity, especially with other people located oceans away. The second is dis­trib­ut­ing public keys without nefarious types posting al­ter­na­tive keys that appear to be registered to the same person. … The third issue is getting people to install and use PGP software.

I can now be reached via https://keybase.io/georgevreil­ly. I’ve proved my identity on GeorgeVReil­ly.com, GitHub, continue.

Previous » « Next