<?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>Server Cobra</title>
	<atom:link href="http://www.servercobra.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.servercobra.com</link>
	<description>Ubuntu, Servers, Python, and Django</description>
	<lastBuildDate>Sun, 29 Apr 2012 06:49:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Automated Load Balancing with Amazon EC2 and RightScale</title>
		<link>http://www.servercobra.com/automated-load-balancing-with-amazon-ec2-and-rightscale/</link>
		<comments>http://www.servercobra.com/automated-load-balancing-with-amazon-ec2-and-rightscale/#comments</comments>
		<pubDate>Sun, 29 Apr 2012 06:49:25 +0000</pubDate>
		<dc:creator>Josh Gachnang</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[BASH]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[EC2]]></category>
		<category><![CDATA[RightScale]]></category>

		<guid isPermaLink="false">http://www.servercobra.com/?p=877</guid>
		<description><![CDATA[<p>If you have a scalable infrastructure on Amazon, you are probably using Elastic Load Balancers on Amazon&#8217;s AWS to manage mulitple EC2 instances. Scaling by hand is soooooo last decade! We have added 3 scripts to our servers to allow them to add themselves and remove themselves our load balancer. These machines are usually web [...]]]></description>
			<content:encoded><![CDATA[<p>If you have a scalable infrastructure on Amazon, you are probably using Elastic Load Balancers on Amazon&#8217;s AWS to manage mulitple EC2 instances. Scaling by hand is soooooo last decade! We have added 3 scripts to our servers to allow them to add themselves and remove themselves our load balancer. These machines are usually web servers or other application servers. You can use RightScale to manage the expansion with auto scaling, or you can have a custom server monitoring your cluster&#8217;s load. With these boot and decommission scripts, the servers will automatically add and take themselves out of the cluster when they are told to start/stop.<span id="more-877"></span></p>
<p>The first Rightscript installs the Amazon EC2 API tools and passes all your credentials into the AMI through RightScale&#8217;s platform. You can fill in the inputs on a server by simply selecting the drop down next to them, selecting &#8220;Cred&#8221; and then changing the next drop down to match the label for that input. For example, match &#8220;AWS_ACCESS_KEY_ID&#8221; with &#8220;AWS_ACCESS_KEY_ID&#8221;. This script was originally from the RightScale documentation. This script should be assigned as a boot script to your server template as the 2nd to last script (with the ELB Registration script as the last).</p>
<pre class="brush: bash; title: ; notranslate">
#!/bin/bash
# installs ec2inst script that allows running ec2commands from the shell

echo &quot;$AWS_X509_CERT&quot; &gt; /root/cert.pem
echo &quot;$AWS_X509_KEY&quot; &gt; /root/key.pem

echo 'export AWS_ACCESS_KEY_ID='$AWS_ACCESS_KEY_ID &gt; /root/ec2inst
echo 'export AWS_SECRET_ACCESS_KEY='$AWS_SECRET_ACCESS_KEY &gt;&gt; /root/ec2inst
echo 'export AWS_ACCOUNT_NUMBER='$AWS_ACCOUNT_NUMBER &gt;&gt; /root/ec2inst
echo 'export EC2_CERT=/root/cert.pem' &gt;&gt; /root/ec2inst
echo 'export EC2_PRIVATE_KEY=/root/key.pem' &gt;&gt; /root/ec2inst
echo 'export EC2_HOME=/root/ec2' &gt;&gt; /root/ec2inst
echo 'export JAVA_HOME=/usr/java/default' &gt;&gt; /root/ec2inst

chmod 700 /root/ec2inst

cd /root
wget http://s3.amazonaws.com/ec2-downloads/ec2-api-tools.zip
unzip ec2-api-tools.zip
chmod +x ec2-api-tools-1.3-46266/bin/*
ln -s ec2-api-tools-1.3-46266 ec2
</pre>
<p>The next script should be assigned as a boot script for your server template as the last script. It need to have the previous script run before it can run. It installs the AWS ELB API tools, saves the pertinent data to files for the decommission script, and then notifies the ELB there is a new instance available. Its sole input is the name of the Elastic Load Balancer you want it assigned to.</p>
<pre class="brush: bash; title: ; notranslate">
#!/bin/bash
echo &quot;Beginning ELB Registration for load balancer $LOAD_BALANCER.&quot;
source /root/ec2inst
export EC2_INSTANCE_ID=&quot;$( wget -q -O - http://169.254.169.254/latest/meta-data/instance-id )&quot;

wget -O /root/ElasticLoadBalancing.zip http://ec2-downloads.s3.amazonaws.com/ElasticLoadBalancing.zip
unzip -o /root/ElasticLoadBalancing.zip -d /root
export AWS_ELB_HOME=~/ElasticLoadBalancing-1.0.15.1
echo 'export EC2_INSTANCE_ID='$EC2_INSTANCE_ID &gt; /root/ec2elb
echo 'export AWS_ELB_HOME='$AWS_ELB_HOME &gt;&gt; /root/ec2elb

$AWS_ELB_HOME/bin/elb-register-instances-with-lb $LOAD_BALANCER --instances $EC2_INSTANCE_ID
echo &quot;ELB Registration for load balancer $LOAD_BALANCER finished with exit code $?&quot;
</pre>
<p>The final script should be added as one of the first decommission scripts in your server template. It will notify the load balancer to stop sending requests to this instance. Its sole input is the name of the Elastic Load Balancer you want it assigned to.</p>
<pre class="brush: bash; title: ; notranslate">
#!/bin/bash
echo &quot;Starting ELB Deregistering.&quot;
source /root/ec2inst
source /root/ec2elb

$AWS_ELB_HOME/bin/elb-deregister-instances-from-lb $LOAD_BALANCER --instance $EC2_INSTANCE_ID
echo &quot;ELB Deregistration finished with exit code $?&quot;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.servercobra.com/automated-load-balancing-with-amazon-ec2-and-rightscale/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Dictionary-Based Logging Outside Django</title>
		<link>http://www.servercobra.com/using-dictionary-based-logging-outside-django/</link>
		<comments>http://www.servercobra.com/using-dictionary-based-logging-outside-django/#comments</comments>
		<pubDate>Thu, 26 Apr 2012 19:40:05 +0000</pubDate>
		<dc:creator>Josh Gachnang</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[Django]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.servercobra.com/?p=867</guid>
		<description><![CDATA[<p>If you haven&#8217;t checked out Django&#8217;s logging facilities, do check them out. They are invaluable! One place the Django test server fails at is passing print statements to the console. Most production servers aren&#8217;t going to make print output available (or readily available), and too much debugging code relies on print statements, instead of logging. [...]]]></description>
			<content:encoded><![CDATA[<p>If you haven&#8217;t checked out <a href="https://docs.djangoproject.com/en/dev/topics/logging/">Django&#8217;s logging facilities</a>, do check them out. They are invaluable! One place the Django test server fails at is passing print statements to the console. Most production servers aren&#8217;t going to make print output available (or readily available), and too much debugging code relies on print statements, instead of logging. You can get the same effect as a print statement, along with logging to a file, pretty easily.<span id="more-867"></span></p>
<p>However, when you&#8217;re writing code outside of Django, or code that is portable outside of Django (like some of my utility scripts), you need these same abilities without the Django settings file. DictConfig allows you to use Django-style logging, outside Django, but it was only introduced in Python 2.7. Many servers are still on Python 2.6. Luckily, you can just drop one extra file into your directory, and you&#8217;re good to go!</p>
<p>First, <a href="https://bitbucket.org/vinay.sajip/dictconfig/src/53b3c32dea46/src/dictconfig.py">download dictconfig.py</a>. Put it into your project directory or somewhere on your path.</p>
<p>Next, we&#8217;ll configure a logger. We&#8217;re going to have it capture all message levels, and log them to both the console and a file in our directory. This is the best combination and makes migrating to a production server much easier.</p>
<pre class="brush: python; title: ; notranslate">
import os
import logging
import dictconfig

# PROJECT_ROOT is the folder you'll be logging to.
PROJECT_ROOT='/home/josh/programming/project/'

LOGGING = {
    'version': 1,
    'disable_existing_loggers': True,
    'formatters': {
        'verbose': {
            'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
        },
        'simple': {
            'format': '%(levelname)s %(message)s'
        },
    },
    'handlers': {

        'file_log': {                 # define and name a second handler
            'level': 'DEBUG',
            'class': 'logging.FileHandler', # set the logging class to log to a file
            'formatter': 'verbose',         # define the formatter to associate
            'filename': os.path.join(PROJECT_ROOT, 'output.log')  # log file
        },
        'console':{
            'level':'DEBUG',
            'class':'logging.StreamHandler',
            'formatter': 'simple'
        },
    },
    'loggers': {
        'logger': {               # define another logger
            'handlers': ['file_log', 'console'],  # associate a different handler
            'level': 'DEBUG',                 # specify the logging level
            'propagate': True,
        },
    }
}

dictconfig.dictConfig(LOGGING)
</pre>
<p>Now when we want to log something, instead of &#8220;print &#8216;Fire, exclamation mark. Fire, exclamation mark. Help me, exclamation mark.&#8217;&#8221;, we just do:</p>
<pre class="brush: python; title: ; notranslate">
logging.critical('Fire, exclamation mark. Fire, exclamation mark. Help me, exclamation mark.')
logging.error('Fire, exclamation mark. Fire, exclamation mark. Help me, exclamation mark.')
logging.warning('Fire, exclamation mark. Fire, exclamation mark. Help me, exclamation mark.')
logging.info('Fire, exclamation mark. Fire, exclamation mark. Help me, exclamation mark.')
logging.debug('Fire, exclamation mark. Fire, exclamation mark. Help me, exclamation mark.')
# Only within an exception handler:
logging.exception('Fire, exclamation mark. Fire, exclamation mark. Help me, exclamation mark.')
</pre>
<p>There you go! Logging is easy!<br />
Note: The Fire quote is from The IT Crowd, a hilarious TV show that you should definitely check out. It is on Netflix!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.servercobra.com/using-dictionary-based-logging-outside-django/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>3D Apps for Tablets</title>
		<link>http://www.servercobra.com/3d-apps-for-tablet/</link>
		<comments>http://www.servercobra.com/3d-apps-for-tablet/#comments</comments>
		<pubDate>Thu, 05 Apr 2012 17:11:53 +0000</pubDate>
		<dc:creator>GuestPost</dc:creator>
				<category><![CDATA[Articles]]></category>

		<guid isPermaLink="false">http://www.servercobra.com/?p=850</guid>
		<description><![CDATA[<p>With larger screens and more powerful graphics processors, tablet computers have taken the industry by storm. No longer is Apple the only contender. Manufacturers have stepped up, creating multiple Android tablets, even apps with BlackBerry have entered the market with its Playbook tablet. The advances in technology enables tablets to display even high-definition 3D graphics [...]]]></description>
			<content:encoded><![CDATA[<p>With larger screens and more powerful graphics processors, tablet computers have taken the industry by storm. No longer is Apple the only contender. Manufacturers have stepped up, creating multiple Android tablets, even <a href="http://us.blackberry.com/apps-software/appworld/">apps with BlackBerry</a> have entered the market with its Playbook tablet. The <a href="http://developer.android.com/sdk/android-3.0-highlights.html#graphics">advances in technology</a> enables tablets to display even high-definition 3D graphics without lagging. Software developers are eager to take advantage of this new market with some cool apps.<span id="more-850"></span><br />
For instance, WMB 3D is a digital magazine that is photographed and designed in 3D. It features 3D images of nature, women and cars. All the galleries are in three dimensions, as is the WMB 3D store. This application is available for free on the Android market for compatible 3D devices.</p>
<p>Some of the BlackBerry apps that are available in 3D include Need for Speed Shift 3D. This mobile version of the racing game uses dynamic camera angles to make the viewer appear as though he is actually racing the car. Eight different vehicles are available for driving, and the user can participate in challenges in Chicago London, Italy and Dubai, for a varied experience. This app is available for $5 from BlackBerry App World.</p>
<p>Not to be outdone, developers have released 3D games for the Android platform. Larger tablet screens enable users to control even small on-screen objects with finesse. Dungeon Defenders: Second Wave has been rated over 18,000 times, making it one of the popular games on the Android Market. With its epic plot line, this action/RPG game allows the player to participate in campaigns solo or with up to three friends.</p>
<p>Apple&#8217;s iPad offers several 3D apps as well. For example, iGlass is a game that will distract the user for hours. It allows the user to virtually blow molten glass with the tablet&#8217;s touch screen. At the end of the simulation, the user can rotate the glass creation to view it from every angle and even take screenshots to display the creation. Another similar app is iDough, a sculpting virtualization to create 3D sculptures. Hobbyists can play with a new medium, without all the mess, while professionals can hone their skills at any time.</p>
<p>Finally, 3D wallpapers are among the newest trends on mobile devices. Deep space vistas such as the one offered by Starfield 3D Live Wallpaper display in 3D, and the user can touch the screen to move through the stars.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.servercobra.com/3d-apps-for-tablet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bash: Check Username of User Running Script</title>
		<link>http://www.servercobra.com/bash-check-username-of-user-running-script/</link>
		<comments>http://www.servercobra.com/bash-check-username-of-user-running-script/#comments</comments>
		<pubDate>Thu, 05 Apr 2012 00:30:07 +0000</pubDate>
		<dc:creator>Josh Gachnang</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[BASH]]></category>

		<guid isPermaLink="false">http://www.servercobra.com/?p=791</guid>
		<description><![CDATA[<p>If you need to ensure that a certain user is running a script (be it root or a service account user) in Bash, this code block will be very helpful.<span id="more-791"></span></p>
<p>
<p>View the code on Gist.</p>
<p></p>
]]></description>
			<content:encoded><![CDATA[<p>If you need to ensure that a certain user is running a script (be it root or a service account user) in Bash, this code block will be very helpful.<span id="more-791"></span></p>
<p><script src="https://gist.github.com/2306795.js"></script><noscript>
<p>View the code on <a href="https://gist.github.com/2306795">Gist</a>.</p>
<p></noscript></p>
]]></content:encoded>
			<wfw:commentRss>http://www.servercobra.com/bash-check-username-of-user-running-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python: Random Alphanumeric String</title>
		<link>http://www.servercobra.com/python-random-alphanumeric-string/</link>
		<comments>http://www.servercobra.com/python-random-alphanumeric-string/#comments</comments>
		<pubDate>Wed, 04 Apr 2012 20:47:37 +0000</pubDate>
		<dc:creator>Josh Gachnang</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.servercobra.com/?p=785</guid>
		<description><![CDATA[<p>I find I need to generate a random alphanumeric string quite often, whether for a password, username, or even file names. This handy function takes a length argument for how many characters you want. If you put in less than 1, it will simply return an empty string.
<span id="more-785"></span></p>
<p>
<p>View the code on Gist.</p>
<p></p>
]]></description>
			<content:encoded><![CDATA[<p>I find I need to generate a random alphanumeric string quite often, whether for a password, username, or even file names. This handy function takes a length argument for how many characters you want. If you put in less than 1, it will simply return an empty string.<br />
<span id="more-785"></span></p>
<p><script src="https://gist.github.com/2305367.js"></script><noscript>
<p>View the code on <a href="https://gist.github.com/2305367">Gist</a>.</p>
<p></noscript></p>
]]></content:encoded>
			<wfw:commentRss>http://www.servercobra.com/python-random-alphanumeric-string/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reset MySQL Password on Ubuntu Server 10.04</title>
		<link>http://www.servercobra.com/reset-mysql-password-on-ubuntu-server-10-04/</link>
		<comments>http://www.servercobra.com/reset-mysql-password-on-ubuntu-server-10-04/#comments</comments>
		<pubDate>Sun, 25 Mar 2012 04:23:56 +0000</pubDate>
		<dc:creator>Josh Gachnang</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.servercobra.com/?p=776</guid>
		<description><![CDATA[<p>Sometimes, shit happens. If you&#8217;re reading this, it probably just happened. Either you forgot your password or somehow you set it to something else through a script, or something else equally terrible happened. Regardless, you need to reset your password. <span id="more-776"></span>First, you should probably make a backup of your data in case something goes [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes, shit happens. If you&#8217;re reading this, it probably just happened. Either you forgot your password or somehow you set it to something else through a script, or something else equally terrible happened. Regardless, you need to reset your password. <span id="more-776"></span>First, you should probably make a backup of your data in case something goes horribly wrong. This should work on almost any version of Ubuntu (or other versions of Linux), but it is tested on Ubuntu 10.04 with mysql-server 5.1.</p>
<p>First, we need to shut down MySQL. This is going to bring all your database-driven sites down (though caching may save you). Then we will restart it, while ignoring the permissions table.</p>
<pre class="brush: bash; title: ; notranslate">
sudo stop mysql
sudo mysqld --skip-grant-tables &amp;
# Note the PID that is printed out, such as &quot;[1] 14053&quot;, where &quot;14053&quot; is the PID.
</pre>
<p>Now we log in with no password, and reset the password.</p>
<pre class="brush: bash; title: ; notranslate">
mysql -u root
UPDATE user SET Password=PASSWORD('YOURNEWPASSWORD') WHERE User='root'; FLUSH PRIVILEGES; exit;
</pre>
<p>The password is reset! Now we need to kill off the passwordless instance, and restart a normal MySQL server.</p>
<pre class="brush: bash; title: ; notranslate">
# PID is the number from before, probably 4 or 5 digits
sudo kill PID
sudo start mysql
</pre>
<p>Now make sure you can log in!</p>
<pre class="brush: bash; title: ; notranslate">
mysql -u root -p YOURNEWPASSWORD
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.servercobra.com/reset-mysql-password-on-ubuntu-server-10-04/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FreeNAS to Ubuntu: Torrent Server (Transmission)</title>
		<link>http://www.servercobra.com/freenas-to-ubuntu-torrent-server-transmission/</link>
		<comments>http://www.servercobra.com/freenas-to-ubuntu-torrent-server-transmission/#comments</comments>
		<pubDate>Sun, 12 Feb 2012 19:27:46 +0000</pubDate>
		<dc:creator>Josh Gachnang</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[FreeNAS]]></category>
		<category><![CDATA[FreeNAS to Ubuntu]]></category>
		<category><![CDATA[Torrent]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.servercobra.com/?p=748</guid>
		<description><![CDATA[<p>If you&#8217;re coming from FreeNAS 7 to Ubuntu, you remember the very handy torrent server that was built in. Well we can exactly replicate that with Transmission&#8217;s and its WebGUI. A torrent server provides you a great way to download torrents directly to your server. It also allows you to constantly seed torrents, even when [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re coming from FreeNAS 7 to Ubuntu, you remember the very handy torrent server that was built in. Well we can exactly replicate that with Transmission&#8217;s and its WebGUI. A torrent server provides you a great way to download torrents directly to your server. It also allows you to constantly seed torrents, even when your main computers are off. I use this to host copies of OS&#8217;s (such as Ubuntu!) so other people can download them faster.<span id="more-748"></span></p>
<p><strong>Note: </strong>This is an article in the series <a title="FreeNAS to Ubuntu" href="http://www.servercobra.com/tag/freenas-to-ubuntu/">FreeNAS to Ubuntu</a>. Check out the article for the <a title="Replacing FreeNAS with Ubuntu File Server" href="http://www.servercobra.com/replacing-freenas-with-ubuntu-file-server/">initial Ubuntu fileserver setup coming from FreeNAS</a>.</p>
<p>First we need to install Transmission.</p>
<pre class="brush: bash; title: ; notranslate">
sudo apt-get install -y transmission-daemon
</pre>
<p>Transmission&#8217;s settings are saved in a JSON file. We&#8217;ll edit that to update the settings appropriately. We&#8217;re going to enable the remote interface, allow all computers connect to it, change the password (which will be encrypted when we reload the settings), and change the download-dir and incomplete-dir. First, let&#8217;s stop transmission. For some reason, it occasionally overwrites the settings when restarting. </p>
<pre class="brush: bash; title: ; notranslate">
sudo service transmission-daemon stop
sudo nano /var/lib/transmission-daemon/info/settings.json
----
# Change:
# &quot;rpc-enabled&quot;: false,
&quot;rpc-enabled&quot;: true,

# &quot;rpc-password&quot;: &quot;$kljfkljwerjwauiouak438908&quot;,
&quot;rpc-password&quot;: &quot;plaintext-new-password&quot;,

# &quot;rpc-whitelist-enabled&quot;: true,
&quot;rpc-whitelist-enabled&quot;: false,

# &quot;download-dir&quot;: &quot;&quot;,
&quot;download-dir&quot;: &quot;/mnt/storage/Torrents/&quot;,
# &quot;incomplete-dir-enabled&quot;: false,
&quot;incomplete-dir-enabled&quot;: true,
# &quot;incomplete-dir&quot;: &quot;&quot;,
&quot;incomplete-dir&quot;: &quot;/mnt/storage/Torrents/incomplete&quot;,
</pre>
<p>Now we need to create the appropriate directories, and give them proper permissions. We are going to own the directory to the Transmission user and group (debian-transmission), give that user:group full permissions, and then give read permissions to the world (the rest of the users). You could alternately add yourself to the to the debian-transmission group, so that you have write and execute permissions, but for this tutorial, we&#8217;re going to share it out via Samba, so read is all we&#8217;ll need. </p>
<pre class="brush: bash; title: ; notranslate">
mkdir -p /mnt/storage/Torrents/incomplete/

chown -R debian-transmission:debian-transmission /mnt/storage/Torrents/
chmod -R 774 /mnt/storage/Torrents/
</pre>
<p>Now that everything is ready, we need to restart the server to encrypt the password and reload the settings.</p>
<pre class="brush: bash; title: ; notranslate">
sudo service transmission-daemon start
</pre>
<p>Now you should be able to connect to your server by visiting &#8220;hostname:9091&#8243;. You can set up port forwarding on your router so you can connect when you&#8217;re away from home, by forwarding a port to your server&#8217;s IP and port 9091. This port can be changed in the transmission config file. The setting is called &#8220;&#8221;rpc-port&#8221;: 9091,&#8221;. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.servercobra.com/freenas-to-ubuntu-torrent-server-transmission/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Bash Alias for Python/Virtualenv</title>
		<link>http://www.servercobra.com/bash-alias-for-pythonvirtualenv/</link>
		<comments>http://www.servercobra.com/bash-alias-for-pythonvirtualenv/#comments</comments>
		<pubDate>Sat, 21 Jan 2012 19:10:18 +0000</pubDate>
		<dc:creator>Josh Gachnang</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[BASH]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.servercobra.com/?p=738</guid>
		<description><![CDATA[<p>If you are writing Python apps, you should definitely be using virtualenv. It creates an isolated virtual environment (hence the name), where you can install Python apps without affecting the rest of the apps on your machine. For example, if I have a website that relies on Django 1.2, and other sites that rely on [...]]]></description>
			<content:encoded><![CDATA[<p>If you are writing Python apps, you should definitely be using virtualenv. It creates an isolated virtual environment (hence the name), where you can install Python apps without affecting the rest of the apps on your machine. For example, if I have a website that relies on Django 1.2, and other sites that rely on Django 1.3, I can put them in virtualenvs and just install the correct package versions in each. This can also be applied to running different Python versions per project as well, such as 2.5 for one and 3.0 in another. Yet another great use of virtualenvs is testing your code in multiple version of Python.<span id="more-738"></span></p>
<p>Sold yet? Good! The only thing I find tedious about virtualenvs is constantly typing long commands to activate a virtualenv. The common command is:</p>
<pre class="brush: bash; title: ; notranslate">
source ~/programming/project/bin/activate
</pre>
<p>That&#8217;s more than I want to type each time. So let&#8217;s make it an alias! Simply replace PROJECT with the name of your project. Note: This assumes you place all your projects in your home directory under a directory called &#8220;programming&#8221;. Modify that to meet your needs.</p>
<pre class="brush: bash; title: ; notranslate">
echo 'alias PROJECT=&quot;source $HOME/programming/PROJECT/bin/activate&quot; ' &gt;&gt; ~/.bash_aliases

# Or if you want to also move to the directory:
echo 'alias PROJECT=&quot;source ~/programming/PROJECT/bin/activate; cd ~/programming/PROJECT&quot; ' &gt;&gt; ~/.bash_aliases

bash
</pre>
<p>Well that&#8217;s pretty cool. Now you just type whatever your project name is, and the alias will activate the virtualenv so you can get to work. If you use the second option, it will also move you into the project directory. What if you have 30+ Python projects, like me? Do you really want to write an alias for each one, and create a new one each time you make a new project? I don&#8217;t, so I&#8217;ll write a simple function to take care of it. Put this in your ~/.bash_aliases (or the bottom of ~/.bashrc if you really want).</p>
<pre class="brush: bash; title: ; notranslate">
# Python virtualenv
SRC_DIRECTORY=&quot;$HOME/programming&quot;
venv () {
        source $SRC_DIRECTORY/$1/bin/activate;
        cd $SRC_DIRECTORY/$1;

# Then run &quot;bash&quot; again to reload the file, and you're done!
}
</pre>
<p>To run it, simply type &#8220;venv PROJECT&#8221; into bash. It will activate the environment and move you to the project directory. You can change SRC_DIRECTORY to whatever you want.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.servercobra.com/bash-alias-for-pythonvirtualenv/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Minecraft 1.0 Ubuntu Installation</title>
		<link>http://www.servercobra.com/minecraft-1-0-ubuntu-installation/</link>
		<comments>http://www.servercobra.com/minecraft-1-0-ubuntu-installation/#comments</comments>
		<pubDate>Fri, 18 Nov 2011 23:50:01 +0000</pubDate>
		<dc:creator>Josh Gachnang</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[Minecraft]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.servercobra.com/?p=719</guid>
		<description><![CDATA[<p>The full version of Minecraft 1.0.0 was finally released today! You can just updated your client, or install from scratch here. <span id="more-719"></span></p>

Client
Server

<p>Ubuntu Client Installation:</p>
<p>If you don&#8217;t already have Minecraft installed, check this Minecraft Installation tutorial.</p>

# Backup your old client, just in case
mv ~/.minecraft/bin/minecraft.jar ~/.minecraft/bin/minecraft.jar.bak
# Download the new one
cd ~/.minecraft/bin; wget https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft.jar
# And play like [...]]]></description>
			<content:encoded><![CDATA[<p>The full version of Minecraft 1.0.0 was finally released today! You can just updated your client, or install from scratch here. <span id="more-719"></span></p>
<ul>
<li><a href="https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft.jar">Client</a></li>
<li><a href="https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.jar">Server</a></li>
</ul>
<p>Ubuntu Client Installation:</p>
<p>If you don&#8217;t already have Minecraft installed, check this <a title="Installing Minecraft On Ubuntu" href="http://www.servercobra.com/installing-minecraft-on-ubuntu/">Minecraft Installation tutorial</a>.</p>
<pre class="brush: bash; title: ; notranslate">
# Backup your old client, just in case
mv ~/.minecraft/bin/minecraft.jar ~/.minecraft/bin/minecraft.jar.bak
# Download the new one
cd ~/.minecraft/bin; wget https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft.jar
# And play like normal!
minecraft
# If you didn't alias this:
java -Xmx1024M -Xms512M -cp Minecraft.jar net.minecraft.LauncherFrame
</pre>
<p>And for the Ubuntu-based server installation:</p>
<pre class="brush: bash; title: ; notranslate">
# Stop the server
stopmc
# Or if you haven't followed my tutorials, get to your console (tmux or screen) and type &quot;stop&quot;.
# Backups are important!
mv ~/minecraft/minecraft_server.jar ~/minecraft/minecraft_server.jar.bak
# Get the new one
cd ~/minecraft; wget https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.jar
# Start minecraft again!
startmc
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.servercobra.com/minecraft-1-0-ubuntu-installation/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Minecraft 1.9 Release Candidate 2 Ubuntu Installation</title>
		<link>http://www.servercobra.com/minecraft-1-9-release-candidate-2-ubuntu-installation/</link>
		<comments>http://www.servercobra.com/minecraft-1-9-release-candidate-2-ubuntu-installation/#comments</comments>
		<pubDate>Sun, 13 Nov 2011 23:58:24 +0000</pubDate>
		<dc:creator>Josh Gachnang</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[Minecraft]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.servercobra.com/?p=709</guid>
		<description><![CDATA[<p>Jeb tweeted the links to the Release Candidate 2 client and server today. If you missed them, here they are:<span id="more-709"></span></p>

Client
Server

<p>Ubuntu Client Installation:</p>

# Backup your old client, just in case
mv ~/.minecraft/bin/minecraft.jar ~/.minecraft/bin/minecraft.jar.bak
# Download the new one
cd ~/.minecraft/bin; wget http://assets.minecraft.net/rc2/minecraft.jar
# And play like normal!
minecraft
# If you didn't alias this:
java -Xmx1024M -Xms512M -cp Minecraft.jar net.minecraft.LauncherFrame

<p>And for the [...]]]></description>
			<content:encoded><![CDATA[<p>Jeb tweeted the links to the Release Candidate 2 client and server today. If you missed them, here they are:<span id="more-709"></span></p>
<ul>
<li><a href="http://assets.minecraft.net/rc2/minecraft.jar">Client</a></li>
<li><a href="http://assets.minecraft.net/rc2/minecraft.jar">Server</a></li>
</ul>
<p>Ubuntu Client Installation:</p>
<pre class="brush: bash; title: ; notranslate">
# Backup your old client, just in case
mv ~/.minecraft/bin/minecraft.jar ~/.minecraft/bin/minecraft.jar.bak
# Download the new one
cd ~/.minecraft/bin; wget http://assets.minecraft.net/rc2/minecraft.jar
# And play like normal!
minecraft
# If you didn't alias this:
java -Xmx1024M -Xms512M -cp Minecraft.jar net.minecraft.LauncherFrame
</pre>
<p>And for the Ubuntu-based server installation:</p>
<pre class="brush: bash; title: ; notranslate">
# Stop the server
stopmc
# Or if you haven't followed my tutorials, get to your console (tmux or screen) and type &quot;stop&quot;.
# Backups are important!
mv ~/minecraft/minecraft_server.jar ~/minecraft/minecraft_server.jar.bak
# Get the new one
cd ~/minecraft; http://assets.minecraft.net/rc2/minecraft_server.jar
# Start minecraft again!
startmc
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.servercobra.com/minecraft-1-9-release-candidate-2-ubuntu-installation/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

