<?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>Design Sky</title>
	<atom:link href="http://designsky.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://designsky.net</link>
	<description>Just another WordPress site</description>
	<lastBuildDate>Sun, 20 May 2012 12:05:35 +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>php调整服务器时间</title>
		<link>http://designsky.net/2012/05/php-adjust-server-time/</link>
		<comments>http://designsky.net/2012/05/php-adjust-server-time/#comments</comments>
		<pubDate>Sun, 20 May 2012 12:05:35 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://designsky.net/?p=141</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<pre class="brush: php; title: ; notranslate">
$today = date('Y-m-d-G');
$today = strftime(&quot;%Y-%m-%d-%H&quot;, strtotime(&quot;$today -5 hour&quot;));
</pre>
]]></content:encoded>
			<wfw:commentRss>http://designsky.net/2012/05/php-adjust-server-time/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>linux实时查看日志文件</title>
		<link>http://designsky.net/2012/05/linux-view-log-file-in-real-time/</link>
		<comments>http://designsky.net/2012/05/linux-view-log-file-in-real-time/#comments</comments>
		<pubDate>Sun, 13 May 2012 03:44:41 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://designsky.net/?p=138</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<pre class="brush: bash; title: ; notranslate">
tail -f /path/to/log_file
</pre>
]]></content:encoded>
			<wfw:commentRss>http://designsky.net/2012/05/linux-view-log-file-in-real-time/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>php获取图片信息</title>
		<link>http://designsky.net/2012/05/php-get-image-information/</link>
		<comments>http://designsky.net/2012/05/php-get-image-information/#comments</comments>
		<pubDate>Sat, 05 May 2012 13:45:30 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://designsky.net/?p=134</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<pre class="brush: php; title: ; notranslate">
/*
 * @param string $file Filepath
 * @param string $query Needed information (0 = width, 1 = height, 2 = mime-type)
 * @return string Fileinfo
 */

function getImageinfo($file, $query) {
	if(!realpath($file)) {
		$file = $_SERVER[&quot;DOCUMENT_ROOT&quot;].$file;
	}
	$image = getimagesize($file);
	return $image[$query];
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://designsky.net/2012/05/php-get-image-information/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>shell脚本检测一个文件是否为空</title>
		<link>http://designsky.net/2012/04/shell-check-if-file-empty/</link>
		<comments>http://designsky.net/2012/04/shell-check-if-file-empty/#comments</comments>
		<pubDate>Sat, 28 Apr 2012 08:31:04 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://designsky.net/?p=131</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<pre class="brush: bash; title: ; notranslate">
#!/bin/bash
file=&quot;$1&quot;
[ $# -eq 0 ] &amp;&amp; { echo &quot;Usage: $0 filename&quot;; exit 1; }
[ ! -f &quot;$file&quot; ] &amp;&amp; { echo &quot;Error: $0 file not found.&quot;; exit 2; }

if [ -s &quot;$file&quot; ]
then
  echo &quot;$file has some data.&quot;
  # do something as file has data
else
  echo &quot;$file is empty.&quot;
  # do something as file is empty
fi
</pre>
]]></content:encoded>
			<wfw:commentRss>http://designsky.net/2012/04/shell-check-if-file-empty/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>php检测文件大小</title>
		<link>http://designsky.net/2012/04/php-get-file-size/</link>
		<comments>http://designsky.net/2012/04/php-get-file-size/#comments</comments>
		<pubDate>Sat, 21 Apr 2012 07:31:47 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://designsky.net/?p=128</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<pre class="brush: php; title: ; notranslate">
/*
 * @param string $file Filepath
 * @param int $digits Digits to display
 * @return string|bool Size (KB, MB, GB, TB) or boolean
 */

