<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Qugstart Blog</title>
	<atom:link href="http://qugstart.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://qugstart.com/blog</link>
	<description>Ruby, Rails, Nerdy, Life</description>
	<lastBuildDate>Wed, 19 May 2010 20:42:48 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Adding Git Email Notifications via Post-receive hook</title>
		<link>http://qugstart.com/blog/git-and-svn/adding-git-email-notifications-via-post-receive-hook/</link>
		<comments>http://qugstart.com/blog/git-and-svn/adding-git-email-notifications-via-post-receive-hook/#comments</comments>
		<pubDate>Wed, 19 May 2010 20:39:17 +0000</pubDate>
		<dc:creator>Qug</dc:creator>
				<category><![CDATA[Git and SVN]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[Git]]></category>
		<category><![CDATA[hook]]></category>
		<category><![CDATA[notifications]]></category>
		<category><![CDATA[post-receive]]></category>

		<guid isPermaLink="false">http://qugstart.com/blog/?p=68</guid>
		<description><![CDATA[This was done on Fedora 10 in my case, but should be similar for all distributions. This is set up on a shared &#8216;central&#8217; repository, where changes are pushed to. That&#8217;s why it&#8217;s done using the post-receive hook (the repository receives changes).
Step 1: Copy (or symlink) the post-receive script, or download it here. The script [...]]]></description>
			<content:encoded><![CDATA[<p>This was done on Fedora 10 in my case, but should be similar for all distributions. This is set up on a shared &#8216;central&#8217; repository, where changes are pushed to. That&#8217;s why it&#8217;s done using the post-receive hook (the repository <em>receives</em> changes).</p>
<p><strong>Step 1</strong>: Copy (or symlink) the post-receive script, or <a href="http://git.kernel.org/?p=git/git.git;a=blob;f=contrib/hooks/post-receive-email;h=60cbab65d3f8230be3041a13fac2fd9f9b3018d5;hb=HEAD">download it here</a>. The script must be in the &#8216;hooks&#8217; directory like this:<br />
$GIT_DIR/hooks/post-receive</p>
<p>I&#8217;ve read that on Debian systems, for example, the hook is stored in /usr/share/doc/git-core/contrib/hooks/post-receive-email but i had no luck finding it here on my system. </p>
<p>Make sure it is named &#8220;post-receive&#8221; so that Git recognizes it.</p>
<p><strong>Step 2</strong>: Make sure that the script is executable:</p>
<pre class="prettyprint" lang="bash">
chmod a+x $GIT_DIR/hooks/post-receive
</pre>
<p><strong>Step 3: </strong>Edit the first line of $GIT_DIR/description to be your repository name. This will be in the subject of the email.</p>
<p><strong>Step 4:</strong> Edit $GIT_DIR/config with some email settings such as recipient / sender email and subject-line prefix. Here&#8217;s some basic settings (read the script for all possible settings).</p>
<pre class="prettyprint" lang="bash">
[hooks]
mailinglist = "receiver1@receivers.com, receiver2@receivers.com"
envelopesender = sender@senders.com
emailprefix = "[GIT] "
</pre>
<p>Note: you can also set these by using git-config:</p>
<pre class="prettyprint" lang="bash">
git-config hooks.mailinglist "receiver1@receivers.com, receiver2@receivers.com"
git-config hooks.envelopesender sender@senders.com
git-config hooks.emailprefix "[GIT] "
</pre>
<p>That&#8217;s it ! Try doing a git-push to your shared repository, and see if you get email notifications. If not, try tailing your mail log to see what&#8217;s wrong (/var/log/maillog).</p>
]]></content:encoded>
			<wfw:commentRss>http://qugstart.com/blog/git-and-svn/adding-git-email-notifications-via-post-receive-hook/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CentOS NFS How-to Guide: Exporting and Mounting a NFS Drive</title>
		<link>http://qugstart.com/blog/linux/centos-nfs-how-to-guide-exporting-and-mounting-a-nfs-drive/</link>
		<comments>http://qugstart.com/blog/linux/centos-nfs-how-to-guide-exporting-and-mounting-a-nfs-drive/#comments</comments>
		<pubDate>Fri, 09 Apr 2010 02:22:16 +0000</pubDate>
		<dc:creator>Qug</dc:creator>
				<category><![CDATA[Networking]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[export]]></category>
		<category><![CDATA[mount]]></category>
		<category><![CDATA[NFS]]></category>
		<category><![CDATA[portmap]]></category>

		<guid isPermaLink="false">http://qugstart.com/blog/?p=62</guid>
		<description><![CDATA[This guide shows you how to start an NFS service on one (host) machine, export the NFS drive, and then connect to that NFS drive from a client machine.
## On the NFS host machine:
#Start Portmap service if needed.
#NFS uses portmap and a bunch of ports (that you can set in /etc/sysconfig/nfs) if you want.
See this [...]]]></description>
			<content:encoded><![CDATA[<p>This guide shows you how to start an NFS service on one (host) machine, export the NFS drive, and then connect to that NFS drive from a client machine.</p>
<p>## On the NFS host machine:</p>
<p>#Start Portmap service if needed.<br />
#NFS uses portmap and a bunch of ports (that you can set in /etc/sysconfig/nfs) if you want.<br />
See this <a href="http://pario.no/2008/01/15/allow-nfs-through-iptables-on-a-redhat-system/">link for more details on NFS ports</a>.</p>
<p>#Start portmap service</p>
<pre lang='bash' class='prettyprint'>
service portmap status
service portmap start (if needed)
</pre>
<p>#Start NFS</p>
<pre lang='bash' class='prettyprint'>
service nfs start
</pre>
<p>#Edit /etc/exports<br />
#Reference: https://www.redhat.com/docs/manuals/enterprise/RHEL-3-Manual/ref-guide/s1-nfs-server-export.html</p>
<p>Format is (select the options you want):<br />
 [Directory to export] [Hosts to allow](options)</p>
<pre lang='bash' class='prettyprint'>
/home/just_testing 192.168.0.0/24(rw,async,wdelay,root_squash)
</pre>
<p>#Run exportfs to refresh NFS exports</p>
<pre lang='bash' class='prettyprint'>
exportfs -av
</pre>
<p>Be sure the proper ports are open on iptables<br />
Reference: http://pario.no/2008/01/15/allow-nfs-through-iptables-on-a-redhat-system/</p>
<p>## Now on your NFS client machine:<br />
Start portmap</p>
<pre lang='bash' class='prettyprint'>
service portmap start
</pre>
<p>Create a mount point and mount the NFS drive. Remember to use your own server&#8217;s IP address:</p>
<pre lang='bash' class='prettyprint'>
mkdir /mnt/nfs-usbdisk
mount 192.168.0.2:/home/just_testing /mnt/nfs-usbdisk
</pre>
<p>Voila ! Tail your logs if you have any problems !</p>
]]></content:encoded>
			<wfw:commentRss>http://qugstart.com/blog/linux/centos-nfs-how-to-guide-exporting-and-mounting-a-nfs-drive/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to mount an Amazon S3 bucket as virtual drive on CentOS 5.2</title>
		<link>http://qugstart.com/blog/linux/how-to-mount-an-amazon-s3-bucket-as-virtual-drive-on-centos-5-2/</link>
		<comments>http://qugstart.com/blog/linux/how-to-mount-an-amazon-s3-bucket-as-virtual-drive-on-centos-5-2/#comments</comments>
		<pubDate>Wed, 07 Apr 2010 01:38:41 +0000</pubDate>
		<dc:creator>Qug</dc:creator>
				<category><![CDATA[Amazon Web Services]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[Amazon]]></category>
		<category><![CDATA[aws]]></category>
		<category><![CDATA[bucket]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[mount]]></category>
		<category><![CDATA[s3]]></category>

		<guid isPermaLink="false">http://qugstart.com/blog/?p=53</guid>
		<description><![CDATA[#Note: If you are using CentOS 4, it&#8217;s the same general process. You might have more difficulty finding the packages to install fuse and dependencies.
This is a simple guide on how to mount your S3 bucket as a &#8220;virtual drive&#8221;. This is great for backing up your data to S3, or downloading a bunch of [...]]]></description>
			<content:encoded><![CDATA[<p>#Note: If you are using CentOS 4, it&#8217;s the same general process. You might have more difficulty finding the packages to install fuse and dependencies.</p>
<p>This is a simple guide on how to mount your S3 bucket as a &#8220;virtual drive&#8221;. This is great for backing up your data to S3, or downloading a bunch of files from S3.</p>
<p>#First, make sure you have the fuse package installed.</p>
<p>#On CentOS, fuse is available from RPMforge </p>
<pre lang='bash' class='prettyprint'>
#http://wiki.centos.org/AdditionalResources/Repositories/RPMForge
</pre>
<p>#Now install fuse</p>
<pre lang='bash' class='prettyprint'>
yum install fuse
modprobe fuse
</pre>
<p>#Download s3fs and make</p>
<pre lang='bash' class='prettyprint'>
cd /usr/local/src
wget http://s3fs.googlecode.com/files/s3fs-r191-source.tar.gz
cd s3fs
make
</pre>
<p>#Copy the binary to /usr/local/bin (or wherever you prefer)</p>
<pre lang='bash' class='prettyprint'>
cp s3fs /usr/local/bin
</pre>
<p>#Make a mount point </p>
<pre lang='bash' class='prettyprint'>
mkdir /mnt/s3drive
</pre>
<p>#Mount your bucket like this:</p>
<pre lang='bash' class='prettyprint'>
s3fs bucketname -o accessKeyId=XXXXXXXXXXXXXXXXXXXX -o secretAccessKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX /mnt/s3drive
</pre>
<p>That&#8217;s it ! You can change directory to your virtual drive or start copying files !<br />
Go ahead and use a visual client such as CyberDuck or S3Hub to verify with your own eyes that this actually worked. <img src='http://qugstart.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
Good luck!</p>
]]></content:encoded>
			<wfw:commentRss>http://qugstart.com/blog/linux/how-to-mount-an-amazon-s3-bucket-as-virtual-drive-on-centos-5-2/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>How to Set up DB server on Amazon EC2 with data stored on EBS drive formatted with XFS</title>
		<link>http://qugstart.com/blog/amazon-web-services/how-to-set-up-db-server-on-amazon-ec2-with-data-stored-on-ebs-drive-formatted-with-xfs/</link>
		<comments>http://qugstart.com/blog/amazon-web-services/how-to-set-up-db-server-on-amazon-ec2-with-data-stored-on-ebs-drive-formatted-with-xfs/#comments</comments>
		<pubDate>Fri, 19 Mar 2010 22:56:17 +0000</pubDate>
		<dc:creator>Qug</dc:creator>
				<category><![CDATA[Amazon Web Services]]></category>
		<category><![CDATA[Amazon]]></category>
		<category><![CDATA[aws]]></category>
		<category><![CDATA[Cloud Computing]]></category>
		<category><![CDATA[DB server]]></category>
		<category><![CDATA[EBS]]></category>
		<category><![CDATA[ec2]]></category>

		<guid isPermaLink="false">http://qugstart.com/blog/?p=44</guid>
		<description><![CDATA[Working with Amazon Web Services (AWS) such as EC2, S3, and EBS takes some time to get familiar with all the tools, acronyms, and especially paradigm of thinking about servers. Once you get into it, you quickly find much old (outdated) documentation, and you can easily find yourself spending hours searching the web for blog [...]]]></description>
			<content:encoded><![CDATA[<p>Working with Amazon Web Services (AWS) such as EC2, S3, and EBS takes some time to get familiar with all the tools, acronyms, and especially paradigm of thinking about servers. Once you get into it, you quickly find much old (outdated) documentation, and you can easily find yourself spending hours searching the web for blog posts to help in your quest!</p>
<p>After much research, I decided to create a Mysql database server on a &#8216;instance-store&#8217; small ec2 server, with all the precious Mysql data stored on a EBS volume attached to my server. This way, I could easily create snapshot backups of my databases for FAST backups. Here&#8217;s the procedure I decided on. It involves symlinking Mysql config files and data directories onto the EBS volume. </p>
<p>Another trick I used because I needed to migrate about 20 GiB&#8217;s of data to get started, was that I initially set up an &#8220;X-tra large&#8221; instance, with 10 GiB&#8217;s RAM to handle the data import. After the data was migrated and imported to my database, I simply terminated my X-Large instance and spun up a small instance connected to the same EBS volume! All the databases were preserved  nicely and I did not have to waste money paying for an X-Large instance anymore. This exemplifies the value of thinking in the &#8220;cloud&#8221; mindset &#8211; where you can spin up and down servers in a matter of seconds! Hope this article helps someone else out there! </p>
<p>Great Reference: http://developer.amazonwebservices.com/connect/entry.jspa?externalID=1663</p>
<p># Create small instance (I used the AMI for i.386 CentOS 5.4)</p>
<p># Create EBS volume and attach it to the EC2 (as /dev/sdh in my example)</p>
<p># Install mysql-server</p>
<pre lang='bash' class='prettyprint'>
yum install mysql-server
</pre>
<p># Install xfsprogs so you can format EBS drive with XFS</p>
<pre lang='bash' class='prettyprint'>
yum install xfsprogs
modprobe xfs
mkfs.xfs /dev/sdh
</pre>
<p># Add to your /etc/fstab so it mounts on boot</p>
<pre lang='bash' class='prettyprint'>
echo "/dev/sdh /vol xfs noatime 0 0" | sudo tee -a /etc/fstab
sudo mkdir -m 000 /vol
sudo mount /vol
</pre>
<p># Create directories that will store persistant Mysql data</p>
<pre lang='bash' class='prettyprint'>
mkdir /vol/etc /vol/lib /vol/log
</pre>
<p># Move the mysql config and data files to your newly mounted drive </p>
<pre lang='bash' class='prettyprint'>
mv /etc/my.cnf  /vol/etc/
mv /var/lib/mysql /vol/lib/
mv /var/log/mysqld.log /vol/log/
</pre>
<p># Symlink the mysql directories so that mysql uses the mounted EBS drive</p>
<pre lang='bash' class='prettyprint'>
ln -s /vol/lib/mysql /var/lib/mysql
ln -s /vol/etc/my.cnf /etc/my.cnf
ln -s /vol/log/mysqld.log /var/log/mysqld.log
</pre>
<p>Now restart your Mysql server and check your logs if you have any errors!</p>
<pre lang='bash' class='prettyprint'>
service mysqld start

# If you have errors, watch the logs
tail -f /var/log/mysqld.log
</pre>
<p>Good luck !</p>
]]></content:encoded>
			<wfw:commentRss>http://qugstart.com/blog/amazon-web-services/how-to-set-up-db-server-on-amazon-ec2-with-data-stored-on-ebs-drive-formatted-with-xfs/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Setup a Git Repository for Redmine</title>
		<link>http://qugstart.com/blog/ruby-and-rails/setup-a-git-repository-for-redmine/</link>
		<comments>http://qugstart.com/blog/ruby-and-rails/setup-a-git-repository-for-redmine/#comments</comments>
		<pubDate>Sat, 24 Oct 2009 00:08:10 +0000</pubDate>
		<dc:creator>Qug</dc:creator>
				<category><![CDATA[Git and SVN]]></category>
		<category><![CDATA[Ruby and Rails]]></category>
		<category><![CDATA[Git]]></category>
		<category><![CDATA[Redmine]]></category>
		<category><![CDATA[repository]]></category>

		<guid isPermaLink="false">http://qugstart.com/blog/?p=33</guid>
		<description><![CDATA[Just installed Redmine for our project management / code tracking with Git. I must say it&#8217;s pretty nice being able to setup multiple projects easily (unlike Trac). The system is designed fairly well with a very user-friendly interface. And plus, it&#8217;s Rails !!
Anyways&#8230; too much on Redmine! This post is to describe how to setup [...]]]></description>
			<content:encoded><![CDATA[<p>Just installed Redmine for our project management / code tracking with Git. I must say it&#8217;s pretty nice being able to setup multiple projects easily (unlike Trac). The system is designed fairly well with a very user-friendly interface. And plus, it&#8217;s Rails !!</p>
<p>Anyways&#8230; too much on Redmine! This post is to describe how to setup a Git repository for use with Redmine.</p>
<p>The important thing to note is that the Git repository MUST BE on the same server as your Redmine setup. So, you probably need to have access to that server!<br />
This was not ideal for me because our Git server does not have Ruby/Rails, etc. installed on it. That&#8217;s okay! You just need to clone the repository as a BARE repository on the same machine that your Redmine app is running on. Let&#8217;s see how:</p>
<p>Pick a place on your Redmine app server to house all your bare Git repos.<br />
I will choose &#8220;/var/local/git_copies&#8221; for my example.</p>
<p>Note: Make sure that your permissions allow for your web-user to access these Git repos. My web-user is &#8216;build&#8217;.</p>
<pre lang='bash' class='prettyprint'>
# Change to build user (see above)
$ su - build
# Create the directory
$ mkdir /var/local/git_copies
</pre>
<p>Now, create your git clone as a bare repository clone.<br />
Note: a bare repository will not have your actual files. It will just contain the standard git folders</p>
<pre lang='bash' class='prettyprint'>
# Goto your git_copies directory
$ cd /var/local/git_copies
# Make a bare clone of the repo
$ git clone --bare ssh://git@reposerver/usr/local/git_root/foo-project.git
</pre>
<p>Change into your project and configure remote branch tracking for your local copy.</p>
<pre lang='bash' class='prettyprint'>
$ cd foo-project.git
$ git remote add origin ssh://git@reposerver/usr/local/git_root/foo-project.git
</pre>
<p>Now, normally you want to sync up the repo, but you cannot do a normal git fetch &#038;&#038; git merge into a bare repo.<br />
Instead, do a fetch and reset the HEAD to point to the remote branch commit. You need the &#8216;&#8211;soft&#8217; flag or else you will see errors!</p>
<pre lang='bash' class='prettyprint'>
$ git fetch origin
$ git reset --soft refs/remotes/origin/master
</pre>
<p>Now, remember you need to manually sync your new Git repo to have the changes appear on Redmine. A better idea would be to create a cronjob that does this automatically. Especially with more than 1 repository, automating this process will save much time. Here&#8217;s the basic idea:</p>
<pre lang='cron' class='prettyprint'>
# Add the following to your crontab
*/30 * * * * cd /var/local/git_copies/foo-project.git &#038;&#038; git fetch origin &#038;&#038; git reset --soft refs/remotes/origin/master > /dev/null
</pre>
<p>Instead of doing many times in your crontab, maybe it would be easier to setup a bash script to run:</p>
<pre lang='cron' class='prettyprint'>
#!/bin/bash
# Not tested! Use at your own risk, and change your GIT_ROOT and "*.git" to fit your setup.
GIT_ROOT=/var/local/git_copies

cd $GIT_ROOT
ls *.git | while read repo; do
  cd $repo &#038;&#038; git fetch origin &#038;&#038; git reset --soft refs/remotes/origin/master > /dev/null &#038;&#038; cd $GIT_ROOT
done
</pre>
<p>Then, just add this one script to your crontab and have it run every N minutes as you desire!</p>
<p>This site is helpful and worth checking out as well:<br />
<a href="http://www.pragmatic-source.com/en/opensource/tips/automatic-synchronization-2-git-repositories">Reference on synchronizing 2 git repositories</a></p>
<p>That&#8217;s it, let me know how it goes!</p>
]]></content:encoded>
			<wfw:commentRss>http://qugstart.com/blog/ruby-and-rails/setup-a-git-repository-for-redmine/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Create a new Git Remote Repository from some local files (or local git repository)</title>
		<link>http://qugstart.com/blog/ruby-and-rails/create-a-new-git-remote-repository-from-some-local-files-or-local-git-repository/</link>
		<comments>http://qugstart.com/blog/ruby-and-rails/create-a-new-git-remote-repository-from-some-local-files-or-local-git-repository/#comments</comments>
		<pubDate>Wed, 21 Oct 2009 20:06:18 +0000</pubDate>
		<dc:creator>Qug</dc:creator>
				<category><![CDATA[Git and SVN]]></category>
		<category><![CDATA[Ruby and Rails]]></category>
		<category><![CDATA[Git]]></category>
		<category><![CDATA[local repository]]></category>
		<category><![CDATA[remote tracking]]></category>
		<category><![CDATA[setup]]></category>

		<guid isPermaLink="false">http://qugstart.com/blog/?p=30</guid>
		<description><![CDATA[So you have some files or a new Rails application, and you want to add this to a new shared remote Git repository. (I&#8217;m assuming you have access to your server and are setting up a remote repo over ssh.)
I know I can never remember how to do it, so here&#8217;s a post for me [...]]]></description>
			<content:encoded><![CDATA[<p>So you have some files or a new Rails application, and you want to add this to a new shared remote Git repository. (I&#8217;m assuming you have access to your server and are setting up a remote repo over ssh.)</p>
<p>I know I can never remember how to do it, so here&#8217;s a post for me and hopefully you!</p>
<p>Create a local Git repository in your application for your local files.</p>
<pre class="prettypring" lang="bash">#On local machine
cd foo_project
git init
git add *
git commit -m "My initial commit message"</pre>
<p>Now, create the repository on your Git server. All of my git repositories are owned by a user git and located at /usr/local/git_root/. You can change these things accordingly to match your server setup.</p>
<pre class="prettyprint" lang="bash">#On remote machine (Git remote repository)
sudo su - git
cd /usr/local/git_root/</pre>
<p>Create your new project git repo as a bare Git repository</p>
<pre class="prettyprint" lang="bash">mkdir foo-project.git
cd foo-project.git/
git --bare init</pre>
<p>Make sure permissions are set properly. These are common options I use for my shared repositories</p>
<pre class="prettyprint" lang="bash">git config core.sharedrepository 1
git config receive.denyNonFastforwards true
find objects -type d -exec chmod 02770 {} \;
#The core.sharedrepository flag tells git to keep everything group readable and writable.
#The receive.denyNonFastforwards flag makes sure that merges can't happen when you push to the repo. You have to do the merges on your local machine, and then push the result.</pre>
<p>Now, go back to your local repository, and add the newly created remote repository so it tracks from the remote repository (origin).</p>
<pre class="prettyprint" lang="bash">#On local machine, in your git project
git remote add origin ssh://git@example.com:2227/usr/local/git_root/foo_project.git
git push origin master</pre>
<p>Now, to ensure that your local branch is tracking when you do a fetch, you need to use -f option to force a new local branch to be created even though it already exists.</p>
<pre class="prettyprint" lang="bash">
#Switch to origin/master so you don't get any error about "fatal: Cannot force update the current branch."
git checkout origin/master
#Create the local "master" branch that is tracking the "origin/master" branch
git branch -f master origin/master
#Switch back to your "master" branch
git checkout master
</pre>
<p>There you have it. You should be able to push changes to origin and fetch changes to your local copy!</p>
]]></content:encoded>
			<wfw:commentRss>http://qugstart.com/blog/ruby-and-rails/create-a-new-git-remote-repository-from-some-local-files-or-local-git-repository/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Add colored git branch name to your shell prompt</title>
		<link>http://qugstart.com/blog/git-and-svn/add-colored-git-branch-name-to-your-shell-prompt/</link>
		<comments>http://qugstart.com/blog/git-and-svn/add-colored-git-branch-name-to-your-shell-prompt/#comments</comments>
		<pubDate>Mon, 19 Oct 2009 22:10:55 +0000</pubDate>
		<dc:creator>Qug</dc:creator>
				<category><![CDATA[Git and SVN]]></category>
		<category><![CDATA[branch]]></category>
		<category><![CDATA[Git]]></category>
		<category><![CDATA[prompt]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://qugstart.com/blog/?p=11</guid>
		<description><![CDATA[Here&#8217;s a little trick to get the name of your current git branch in your shell prompt. No more figuring out that you have made changes to the wrong branch once it&#8217;s too late! Your shell will not change for normal (non-git) folders. But, once you change directory into a git project, you will see [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a little trick to get the name of your current git branch in your shell prompt. No more figuring out that you have made changes to the wrong branch once it&#8217;s too late! Your shell will not change for normal (non-git) folders. But, once you change directory into a git project, you will see the branch name added to your shell prompt like such:</p>
<pre lang="bash" class="prettyprint">
Macintosh-2:git_project_foo andyuser [master] $
</pre>
<p>Simply add the following to your ~/.bash_profile or ~/.bashrc file:</p>
<pre lang="bash" class="prettyprint">
function parse_git_branch_and_add_brackets {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\ \[\1\]/'
}
PS1="\h:\W \u\[\033[0;32m\]\$(parse_git_branch_and_add_brackets) \[\033[0m\]\$ "
</pre>
<p>That&#8217;s all there is to it ! Try it out !</p>
]]></content:encoded>
			<wfw:commentRss>http://qugstart.com/blog/git-and-svn/add-colored-git-branch-name-to-your-shell-prompt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Resolve a hostname from an IP address in Ruby (Reverse-DNS)</title>
		<link>http://qugstart.com/blog/ruby-and-rails/resolve-a-hostname-from-an-ip-address-in-ruby-reverse-dns/</link>
		<comments>http://qugstart.com/blog/ruby-and-rails/resolve-a-hostname-from-an-ip-address-in-ruby-reverse-dns/#comments</comments>
		<pubDate>Fri, 09 Oct 2009 21:47:43 +0000</pubDate>
		<dc:creator>Qug</dc:creator>
				<category><![CDATA[Networking]]></category>
		<category><![CDATA[Ruby and Rails]]></category>
		<category><![CDATA[getaddrinfo]]></category>
		<category><![CDATA[host]]></category>
		<category><![CDATA[ip]]></category>
		<category><![CDATA[nslookup]]></category>
		<category><![CDATA[resolve]]></category>
		<category><![CDATA[reverse dns]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[socket]]></category>

		<guid isPermaLink="false">http://qugstart.com/blog/?p=10</guid>
		<description><![CDATA[It sounds easy, but I tried a lot of things before finding the solution I used.
I tried using:
`host 66.249.67.49` or
`nslookup 66.249.67.49`

These were fine, but it seems a bit hacky to use the shell. Also, it would require some sort of parsing to get the hostname that I want.
Browsing the web, I found a couple solutions [...]]]></description>
			<content:encoded><![CDATA[<p>It sounds easy, but I tried a lot of things before finding the solution I used.</p>
<p>I tried using:</p>
<pre lang="ruby" class="prettyprint">`host 66.249.67.49` or
`nslookup 66.249.67.49`
</pre>
<p>These were fine, but it seems a bit hacky to use the shell. Also, it would require some sort of parsing to get the hostname that I want.</p>
<p>Browsing the web, I found a couple solutions that almost worked.</p>
<pre lang="ruby" class="prettyprint">s = Socket.getaddrinfo('66.249.67.49',nil)
hostname = s[0][2]
</pre>
<p>This solution worked in IRB, worked in console, but for some reason would not work when I was running my mongrel server and trying to perform the exact same method call from a web-browser. ( I still don&#8217;t know why).</p>
<p>Digging around a bit more, I came up with this simple solution:</p>
<pre lang="ruby" class="prettyprint">host = Resolv.new.getname('66.249.67.49')
</pre>
<p>Is it really that easy?? Give it a shot and let me know your thoughts !!</p>
]]></content:encoded>
			<wfw:commentRss>http://qugstart.com/blog/ruby-and-rails/resolve-a-hostname-from-an-ip-address-in-ruby-reverse-dns/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>OpenOffice Headless Mode Installation Word doc to pdf conversion</title>
		<link>http://qugstart.com/blog/linux/openoffice-headless-mode-installation-word-doc-to-pdf-conversion/</link>
		<comments>http://qugstart.com/blog/linux/openoffice-headless-mode-installation-word-doc-to-pdf-conversion/#comments</comments>
		<pubDate>Thu, 17 Sep 2009 21:30:57 +0000</pubDate>
		<dc:creator>Qug</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[conversion]]></category>
		<category><![CDATA[headless]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[microsoft word to doc]]></category>
		<category><![CDATA[msword]]></category>
		<category><![CDATA[openoffice]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[soffice]]></category>

		<guid isPermaLink="false">http://qugstart.com/blog/?p=9</guid>
		<description><![CDATA[How to set up OpenOffice to run in headless mode on Fedora 9
What we wanted was a system set up to convert any OpenOffice document to PDF. Most importantly, we needed to convert Word .doc files to .pdf, but in fact, any OpenOffice file types (.xls, .odt, .txt, .rtf, etc) will work, as long as [...]]]></description>
			<content:encoded><![CDATA[<p>How to set up OpenOffice to run in headless mode on Fedora 9</p>
<p>What we wanted was a system set up to convert any OpenOffice document to PDF. Most importantly, we needed to convert Word .doc files to .pdf, but in fact, any OpenOffice file types (.xls, .odt, .txt, .rtf, etc) will work, as long as you install the proper packages / dependencies!</p>
<p>Also important:<br />
We will be starting OpenOffice in headless mode, which means no GUI. This should be started on boot up, and should just run in the background.</p>
<p>Install:<br />
You don&#8217;t need to install all the OpenOffice packages if you don&#8217;t need them. We are mainly concerned with Word docs, so OoWriter is a must. We are running in headless mode, which means we don&#8217;t have a GUI to openoffice. So we can leave out a bunch of unnecessary packages.</p>
<p>- Here&#8217;s what we have installed:</p>
<pre lang="bash" class="prettyprint">
openoffice.org-core.x86_64  1:2.4.2-18.3.fc9 installed
openoffice.org-headless.x86_64 1:2.4.2-18.3.fc9 installed
openoffice.org-pyuno.x86_64 1:2.4.2-18.3.fc9 installed
openoffice.org-sdk.x86_64 1:2.4.2-18.3.fc9 installed
openoffice.org-writer.x86_64 1:2.4.2-18.3.fc9 installed
openoffice.org-writer2latex.x86_64 0.5-2.fc9 installed
</pre>
<p>If you need to convert Excel spreadsheets, ppt Powerpoint presentations to pdf, you will need to install the corresponding package (ie. openoffice.org-calc, openoffice.org-draw, etc.)</p>
<p>After you have these packages installed, be sure you have the soffice command. By default it is here:<br />
/usr/lib64/<a href="http://openoffice.org/program/soffice.bin" target="_blank">openoffice.org/program/soffice.bin</a></p>
<p>Next, try to start up the service with this command:</p>
<pre lang="bash" class="prettyprint">
$ /usr/lib64/openoffice.org/program/soffice.bin -headless accept="socket,host=localhost,port=8100;urp;" -nofirststartwizard &amp;
</pre>
<p>#Note: the ampersand (&amp;) allows the command to run in background so you get your shell back.<br />
You can specify whichever port you would like. The -nofirststartwizard flag does exactly that.</p>
<p>Next step is to find a script (client) that can interact with this OpenOffice service.<br />
A few options are:<br />
1. dag&#8217;s unoconv (Available from yum)<br />
<a href="http://dag.wieers.com/home-made/unoconv/" target="_blank">http://dag.wieers.com/home-made/unoconv/</a><br />
2. PyODConverter &#8211; a cool Python script to do conversions<br />
<a href="http://www.artofsolving.com/opensource/pyodconverter" target="_blank">http://www.artofsolving.com/opensource/pyodconverter</a><br />
3. Write your own!</p>
<p>We chose to use PyODConverter. It&#8217;s simple to use:</p>
<pre lang="bash" class="prettyprint">
$ PyODConverter.py example.doc example.pdf
</pre>
<p>Lastly, I mentioned that we want this soffice to start up everytime we reboot.</p>
<p>Simply add the line to your /etc/rc.d/rc.local</p>
<pre lang="bash" class="prettyprint">
# Start up openoffice for fax conversion
$ /usr/lib64/openoffice.org/program/soffice.bin -headless accept="socket,host=localhost,port=8100;urp;" -nofirststartwizard
</pre>
<p>And there you have it. Hope that helps somebody. Happy Conversions!</p>
<p>Hint: If you are getting strange unintelligible errors about &#8220;URL seems to be an unsupported one&#8221;, it may be that you have not installed a necessary openoffice package. That&#8217;s how I discovered I needed OoWriter &#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://qugstart.com/blog/linux/openoffice-headless-mode-installation-word-doc-to-pdf-conversion/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Migrate an SVN repository to Git While Maintaining Branches and Tags Structure</title>
		<link>http://qugstart.com/blog/git-and-svn/migrate-an-svn-repository-to-git-while-maintaining-branches-and-tags-structure/</link>
		<comments>http://qugstart.com/blog/git-and-svn/migrate-an-svn-repository-to-git-while-maintaining-branches-and-tags-structure/#comments</comments>
		<pubDate>Fri, 04 Sep 2009 01:02:32 +0000</pubDate>
		<dc:creator>Qug</dc:creator>
				<category><![CDATA[Git and SVN]]></category>
		<category><![CDATA[branches]]></category>
		<category><![CDATA[Git]]></category>
		<category><![CDATA[migrate]]></category>
		<category><![CDATA[repository]]></category>
		<category><![CDATA[SVN]]></category>
		<category><![CDATA[tags]]></category>
		<category><![CDATA[trunk]]></category>

		<guid isPermaLink="false">http://qugstart.com/blog/?p=8</guid>
		<description><![CDATA[Git is awesome, but for our Rails projects, we like to follow a similar &#8220;centralized repository model&#8221; that SVN makes use of.
We want to use distributed Git repositories, with one central &#8220;shared&#8221; repository to use for deployments, etc.
We don&#8217;t want to use Git with a shared SVN repository. (git-svn)
And, we have a bunch of SVN [...]]]></description>
			<content:encoded><![CDATA[<p>Git is awesome, but for our Rails projects, we like to follow a similar &#8220;centralized repository model&#8221; that SVN makes use of.<br />
We want to use distributed Git repositories, with one central &#8220;shared&#8221; repository to use for deployments, etc.<br />
We don&#8217;t want to use Git with a shared SVN repository. (git-svn)<br />
And, we have a bunch of SVN repositories already that we need to migrate to Git repositories.</p>
<p>I&#8217;ll describe what I did to make this happen:</p>
<p>Notes, quotes, credits all from: <a href="http://notahat.com/posts/25">http://notahat.com/posts/25</a></p>
<p>This is a great post to follow, and accounts for most everything I did here.<br />
The difference is that I&#8217;m using svn2git, instead of doing manual git clone commands.<br />
The above post will only set up remote branches, and what I wanted was to have all branches and tags local to my new Git repository.<br />
Svn2git will copy all of your branches / tags from the original SVN repository into your new Git repository as well.<br />
(Check it out here [thanks to nirvdrum]: <a href="http://github.com/nirvdrum/svn2git/tree/master">http://github.com/nirvdrum/svn2git/tree/master</a>)</p>
<p>Let&#8217;s say I have an SVN repository structured as:</p>
<pre lang="bash" class="prettyprint">trunk
...
branches
1.x
2.x
tags
1.0.0
1.0.1
1.0.2
1.1.0
2.0.0</pre>
<p>Our goal is to have a git repository with native tags/branches taken from our SVN repository.<br />
At the end of my migration, I want my Git repo to look like:</p>
<pre lang="bash"  class="prettyprint">$ git branch
* master
1.x
2.x
$ git tag -l
1.0.0
1.0.1
1.0.2
1.1.0
2.0.0</pre>
<p>#Make sure Git is installed:<br />
#If you don&#8217;t have the epel yum repository enabled by default, you must specify to enable it at the command line:<br />
#For other distributions, you know the drill (apt-get, port, etc.)</p>
<pre lang="bash" class="prettyprint">yum --enablerepo epel install 'git'
yum --enablerepo epel install 'git-svn'</pre>
<p>#Now, create a system git user and group</p>
<pre lang="bash" class="prettyprint">sudo adduser git</pre>
<p>#Now edit /etc/group, and add any users who&#8217;ll need to access the Git repository to the git group:</p>
<pre lang="bash" class="prettyprint">...
git:x:100:james,paul
...</pre>
<p>#Make a directory for Git repositories<br />
#We chose: /usr/local/git_root</p>
<pre lang="bash" class="prettyprint">sudo mkdir /usr/local/git_root
sudo chown git.git /usr/local/git_root
sudo chmod 2770 /usr/local/git_root</pre>
<p>#Create your svn-authors.txt in /usr/local/git_root/svn-authors.txt to tell Git how to convert SVN usernames in the logs:<br />
#Place *ALL* SVN authors in this file so that git doesn&#8217;t complain when it cannot find a particular user to convert.</p>
<p>pbunyan = Paul Bunyan &lt;pbunyan@example.com&gt;<br />
jbond = James Bond &lt;jbond@example.com&gt;</p>
<p>On the left are the Subversion user names; on the right are the Git equivalents.</p>
<p>#Make sure your gem sources include github.com (if necessary)</p>
<pre lang="bash" class="prettyprint">sudo gem sources -a http://gems.github.com</pre>
<p>#Install the svn2git gem</p>
<pre lang="bash" class="prettyprint">sudo gem install nirvdrum-svn2git</pre>
<p>#Verify that you have svn2git in your PATH</p>
<pre lang="bash" class="prettyprint">which svn2git</pre>
<p>#We will create a temporary directory in /tmp/<br />
#This is where we will fetch the SVN repo into a git repo.<br />
#We&#8217;ll then use this temporary repo to create our bare repository.</p>
<pre lang="bash" class="prettyprint">mkdir /tmp/foo-project
cd /tmp/foo-project</pre>
<p>#I&#8217;m assuming you have the standard SVN setup of</p>
<pre lang="bash" class="prettyprint">-root
---trunk
---branches
---tags</pre>
<p>If not, you can look into the options of svn2git to match your SVN repo structure.</p>
<p>#Run the command given your svn-authors file:</p>
<pre lang="bash" class="prettyprint">svn2git https://svn-repo/foo-project --authors /usr/local/git_root/svn-authors.txt</pre>
<p>#You can go into this folder and verify that you see all your local branches and tags by running:</p>
<pre lang="bash" class="prettyprint">git branch
and
git tag -l</pre>
<p>This should print out the lists of your branches and tags if everything is working right so far!</p>
<p>Next, we want to create our bare repository in /usr/local/git_root.</p>
<p>#Become git user and set permissions</p>
<pre lang="bash" class="prettyprint">sudo su - git
cd /usr/local/git_root/
umask 007</pre>
<p>#Clone the temporary repository created by svn2git to a bare repository.<br />
#&lt;project&gt;.git is a local convention.</p>
<pre lang="bash" class="prettyprint">git clone --bare /tmp/foo-project foo-project.git
cd foo-project.git/</pre>
<p>#Make sure permissions are set properly</p>
<pre lang="bash" class="prettyprint">git config core.sharedrepository 1
git config receive.denyNonFastforwards true
find objects -type d -exec chmod 02770 {} \;</pre>
<p>The core.sharedrepository flag tells git to keep everything group readable and writable.<br />
The receive.denyNonFastforwards flag makes sure that merges can&#8217;t happen when you push to the repo. You have to do the merges on your local machine, and then push the result.</p>
<p>#Try to do a git clone from your workstation (another computer)</p>
<pre lang="bash" class="prettyprint">git clone ssh://git-repo:22/usr/local/git_root/foo-project.git</pre>
<p>#Clean up<br />
Once you&#8217;re happy that everything is working, delete the temporary repo that you created in /tmp, and you&#8217;re done!</p>
]]></content:encoded>
			<wfw:commentRss>http://qugstart.com/blog/git-and-svn/migrate-an-svn-repository-to-git-while-maintaining-branches-and-tags-structure/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
