All Posts

What Rollout will be?

Tweet I have been debating just helping with fabric or writing my own app for a week now and I just think what I need and want fabric just isn’t and too much work to get it to the way I want it to be. So here are some of the things I want Rollout to be. Be able to run in console Be able to tie the Rollout API into your own python webapp Rollout output should be multiformat (xml/json) Should be threaded Should have a run_first() and run_last() method Tie in git/svn?

Rollout has been designed

Tweet I’m a big fan of fabric, a python module to make deployments easy. It is still very new but has some great features and some major short comings I don’t think the authors thought of before they designed it. The major shortcoming is a lack of parallel deployments. Fabric works great on 1 or 2 hosts you need to deploy on but when you have more then that for a large application it is painful.

Remote Editing with Eclipse

Tweet I was doing some Django work trying to get PayPal WPP to work with my application and it was stuck behind your basic LinkSys wifi router. Now you can just go in and forward the ports, edit PalPal configs and bla bla bla. That is no fun. So I found a nice little plugin for eclipse that handles remote editing over SFTP. So now I can do all my remote testing/development via SFTP and not have to make all these changes.

Reason #1 on why Django is great

Tweet All the crazy helper function they have for models to display information in templates. Say I have a model that looks like this with a choice field (it will get rendered as a select input in html. SEX_CHOICE = ( (1, 'Male'), (2, 'Female'), ) class Animal(models.Model): name = models.CharField(max_length=50) sex = models.SmallIntegerField(max_length=1, default=0, choices=SEX_CHOICE) Now in my template I can do the following to see if an animal object is a Male or a Female

Remove Leading 0’s in Bash

Tweet So you have a var you want to remove leading 0’s on.. well do the follwing mzupan@mzupan-desktop:~$ var=00014 mzupan@mzupan-desktop:~$ let var=”10#$var” mzupan@mzupan-desktop:~$ echo $var 14 mzupan@mzupan-desktop:~$

Install fabric on Redhat/CentOS 5

Tweet Fabric is a great tool for helping deploy applications. It is written in Python and still in it’s early stages. The big issue is that fabric will not run on python v2.4. That is a problem since Redhat/CentOS v5 ships with v2.4 so we have to make it work. So the first thing to do is install python 2.5. I found great rpms here. I am going to mirror the RPMS on my blog just in case.

Bash: Get largest files in a directory

Tweet So you have a partition with a ton of subdirectories and the partition is almost full and you want to see if there are large files eating up space. There is an easy command you can run to list the 10 biggest files find /directory -printf ‘%s %p\n’ | sort -nr | head -n 10 You can change the head -n 10 to -n 20 if you want to get the 20 biggest files.

Install puppet-dashboard on RedHat/CentOS 5

Tweet If you have a puppet network in place you will want to use puppet-dashboard. It is a fairly new project and still has some misssing pieces but overall a good way to tell the health of your puppet network. The thing I really like about it is that you can see when the last check in time is for a client and if it had any errors or warnings during its runs so you can fix them.

Calculate Distance In Mysql with Latitude and Longitude

Tweet So you have a whole table full of members or places with latitude and longitude’s associated with them. Just replace the $lat and $lon with the center point you want to find distances from. You can also change the distance<=10 to a number you want to search from. This will limit your results to all results that are under 10 miles from the starting point SELECT ((ACOS(SIN($lat * PI() / 180) * SIN(lat * PI() / 180) + COS($lat * PI() / 180) * COS(lat * PI() / 180) * COS(($lon – lon) * PI() / 180)) * 180 / PI()) * 60 * 1.

Line breaks in command output redirect

Tweet Every now and then you need to save command output into a bash var from a command. Generally it looks like VAR=`command` That will put the stdout of command into $VAR There is an issue if the output has linebreaks. Recently I had this issue trying to email SVN diffs for DNS changes. My command to get the diffs looked like this DIFF=`svn diff /var/named/chroot/var/named/ /var/named/chroot/etc/`