@ wrote... (10 years, 9 months ago)

I'm not sure how else to name this entry, it's rather complicated. So what I was finally able to achieve is to pass a boost::bind to a boost::bind with placeholders, with templated callbacks. I'm not gonna lie, this took me awhile to figure out.

The rationale for all of this was that I had a parent class called group, and this group had the list of boost::asio::deadline_timer's and the boost::asio::io_service running in a thread. I wanted the ability for child objects to put work in that thread.

more…

Category: tech, Tags: boost, cpp, templates
Comments: 0
@ wrote... (10 years, 9 months ago)

Django works much better if you do things the right way. Here are the steps for future me.

more…

Category: tech, Tags: django
Comments: 0
@ wrote... (10 years, 9 months ago)

Part of my Why is simple hard? series.

Do you even typedef bro?

more…

Category: tech, Tags: cpp, programming, simple
Comments: 0
@ wrote... (10 years, 9 months ago)

Part of my Why is simple hard? series.

Like most people with taste, I despise Hungarian notation. But, at the end of the day it really is only a style issue and easy enough to fix with a search & replace.

more…

Category: tech, Tags: cpp, programming, simple
Comments: 0
@ wrote... (10 years, 9 months ago)
Controlling complexity is the essence of computer programming.
Brian Kernighan

This has been bugging me for years, and it's getting worse. In some type of ironic paradox, it seems like the worst programmers are (in some ways) the best programmers.

more…

Category: tech, Tags: programming, simple
Comments: 0
@ wrote... (10 years, 10 months ago)

Although I doubt I'm forging into unknown territory, here is a nice little way I came up with to iterate around a box or square.

def next_coord( w, h ):
    """
    get the next x,y coordinates around your box
    w,h are the width and height of your box

    note, the strange ranges are to prevent getting the corners twice
    this loop configuration goes around clockwise from top left

    for x,y in next_coord(3,3):
        print "(%d,%d)" % (x,y),
    >>> (0,0) (1,0) (2,0) (2,1) (2,2) (1,2) (0,2) (0,1)
    """
    for x in range(0,w-1):        # top
        yield x,0
    for y in range(0,h-1):        # right
        yield w-1,y
    for x in range(w-1,0,-1):     # bottom
        yield x,h-1
    for y in range(h-1,0,-1):     # left
        yield 0,y
Category: tech, Tags: programming, python
Comments: 0
@ wrote... (10 years, 11 months ago)

Edit: use ansible

I just started using puppet a few days ago and so far I'm really liking it. Except it's in Ruby and not Python. If puppet was written in python I would have just hacked up a new derived class. Oh well…

So my problem is that I want to distribute new id_rsa and id_rsa.pub files to my servers but I also want to be DRY. So therefore when I copy the id files over it should be possible to extract the public key and put it in authorized_keys.

This should have been significantly easier but here's how I did it.

more…

Category: tech, Tags: linux, puppet, ssh
Comments: 0
@ wrote... (10 years, 12 months ago)

Helped along greatly by http://yourmacguy.wordpress.com/2012/06/29/osx-automount/

Apple seems to change how nfs/nis/anything unix works with each release. On Snow Leopard my nis and nfs worked great, but after my upgrade to Mountain Lion, less so.

My nis already “works”. As in, ypcat passwd does what you'd expect but permissions and ownership over nfs are still buggered. I'll update this post or make a new one when I have that figured out.

Here's how I got /home to automount a Linux nfs server.

sudo mkdir /etc/automounts
# /etc/auto_master 
# Automounter master map
#
+auto_master        # Use directory service
/net            -hosts      -nobrowse,hidefromfinder,nosuid
#/home          auto_home   -nobrowse,hidefromfinder
/Network/Servers    -fstab
/-          -static

/home /etc/automounts/home
# /etc/automounts/home 
* -fstype=nfs,rw,bg,hard,intr,tcp fs.burgundywall.com:/tank/home/&
sudo automount -vc
ls /home/username

Update: I gave up and just added myself to a local group so that I can edit files on my webserver and get on with my life. Damn you apple.

# as root
dscl . create /Groups/apache gid 48 # where 48 is the group number on linux
dseditgroup -o edit -p -a kneufeld -t user apache # type in your root password
# open a new terminal window and it will have the new permissions
Category: tech, Tags: nfs, osx
Comments: 0
@ wrote... (11 years, 1 month ago)

Holy crap what a disappointment. I've been jonesing for an upgrade for about 6 months now (my current desktop is a Mac Mini 2009) and was eagerly awaiting an updated mini.

So the new mini has a new Ivy Bridge cpu. Whoop-dee-doo.

It only has one Thunderbolt port but at least it does have USB 3.

It only has Intel 4000 graphics. That's a crappy gpu that uses main memory. The reason I wanted a newer mini was so I could play a video game made in the last 5 years. As far as video games go, this mini is worse than the last one and only marginally better than my 3 year old one!

Looks like it's Hackintosh for me because this mini sucks.

Category: tech, Tags: hardware, osx
Comments: 0
@ wrote... (11 years, 8 months ago)

I currently have a two disk raid1 array (2TB in size) that is the storage for my LVM but is running out of space. I want to add two more drives to bring available storage to 4TB but I also want to convert raid1 to raid10 to increase the performance of my storage. Here's how I did it.

more…

Category: tech, Tags: linux, lvm, raid
Comments: 2