<?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>Matt [Danger] &#187; Unix</title>
	<atom:link href="http://mattdanger.net/category/unix/feed/" rel="self" type="application/rss+xml" />
	<link>http://mattdanger.net</link>
	<description>One step closer to world domination</description>
	<lastBuildDate>Thu, 06 May 2010 21:31:19 +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>Facebook-Status-2.0 announced!</title>
		<link>http://mattdanger.net/2009/02/facebook-status-20-announced/</link>
		<comments>http://mattdanger.net/2009/02/facebook-status-20-announced/#comments</comments>
		<pubDate>Tue, 10 Feb 2009 18:33:01 +0000</pubDate>
		<dc:creator>Matt Danger</dc:creator>
				<category><![CDATA[Announcements]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[Shell Scripting]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[terminal]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[shell script]]></category>
		<category><![CDATA[status]]></category>

		<guid isPermaLink="false">http://mattdanger.net/?p=155</guid>
		<description><![CDATA[I have updated my original Facebook status script to work with Facebook 2.0.
Why is this interesting? Until recently the Facebook Developer Platform didn&#8217;t allow the changing of user status messages. This does and can be implemented in other utilities, which I may do in the future. Enjoy!
]]></description>
			<content:encoded><![CDATA[<p>I have <a href="http://mattdanger.net/2008/11/update-your-facebook-status-from-the-command-line/">updated my original Facebook status script</a> to work with Facebook 2.0.</p>
<p>Why is this interesting? Until <a href="http://www.allfacebook.com/2009/02/facebook-opens-status-api-say-goodbye-to-twitter/">recently</a> the Facebook Developer Platform didn&#8217;t allow the changing of user status messages. This does and can be implemented in other utilities, which I may do in the future. Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://mattdanger.net/2009/02/facebook-status-20-announced/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bash Examples</title>
		<link>http://mattdanger.net/2008/11/bash-examples/</link>
		<comments>http://mattdanger.net/2008/11/bash-examples/#comments</comments>
		<pubDate>Sun, 23 Nov 2008 23:35:14 +0000</pubDate>
		<dc:creator>Matt Danger</dc:creator>
				<category><![CDATA[Shell Scripting]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[Bash]]></category>

		<guid isPermaLink="false">http://mattdanger.net/?p=8</guid>
		<description><![CDATA[A while ago a friend was taking an entry level Unix programming class and asked me to help him study. I came up with some sample problems for him. Here are my solutions:
The first is a program that will allow a user to input as many numbers as the user wants (999 as the choice [...]]]></description>
			<content:encoded><![CDATA[<p>A while ago a friend was taking an entry level Unix programming class and asked me to help him study. I came up with some sample problems for him. Here are my solutions:</p>
<p>The first is a program that will allow a user to input as many numbers as the user wants (999 as the choice that ends the user input). The program will then output the highest number, the lowest number, the sum of all the numbers, and the average number.</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #007800;">COUNT</span>=0
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;Enter a number (999 to quit): &quot;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">while</span> <span style="color: #c20cb9; font-weight: bold;">read</span> NUM; <span style="color: #000000; font-weight: bold;">do</span>
  <span style="color: #666666; font-style: italic;"># Set initials</span>
  <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$COUNT</span> <span style="color: #660033;">-eq</span> 0 <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #007800;">HIGHEST</span>=<span style="color: #007800;">$NUM</span>
    <span style="color: #007800;">LOWEST</span>=<span style="color: #007800;">$NUM</span>
    <span style="color: #007800;">SUM</span>=<span style="color: #007800;">$NUM</span>
  <span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
  <span style="color: #666666; font-style: italic;"># If 999 is entered, break out</span>
  <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$NUM</span> <span style="color: #660033;">-eq</span> <span style="color: #000000;">999</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #7a0874; font-weight: bold;">break</span>
  <span style="color: #000000; font-weight: bold;">else</span>
    <span style="color: #666666; font-style: italic;"># See if inputted number is the highest number</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$NUM</span> <span style="color: #660033;">-gt</span> <span style="color: #007800;">$HIGHEST</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
      <span style="color: #007800;">HIGHEST</span>=<span style="color: #007800;">$NUM</span>
    <span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
    <span style="color: #666666; font-style: italic;"># See if inputted number is the lowest number</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$NUM</span> <span style="color: #660033;">-lt</span> <span style="color: #007800;">$LOWEST</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
      <span style="color: #007800;">LOWEST</span>=<span style="color: #007800;">$NUM</span>;
    <span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
    <span style="color: #666666; font-style: italic;"># Calculate sum</span>
    <span style="color: #007800;">SUM</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">$SUM</span>+<span style="color: #007800;">$NUM</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
&nbsp;
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;Enter another number (999 to quit): &quot;</span>
  <span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
  <span style="color: #007800;">COUNT</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">$COUNT</span>+<span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #000000; font-weight: bold;">done</span>
&nbsp;
<span style="color: #007800;">AVERAGE</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">$SUM</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$COUNT</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Highest number: $HIGHEST&quot;</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Lowest number: $LOWEST&quot;</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Sum of the numbers: $SUM&quot;</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Average of the numbers: $AVERAGE&quot;</span></pre></div></div>

<p>The second program is a number guessing game. The computer picks a number from 0-60 then allows the user to guess at the number until the user gets it right. The program gives the user a hint on whether they should guess a higher or lower number.</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash </span>
<span style="color: #007800;">RAN</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>RANDOM<span style="color: #000000; font-weight: bold;">%</span>60<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #007800;">COUNTER</span>=<span style="color: #000000;">1</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;I've guessed a number between 0-60, what is it? &quot;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">while</span> <span style="color: #c20cb9; font-weight: bold;">read</span> GUESS; <span style="color: #000000; font-weight: bold;">do</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$GUESS</span> <span style="color: #660033;">-eq</span> <span style="color: #007800;">$RAN</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #7a0874; font-weight: bold;">break</span>;
  <span style="color: #000000; font-weight: bold;">else</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$GUESS</span> <span style="color: #660033;">-lt</span> <span style="color: #007800;">$RAN</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
      <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;Nope, try a higher number: &quot;</span>
    <span style="color: #000000; font-weight: bold;">else</span>
      <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;Nope, try a lower number: &quot;</span>
    <span style="color: #000000; font-weight: bold;">fi</span>	
  <span style="color: #000000; font-weight: bold;">fi</span>
  <span style="color: #007800;">COUNTER</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>COUNTER+<span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">done</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Yep, good job! It took you $COUNTER tries to guess correctly.&quot;</span></pre></div></div>

<p>The third program allows a user to type in a number, then the program will either count up to the number provided by the user or count down from that number. In addition, a menu lets the user choose which counter they wish to use. In both cases that counter will either count down to 0, or start counting from 0.</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash </span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;Enter a number: &quot;</span>; <span style="color: #c20cb9; font-weight: bold;">read</span> NUM
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;Enter U to count up to $NUM and D to count down to 0: &quot;</span>; <span style="color: #c20cb9; font-weight: bold;">read</span> CHOICE
&nbsp;
<span style="color: #000000; font-weight: bold;">case</span> <span style="color: #007800;">$CHOICE</span> <span style="color: #000000; font-weight: bold;">in</span>
  <span style="color: #ff0000;">'u'</span>|<span style="color: #ff0000;">'U'</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> 
    <span style="color: #007800;">COUNTER</span>=0
    <span style="color: #000000; font-weight: bold;">while</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$COUNTER</span> <span style="color: #660033;">-le</span> <span style="color: #007800;">$NUM</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">do</span>
      <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$COUNTER</span>
      <span style="color: #007800;">COUNTER</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">$COUNTER</span>+<span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
    <span style="color: #000000; font-weight: bold;">done</span> ;;
  <span style="color: #ff0000;">'d'</span>|<span style="color: #ff0000;">'D'</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
    <span style="color: #000000; font-weight: bold;">while</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$NUM</span> <span style="color: #660033;">-ge</span> 0 <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">do</span>
      <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$NUM</span>;
      <span style="color: #007800;">NUM</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">$NUM</span>-<span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
    <span style="color: #000000; font-weight: bold;">done</span> ;;
  <span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Error: You entered an invalid argument.&quot;</span>
<span style="color: #000000; font-weight: bold;">esac</span></pre></div></div>

<p>The last program asks the user if they want to add, subtract, multiply or divide two user inputted numbers. Then the program outputs the sum of number 1 and number 2, the difference of number 1 and number 2, the product of number 1 and number 2, and the quotient of number 1 and number 2</p>
<p>This program will run until the user wants to quit. Also, if the user puts in a 0 as the second number, we let the user know that if they choose divide that a division by zero error will occur.</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #000000; font-weight: bold;">while</span> <span style="color: #c20cb9; font-weight: bold;">true</span>; <span style="color: #000000; font-weight: bold;">do</span>
  <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Please enter two numbers (type 'q' to quit): &quot;</span>
  <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;Number 1: &quot;</span>
  <span style="color: #c20cb9; font-weight: bold;">read</span> NUM1
  <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$NUM1</span> == <span style="color: #ff0000;">&quot;q&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span> <span style="color: #7a0874; font-weight: bold;">exit</span>; <span style="color: #000000; font-weight: bold;">fi</span>
  <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;Number 2: &quot;</span>
  <span style="color: #c20cb9; font-weight: bold;">read</span> NUM2
  <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;Enter (a) to add, (s) to subtract, (m) to multiply, or (d) to divide these numbers: &quot;</span>
  <span style="color: #c20cb9; font-weight: bold;">read</span> OPERATION
&nbsp;
  <span style="color: #000000; font-weight: bold;">case</span> <span style="color: #007800;">$OPERATION</span> <span style="color: #000000; font-weight: bold;">in</span>
    a<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;The sum of $NUM1 and $NUM2 is: $(($NUM1+$NUM2))&quot;</span> ;;
    s<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;The difference of $NUM1 and $NUM2 is: $(($NUM1-$NUM2))&quot;</span>;;
    m<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;The product of $NUM1 and $NUM2 is: $(($NUM1*$NUM2))&quot;</span> ;;
    d<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$NUM2</span> <span style="color: #660033;">-eq</span> 0 <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;You can't divide by 0, a division by zero error will occur.&quot;</span>
      <span style="color: #000000; font-weight: bold;">else</span> 			
	    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;The quotient of $NUM1 and $NUM2 is: $(($NUM1/$NUM2))&quot;</span>
      <span style="color: #000000; font-weight: bold;">fi</span> ;;
  <span style="color: #000000; font-weight: bold;">esac</span>
<span style="color: #000000; font-weight: bold;">done</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://mattdanger.net/2008/11/bash-examples/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Newest LiveJournal Images</title>
		<link>http://mattdanger.net/2004/11/newest-livejournal-images/</link>
		<comments>http://mattdanger.net/2004/11/newest-livejournal-images/#comments</comments>
		<pubDate>Wed, 24 Nov 2004 17:54:07 +0000</pubDate>
		<dc:creator>Matt Danger</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[LiveJournal]]></category>

		<guid isPermaLink="false">http://mattdanger.net/?p=16</guid>
		<description><![CDATA[This script displays the newest images posted by LiveJournal users. The script is pretty basic and simply parses a feed from LiveJournal.
You can view it in action here: http://mattdanger.net/lj/ (Warning: Some images may be NSFW!)
The code:

&#60;?php
&#160;
$n = 5; // Maximum is 250
$referrer = 'http://example.com'; // Your site
$email = 'user@example.com'; // Your email
&#160;
if &#40;$fp = fsockopen&#40;'livejournal.com', 80&#41;&#41; [...]]]></description>
			<content:encoded><![CDATA[<p>This script displays the newest images posted by LiveJournal users. The script is pretty basic and simply parses a feed from LiveJournal.</p>
<p>You can view it in action here: <a href="http://mattdanger.net/lj/">http://mattdanger.net/lj/</a> (Warning: Some images may be NSFW!)</p>
<p>The code:</p>

<div class="wp_syntax"><div class="code"><pre class="php php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #000088;">$n</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">5</span>; <span style="color: #666666; font-style: italic;">// Maximum is 250</span>
<span style="color: #000088;">$referrer</span> <span style="color: #339933;">=</span> <span style="">'http://example.com'</span>; <span style="color: #666666; font-style: italic;">// Your site</span>
<span style="color: #000088;">$email</span> <span style="color: #339933;">=</span> <span style="">'user@example.com'</span>; <span style="color: #666666; font-style: italic;">// Your email</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span> <span style="color: #339933;">=</span> <span style="color: #990000;">fsockopen</span><span style="color: #009900;">&#40;</span><span style="">'livejournal.com'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">80</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
  <span style="color: #990000;">fputs</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;GET /stats/latest-img.bml HTTP/1.0rn&quot;</span> <span style="color: #339933;">.</span>
      <span style="color: #0000ff;">&quot;Host: www.livejournal.comrn&quot;</span> <span style="color: #339933;">.</span>
      <span style="color: #0000ff;">&quot;User-Agent: &quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$referrer</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;; &quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$email</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;rnrn&quot;</span><span style="color: #009900;">&#41;</span>;
&nbsp;
  <span style="color: #000088;">$data</span> <span style="color: #339933;">=</span> <span style="">''</span>;
&nbsp;
  <span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">feof</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #000088;">$data</span> <span style="color: #339933;">.=</span> <span style="color: #990000;">fgets</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #009900;">&#41;</span>;
&nbsp;
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #990000;">fclose</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #009900;">&#41;</span>;
  <span style="color: #990000;">preg_match_all</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&lt;recent-image img='([^']+)' url='([^']+)' /&gt;&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$data</span><span style="color: #339933;">,</span> <span style="color: #000088;">$out</span><span style="color: #009900;">&#41;</span>;
&nbsp;
  <span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span> <span style="color: #339933;">=</span> <span style="color:#800080;">0</span>; <span style="color: #000088;">$i</span> <span style="color: #339933;">&lt;</span> <span style="color: #000088;">$n</span>; <span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #990000;">echo</span> <span style="">'&lt;a href=&quot;'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$out</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span> <span style="">'&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$out</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span> <span style="">'&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;'</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;n&quot;</span>;
&nbsp;
  <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
&nbsp;
  <span style="color: #990000;">echo</span> <span style="color: #0000ff;">&quot;Connecting to LiveJournal failed.&quot;</span>;
&nbsp;
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>As an aside, if you&#8217;re a LiveJournal user and don&#8217;t want your images posted to the public feed you can go to your <a href="http://www.livejournal.com/admin/console/">command console</a> and type &#8220;set latest_optout yes&#8221;.</p>
]]></content:encoded>
			<wfw:commentRss>http://mattdanger.net/2004/11/newest-livejournal-images/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
