@ wrote... (5 years, 2 months ago)

Depending on the hardware involved, you can dramatically speed up an ssh pipe by changing the encryption type, or turning off compression.

more…

Category: tech, Tags: linux, ssh
Comments: 0
@ wrote... (5 years, 3 months ago)

From what I can tell everybody uses net-snmp, and from what I've seen the documentation is atrocious.

more…

Category: tech, Tags: snmp
Comments: 0
@ wrote... (5 years, 3 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 rational 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... (5 years, 3 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... (5 years, 3 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... (5 years, 3 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... (5 years, 3 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... (5 years, 4 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... (5 years, 6 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... (5 years, 6 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