Django works much better if you do things the right way. Here are the steps for future me.
Controlling complexity is the essence of computer programming.
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.
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
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.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.
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
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.
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.
To autostart the very excellent SickBeard and SABnzbd on OSX (Snow Leopard in my case) you need to create two plist files and then tell launchd to start them.