function getFilesize($file, $digits = 2) {
	if(is_file($file)) {
		$filePath = $file;
		if(!realpath($filePath)) {
			$filePath = $_SERVER[&quot;DOCUMENT_ROOT&quot;].$filePath;
		}
		$fileSize = filesize($filePath);
		$sizes = array(&quot;TB&quot;, &quot;GB&quot;, &quot;MB&quot;, &quot;KB&quot;, &quot;B&quot;);
		$total = count($sizes);
		while($total-- &amp;&amp; $fileSize &gt; 1024) {
			$fileSize /= 1024;
		}
		return round($fileSize, $digits).&quot; &quot;.$sizes[$total];
	}
	return false;
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://designsky.net/2012/04/php-get-file-size/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>shell脚本检测一个文件是否存在</title>
		<link>http://designsky.net/2012/04/shell-check-if-file-exists/</link>
		<comments>http://designsky.net/2012/04/shell-check-if-file-exists/#comments</comments>
		<pubDate>Sat, 14 Apr 2012 08:04:58 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://designsky.net/?p=126</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<pre class="brush: bash; title: ; notranslate">
#!/bin/bash
FILE=&quot;$1&quot;

if [ -f $FILE ];
then
  echo &quot;File $FILE exists&quot;
else
  echo &quot;File $FILE does not exists&quot;
fi
</pre>
]]></content:encoded>
			<wfw:commentRss>http://designsky.net/2012/04/shell-check-if-file-exists/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>php验证邮箱地址是否有效</title>
		<link>http://designsky.net/2012/04/php-check-if-email-address-valid/</link>
		<comments>http://designsky.net/2012/04/php-check-if-email-address-valid/#comments</comments>
		<pubDate>Sat, 07 Apr 2012 07:58:58 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://designsky.net/?p=121</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<pre class="brush: php; title: ; notranslate">
&lt;?php
$email=&quot;test@example.com&quot;;
if(isValidEmail($email))
{
	echo &quot;Email address is valid.&quot;;
}
else
{
	echo &quot;Email address is not valid&quot;;
}

// Check-Function
function isValidEmail($email)
{
	//Perform a basic syntax-check
	//If this check fails, there's no need to continue
	if(!filter_var($email, FILTER_VALIDATE_EMAIL))
	{
		return false;
	}

	//extract host
	list($user, $host) = explode(&quot;@&quot;, $email);
	//check, if host is accessible
	if(!checkdnsrr($host, &quot;MX&quot;) &amp;&amp; !checkdnsrr($host, &quot;A&quot;))
	{
		return false;
	}

	return true;
}
?&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://designsky.net/2012/04/php-check-if-email-address-valid/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>shell脚本重启apache</title>
		<link>http://designsky.net/2012/03/shell-restart-apache/</link>
		<comments>http://designsky.net/2012/03/shell-restart-apache/#comments</comments>
		<pubDate>Sat, 31 Mar 2012 10:48:30 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://designsky.net/?p=118</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<pre class="brush: bash; title: ; notranslate">
#!/bin/sh
if ps auxc | grep httpd; then
  exit 0
else
  echo &quot;HTTP service crash&quot;
  /etc/init.d/httpd stop
  sleep 3
  /etc/init.d/httpd start
  echo &quot;httpd restarted on server.&quot; | mail -s &quot;httpd (`uname -n`) restarted @ `date`&quot;
  mail@example.com
fi
</pre>
]]></content:encoded>
			<wfw:commentRss>http://designsky.net/2012/03/shell-restart-apache/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>shell脚本修改文件名为小写</title>
		<link>http://designsky.net/2012/03/shell-make-filename-lowercase/</link>
		<comments>http://designsky.net/2012/03/shell-make-filename-lowercase/#comments</comments>
		<pubDate>Sun, 25 Mar 2012 01:21:00 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://designsky.net/?p=116</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<pre class="brush: bash; title: ; notranslate">
for i in *.txt; do mv &quot;$i&quot; &quot;`echo $i | tr [A-Z] [a-z]`&quot;; done
</pre>
]]></content:encoded>
			<wfw:commentRss>http://designsky.net/2012/03/shell-make-filename-lowercase/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>php获取ip地址</title>
		<link>http://designsky.net/2012/03/php-get-ip-address/</link>
		<comments>http://designsky.net/2012/03/php-get-ip-address/#comments</comments>
		<pubDate>Sat, 17 Mar 2012 06:28:25 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://designsky.net/?p=113</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<pre class="brush: php; title: ; notranslate">
&lt;?php
$ip = $_SERVER[&quot;REMOTE_ADDR&quot;];
echo &quot;&lt;br&gt; Your IP address: &quot; . $ip;
echo &quot;&lt;br&gt; Your hostname: &quot; . GetHostByName($ip);
?&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://designsky.net/2012/03/php-get-ip-address/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

