<?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>Jen Peters</title>
	<atom:link href="http://jenpeters.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://jenpeters.com</link>
	<description></description>
	<lastBuildDate>Thu, 15 Mar 2012 14:45:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Mount SSH Shares</title>
		<link>http://jenpeters.com/mount-ssh-shares/</link>
		<comments>http://jenpeters.com/mount-ssh-shares/#comments</comments>
		<pubDate>Thu, 15 Mar 2012 14:45:10 +0000</pubDate>
		<dc:creator>cxjtc</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://jenpeters.com/?p=149</guid>
		<description><![CDATA[Vi sucks. As much as I love using the command line, I hate writing code there. I used to like it before I started using an IDE but now Im spoiled and I dont want to use anything else. I have to do most of my work via SSH so I found a way to [...]]]></description>
			<content:encoded><![CDATA[<p>Vi sucks. As much as I love using the command line, I hate writing code there. I used to like it before I started using an IDE but now Im spoiled and I dont want to use anything else. I have to do most of my work via SSH so I found a way to mount the remote server and edit using an IDE.</p>
<p>Install SSHFS<br />
<pre>sudo apt-get install sshfs</pre></p>
<p>Add fuse to /etc/modules<br />
<pre>sudo nano /etc/modules</pre></p>
<p>Add yourself to the &#8216;fuse&#8217; group<br />
<pre>sudo adduser username fuse</pre></p>
<p>Create a mountpoint and give yourself ownership<br />
<pre><code>sudo mkdir /media/mountname
sudo chown username /media/mountname</code></pre></p>
<p>Mount the filesystem<br />
<pre>sshfs remoteserver:/remotefolder /media/mountname</pre></p>
<p>Unmount the filesystem<br />
<pre>fusermount -u /media/mountname</pre></p>
<p>Since I have so many servers to log into I wrote a small bash script to make it easier to mount and umount</p>
<p><pre><code>#!/bin/bash

sshfs $1.server.com:/var/www /media/$1</code></pre></p>
<p><pre><code>#!/bin/bash

fusermount -u /media/$1</code></pre></p>
<p>Directions from <a href="http://ubuntuforums.org/showthread.php?t=103860" title="Ubuntu Forums" target="_blank">Ubuntu Forums</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://jenpeters.com/mount-ssh-shares/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Random Image on WebPage</title>
		<link>http://jenpeters.com/random-image-on-webpage/</link>
		<comments>http://jenpeters.com/random-image-on-webpage/#comments</comments>
		<pubDate>Tue, 07 Feb 2012 19:25:49 +0000</pubDate>
		<dc:creator>cxjtc</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://jenpeters.com/?p=103</guid>
		<description><![CDATA[I was doing the home page of my site today and couldnt decide which image to put there. So I got a bunch of them and set it to show a random image on page load. Heres how I did it: first create a directory in which you want to put your images: $ mkdir [...]]]></description>
			<content:encoded><![CDATA[<p>I was doing the home page of my site today and couldnt decide which image to put there.  So I got a bunch of them and set it to show a random image on page load.  Heres how I did it:</p>
<p>first create a directory in which you want to put your images:</p>
<p><pre>$ mkdir frontcycle</pre></p>
<p>then put all your pics in that folder.</p>
<p><pre>$ cp pic1.jpg frontcycle/</pre></p>
<p>next you write a php function.  you can do this in an external page or right in your file.</p>
<p><pre><code>function get_random_image() {
&nbsp;&nbsp; $dh = opendir( &quot;path/to/frontcycle&quot; );

&nbsp;&nbsp; $files = array();

&nbsp;&nbsp; while ( $file = readdir( $dh ) ) {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ( preg_match( &quot;/\.(jpg|jpeg|gif|png)$/i&quot;, $file ) ) { 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // add or remove file extensions if you want
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $files[] = $file;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
&nbsp;&nbsp; }

&nbsp;&nbsp; return $files[ rand( 0, sizeof( $files ) - 1 ) ];
}</code></pre></p>
<p>finally, in the page your image will be displayed, add the following code:</p>
<p><pre>&lt;img src=&#039;/path/to/frontcycle/&lt;?php echo get_random_image() ?&gt;&#039; /&gt;</pre></p>
]]></content:encoded>
			<wfw:commentRss>http://jenpeters.com/random-image-on-webpage/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Copy/Paste from XTerm</title>
		<link>http://jenpeters.com/copypaste-from-xterm/</link>
		<comments>http://jenpeters.com/copypaste-from-xterm/#comments</comments>
		<pubDate>Tue, 31 Jan 2012 21:40:30 +0000</pubDate>
		<dc:creator>cxjtc</dc:creator>
				<category><![CDATA[how to]]></category>
		<category><![CDATA[commandline]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[xterm]]></category>

		<guid isPermaLink="false">http://jenpeters.com/?p=78</guid>
		<description><![CDATA[Users of XTerm know all too well the frustrations caused by the inability to copy something in XTerm and paste it somewhere else, and vice versa. You can hack and recompile XTerm to solve this problem, but heres a way enable copy/paste as you launch: /usr/bin/xterm -xrm &#039;XTerm*VT100.translations: #override &#60;Btn1Up&#62;: select-end(PRIMARY, CLIPBOARD, CUT_BUFFER0)&#039; -e &#039;ssh [...]]]></description>
			<content:encoded><![CDATA[<p>Users of XTerm know all too well the frustrations caused by the inability to copy something in XTerm and paste it somewhere else, and vice versa.  You can hack and recompile XTerm to solve this problem, but heres a way enable copy/paste as you launch:</p>
<p><pre><code>/usr/bin/xterm -xrm &#039;XTerm*VT100.translations: #override &lt;Btn1Up&gt;: 
select-end(PRIMARY, CLIPBOARD, CUT_BUFFER0)&#039; -e &#039;ssh user@server&#039;</code></pre></p>
]]></content:encoded>
			<wfw:commentRss>http://jenpeters.com/copypaste-from-xterm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Send Email With an Attachment in PHP</title>
		<link>http://jenpeters.com/send-email-with-an-attachment-in-php/</link>
		<comments>http://jenpeters.com/send-email-with-an-attachment-in-php/#comments</comments>
		<pubDate>Tue, 31 Jan 2012 20:49:13 +0000</pubDate>
		<dc:creator>cxjtc</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[attachment]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://jenpeters.com/?p=68</guid>
		<description><![CDATA[// basic information $to = &#34;mailbox@jenpeters.com&#34;; $from = &#34;noreply@jenpeters.com&#34;; $subject = &#34;This is an email&#34;; $body = &#34;This is some text&#34;; // get file information $file = &#34;/home/cxjtc/file.csv&#34;; $filename = basename( $file ); $contenttype = &#34;text/csv&#34;; // change to suit your attachment $fh = fopen( $file, &#34;r&#34; ); $content = fread( $fh, filesize( $file ) [...]]]></description>
			<content:encoded><![CDATA[<p><pre><code>
// basic information
$to = &quot;mailbox@jenpeters.com&quot;;

$from = &quot;noreply@jenpeters.com&quot;;

$subject = &quot;This is an email&quot;;

$body = &quot;This is some text&quot;;

// get file information
$file = &quot;/home/cxjtc/file.csv&quot;;

$filename = basename( $file );

$contenttype = &quot;text/csv&quot;; // change to suit your attachment

$fh = fopen( $file, &quot;r&quot; );

$content = fread( $fh, filesize( $file ) );

fclose( $fh );

$content = chunk_split( base64_encode( $content) );

$headers = &lt;&lt;&lt;EOT
From: $from\n
MIME-Version: 1.0\n
Content-Type: multipart/mixed; boundary=&quot;$boundary&quot;\n\n
This is a multi-part message in MIME format.\n
--$boundary\n
Content-Type: text/plain; charset=iso-8859-1\n
Content-Transfer-Encoding: 7bit\n\n
$body\n\n
--$boundary\n
Content-Type: text/csv; name=&quot;$filename&quot;\n
Content-Transfer-Encoding: base64\n
Content-Disposition: attachment; filename=&quot;$filename&quot;\n\n
$content\n\n
--$boundary--
EOT

mail( $to, $subject, &quot;&quot;, $headers );
</code></pre></p>
]]></content:encoded>
			<wfw:commentRss>http://jenpeters.com/send-email-with-an-attachment-in-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

