<?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>scienceoss.com &#187; linux</title>
	<atom:link href="http://scienceoss.com/tags/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://scienceoss.com</link>
	<description>useful tidbits for using open source software in science</description>
	<lastBuildDate>Wed, 26 May 2010 03:34:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Read Excel files from Python</title>
		<link>http://scienceoss.com/read-excel-files-from-python/</link>
		<comments>http://scienceoss.com/read-excel-files-from-python/#comments</comments>
		<pubDate>Wed, 09 Apr 2008 18:04:25 +0000</pubDate>
		<dc:creator>ryan</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[excel]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[xlrd]]></category>

		<guid isPermaLink="false">http://scienceoss.com/read-excel-files-from-python/</guid>
		<description><![CDATA[Use the excellent xlrd package, which works on any platform. That means you can read Excel files from Python in Linux! Example usage: Open the workbook Check the sheet names Get the first sheet either by index or by name Iterate through rows, returning each as a list that you can index: If you just [...]]]></description>
			<content:encoded><![CDATA[<p>Use the excellent <a href="http://www.lexicon.net/sjmachin/xlrd.htm">xlrd</a> package, which works on any platform.  That means you can read Excel files from Python in Linux!  Example usage:</p>
<p>Open the workbook</p>
<pre class="brush: python; title: ; notranslate">import xlrd
wb = xlrd.open_workbook('myworkbook.xls')</pre>
<p>Check the sheet names</p>
<pre class="brush: python; title: ; notranslate">wb.sheet_names()</pre>
<p>Get the first sheet either by index or by name</p>
<pre class="brush: python; title: ; notranslate">sh = wb.sheet_by_index(0)
sh = wb.sheet_by_name(u'Sheet1')</pre>
<p>Iterate through rows, returning each as a list that you can index:</p>
<pre class="brush: python; title: ; notranslate">for rownum in range(sh.nrows):
    print sh.row_values(rownum)</pre>
<p>If you just want the first column:</p>
<pre class="brush: python; title: ; notranslate">first_column = sh.col_values(0)</pre>
<p>Index individual cells:</p>
<pre class="brush: python; title: ; notranslate">cell_A1 = sh.cell(0,0).value
cell_C4 = sh.cell(rowx=3,colx=2).value</pre>
<p>(Note Python indices start at zero but Excel starts at one)</p>
<p>Turns out the <span class="c">put_cell()</span> method isn&#8217;t supported, so ignore the following section (Thanks for the heads up, John!)</p>
<p><strike>Put something in the cell:</p>
<pre class="brush: python; title: ; notranslate">row = 0
col = 0
ctype = 1  # see below
value = 'asdf'
xf = 0  # extended formatting (use 0 to use default)
sh.put_cell(row, col, ctype, value, xf)
sh.cell(0,0)  # text:u'asdf'
sh.cell(0,0).value  # 'asdf'</pre>
<p>Possible ctypes: 0 = empty, 1 = string, 2 = number, 3 = date, 4 = boolean, 5 = error </strike></p>
]]></content:encoded>
			<wfw:commentRss>http://scienceoss.com/read-excel-files-from-python/feed/</wfw:commentRss>
		<slash:comments>35</slash:comments>
		</item>
		<item>
		<title>Check open ports</title>
		<link>http://scienceoss.com/check-open-ports/</link>
		<comments>http://scienceoss.com/check-open-ports/#comments</comments>
		<pubDate>Thu, 13 Mar 2008 03:17:23 +0000</pubDate>
		<dc:creator>ryan</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[ports]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://scienceoss.com/check-open-ports/</guid>
		<description><![CDATA[Are there any open ports that shouldn&#8217;t be open? Check with: sudo netstat -tupl Results in something like: Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 localhost:mysql *:* LISTEN 5077/mysqld tcp 0 0 localhost:ipp *:* LISTEN 5001/cupsd udp 0 0 *:32768 *:* 5324/avahi-daemon: udp 0 [...]]]></description>
			<content:encoded><![CDATA[<p>Are there any open ports that shouldn&#8217;t be open?  Check with:</p>
<pre class="prettyprint"><code class="code">sudo netstat -tupl</code></pre>
<p>Results in something like:</p>
<pre class="prettyprint"><code class="code">
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address    Foreign Address  State    PID/Program name
tcp        0      0 localhost:mysql  *:*              LISTEN  5077/mysqld
tcp        0      0 localhost:ipp    *:*              LISTEN  5001/cupsd
udp        0      0 *:32768          *:*                      5324/avahi-daemon:
udp        0      0 *:bootpc         *:*                      5875/dhclient
udp        0      0 *:mdns           *:*                      5324/avahi-daemon: </code></pre>
<p>Kill the process that is using the port</p>
<pre class="prettyprint"><code class="code">kill (PID here)</code></pre>
<p>List open files:</p>
<pre class="prettyprint"><code class="code">lsof -i</code></pre>
<p>where the -i makes it list internet files.</p>
]]></content:encoded>
			<wfw:commentRss>http://scienceoss.com/check-open-ports/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Split the pages out of a PDF, or merge PDFs into one</title>
		<link>http://scienceoss.com/split-the-pages-out-of-a-pdf-or-merge-pdfs-into-one/</link>
		<comments>http://scienceoss.com/split-the-pages-out-of-a-pdf-or-merge-pdfs-into-one/#comments</comments>
		<pubDate>Sun, 27 Jan 2008 21:49:12 +0000</pubDate>
		<dc:creator>ryan</dc:creator>
				<category><![CDATA[utilities]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[pdf]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://scienceoss.com/?p=79</guid>
		<description><![CDATA[Using the free open source program PDF Toolkit, you can operate on PDFs quite easily. Install the open-source PDF Toolkit Get the PDF Toolkit package, available for Windows, Mac OSX 10.3+ (or build from source for earlier Mac OSs) and Linux. It&#8217;s in the Ubuntu repositories: sudo apt-get install pdftk Split pages from a PDF [...]]]></description>
			<content:encoded><![CDATA[<p>Using the free open source program PDF Toolkit, you can operate on PDFs quite easily.<span id="more-79"></span></p>
<h3>Install the open-source PDF Toolkit</h3>
<p>Get the <a href="http://www.accesspdf.com/article.php/20041130153545577">PDF Toolkit</a> package, available for Windows, Mac OSX 10.3+ (or build from source for earlier Mac OSs) and Linux.</p>
<p>It&#8217;s in the Ubuntu repositories:</p>
<pre class = "prettyprint"><code class = "code">sudo apt-get install pdftk </code></pre>
<h3>Split pages from a PDF</h3>
<p>To split out pages 10-15 and page 19 of <span class="c">whole.pdf</span> into a separate PDF, <span class="c">piece.pdf</span>, run</p>
<pre class = "prettyprint"><code class = "code">
pdftk whole.pdf cat 10-15 19 output piece.pdf
</code></pre>
<h3>Merge multiple PDFs into one</h3>
<p>To combine <span class="c">first.pdf</span>, <span class="c">second.pdf</span>, and <span class="c">third.pdf</span> into <span class="c">big.pdf</span>, use</p>
<pre class = "prettyprint"><code class = "code">pdftk first.pdf second.pdf third.pdf cat output big.pdf</code></pre>
<p>Other examples <a href="http://www.accesspdf.com/article.php/20041129175231241">here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://scienceoss.com/split-the-pages-out-of-a-pdf-or-merge-pdfs-into-one/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

