<?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>phill84.org &#187; xchat</title>
	<atom:link href="http://phill84.org/tag/xchat/feed/" rel="self" type="application/rss+xml" />
	<link>http://phill84.org</link>
	<description>System.out.print</description>
	<lastBuildDate>Sat, 26 Mar 2011 10:21:26 +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>Sysinfo plugin for xchat2 on linux</title>
		<link>http://phill84.org/2009/08/sysinfo-plugin-for-xchat2-on-linux/</link>
		<comments>http://phill84.org/2009/08/sysinfo-plugin-for-xchat2-on-linux/#comments</comments>
		<pubDate>Sun, 30 Aug 2009 19:23:59 +0000</pubDate>
		<dc:creator>phill84</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[sysinfo]]></category>
		<category><![CDATA[xchat]]></category>

		<guid isPermaLink="false">http://phill84.org/2009/08/sysinfo-plugin-for-xchat2-on-linux/</guid>
		<description><![CDATA[It&#8217;s my first time writing something in perl, the code is not very efficient and for now it can only display info of cpu, memory, bandwidth and uptime.]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s my first time writing something in perl, the code is not very efficient and for now it can only display info of cpu, memory, bandwidth and uptime.</p>
<pre class="brush: perl; title: ; notranslate"># Configuration
$eth = &quot;eth0&quot;;

# Script
Xchat::register(&quot;Sysinfo&quot;, &quot;0.1&quot;, &quot;System Information Displayer&quot;);
Xchat::print(&quot;Sysinfo 0.1 Loaded.&quot;);
Xchat::hook_command(&quot;uptime&quot;, &quot;uptime&quot;);
Xchat::hook_command(&quot;os&quot;, &quot;os&quot;);
Xchat::hook_command(&quot;bw&quot;, &quot;bw&quot;);
Xchat::hook_command(&quot;cpu&quot;, &quot;cpu&quot;);
Xchat::hook_command(&quot;mem&quot;, &quot;mem&quot;);

sub uptime {
	$uptime = `cat /proc/uptime | awk '{printf \$1}'`;
	$_day = 60 * 60 * 24;
	$_hour = 60 * 60;
	$_minute = 60;
	$day = int($uptime/$_day);
	$uptime %= $_day;
	$hour = int($uptime/$_hour);
	$uptime %= $_hour;
	$minute = int($uptime/$_minute);
	$uptime %= $_minute;
	$second = int($uptime);
	$uptime = &quot;&quot;;
	if($day != 0) {
		$uptime .= $day;
		if($day == 1) {
			$uptime .= &quot; day &quot;;
		} else {
			$uptime .= &quot; days &quot;;
		}
	}
	if($hour != 0) {
		$uptime .= $hour;
		if($hour == 1) {
			$uptime .= &quot; hour &quot;;
		} else {
			$uptime .= &quot; hours &quot;;
		}
	}
	if($minute != 0) {
		$uptime .= $minute;
		if($minute == 1) {
			$uptime .= &quot; minute &quot;;
		} else {
			$uptime .= &quot; minutes &quot;;
		}
	}
	$uptime .= $second;
	if($second == 1) {
		$uptime .= &quot; second&quot;;
	} else {
		$uptime .= &quot; seconds&quot;;
	}
	Xchat::command(&quot;SAY &#92;&#48;02[UPTIME]&#92;&#48;02 $uptime&quot;);
	Xchat::EAT_ALL;
}

sub os {
	$_kernel_release = `uname -r`;
	$_operating_system = `uname -o`;
	chomp($_kernel_release);
	chomp($_operating_system);
	$os = $_operating_system . &quot; &quot; . $_kernel_release;
	Xchat::command(&quot;SAY &#92;&#48;02[OS]&#92;&#48;02 $os&quot;);
	Xchat::EAT_ALL;
}

sub bw {
	$old = `cat /proc/net/dev | grep $eth | cut -d &quot;:&quot; -f 2 | tr -s &quot; &quot;| cut -d &quot; &quot; -f 1,9`;
	sleep(1);
	$new = `cat /proc/net/dev | grep $eth | cut -d &quot;:&quot; -f 2 | tr -s &quot; &quot;| cut -d &quot; &quot; -f 1,9`;
	@ary_old = split(/\s/, $old);
	@ary_new = split(/\s/, $new);
	$down = $ary_new[0] - $ary_old[0];
	$up = $ary_new[1] - $ary_old[1];
	$bw = &quot;&quot;;
	if($down &lt; 1000) {
		$bw .= $down . &quot; B/s Down &quot;;
	} else {
		$bw .= sprintf(&quot;%.02f&quot;, $down / 1000) . &quot; KB/s Down &quot;;
	}
	if($up &lt; 1000) {
		$bw .= $up . &quot; B/s Up&quot;;
	} else {
		$bw .= sprintf(&quot;%.02f&quot;, $up / 1000) . &quot; KB/s Up&quot;;
	}
	Xchat::command(&quot;SAY &#92;&#48;02[BW]&#92;&#48;02 $bw&quot;);
	Xchat::EAT_ALL;
}

sub cpu {
	$model_name = `cat /proc/cpuinfo | grep &quot;model name&quot; | tail -1 | cut -d &quot;:&quot; -f 2 | tr -s &quot; &quot;`;
	$number_cores = `cat /proc/cpuinfo | grep &quot;model name&quot; -c`;
	$freq = `cat /proc/cpuinfo | grep &quot;cpu MHz&quot; | tail -1 | cut -d &quot;:&quot; -f 2 | tr -s &quot; &quot;`;
	$idle = `vmstat | tail -1 | awk '{printf \$15}'`;
	$load = 100 - $idle;
	chomp($model_name);
	chomp($number_cores);
	chomp($freq);
	$cpuinfo = $number_cores . &quot; CPU&quot;;
	if($number_cores &gt; 1) {
		$cpuinfo .= &quot;'s&quot;;
	}
	$cpuinfo .= &quot; -&quot; . $model_name;
	$cpuinfo .= &quot; @ &quot; . int($freq) . &quot; MHz&quot; . &quot; (&quot; . $load . &quot;% Load)&quot;;
	Xchat::command(&quot;SAY &#92;&#48;02[CPU]&#92;&#48;02 $cpuinfo&quot;);
	Xchat:EAT_ALL;
}

sub mem {
	$mem_total = `free -m | grep Mem | awk '{printf \$2}'`;
	$mem_used = `free -m | grep - | awk '{printf \$3}'`;
	$swap_total = `free -m| grep Swap | awk '{printf \$2}'`;
	$swap_used = `free -m| grep Swap | awk '{printf \$3}'`;
	$meminfo = &quot;&#92;&#48;02[MEM]&#92;&#48;02 &quot; . $mem_used . &quot;/&quot; . $mem_total . &quot; MB &#92;&#48;02[SWAP]&#92;&#48;02 &quot; . $swap_used . &quot;/&quot; . $swap_total . &quot; MB&quot;;
	Xchat::command(&quot;SAY $meminfo&quot;);
	Xchat::EAT_ALL;
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://phill84.org/2009/08/sysinfo-plugin-for-xchat2-on-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>X-Chat Last.fm plugin</title>
		<link>http://phill84.org/2009/03/x-chat-lastfm-plugin/</link>
		<comments>http://phill84.org/2009/03/x-chat-lastfm-plugin/#comments</comments>
		<pubDate>Mon, 09 Mar 2009 16:08:06 +0000</pubDate>
		<dc:creator>phill84</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[last.fm]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[xchat]]></category>

		<guid isPermaLink="false">http://phill84.org/2009/03/x-chat-lastfm-plugin/</guid>
		<description><![CDATA[上班無聊隨便寫了個&#8230;. This plugin can retrieve the most recent 10 updates from your personal rss on last.fm, please notice that there is delay for the rss to get updated. ## Use Modules ## use XML::Simple; use LWP::Simple; &#160; ## last.fm home &#8230; <a href="http://phill84.org/2009/03/x-chat-lastfm-plugin/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>上班無聊隨便寫了個&#8230;.</p>
<p>This plugin can retrieve the most recent 10 updates from your personal rss on last.fm, please notice that there is delay for the rss to get updated.<span id="more-561"></span></p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">## 	Use Modules 			##</span>
<span style="color: #000000; font-weight: bold;">use</span> XML<span style="color: #339933;">::</span><span style="color: #006600;">Simple</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">use</span> LWP<span style="color: #339933;">::</span><span style="color: #006600;">Simple</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">## 	last.fm home address 	##</span>
<span style="color: #666666; font-style: italic;">## 	change to your own 		##</span>
<span style="color: #0000ff;">$home</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;http://www.last.fm/user/jiening&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">## 	last.fm feed rss 		##</span>
<span style="color: #666666; font-style: italic;">## 	change to your own 		##</span>
<span style="color: #0000ff;">$url</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;http://ws.audioscrobbler.com/1.0/user/jiening/recenttracks.rss&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">##	Registering The Script 	##</span>
<span style="color: #666666; font-style: italic;">##	and Commands 			##</span>
Xchat<span style="color: #339933;">::</span><span style="color: #006600;">register</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;LastFM&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;0.1&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;A Script to display the latest song listed on your last.fm&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
Xchat<span style="color: #339933;">::</span><span style="color: #006600;">hook_command</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;lastfm&quot;</span><span style="color: #339933;">,</span> lastfm<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
Xchat<span style="color: #339933;">::</span><span style="color: #006600;">hook_command</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;lasthelp&quot;</span><span style="color: #339933;">,</span> lasthelp<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;">## 	Text to print when		## </span>
<span style="color: #666666; font-style: italic;">##	the script is loaded 	## </span>
<span style="color: #000000; font-weight: bold;">sub</span> lastfm_load <span style="color: #009900;">&#123;</span> 
	Xchat<span style="color: #339933;">::</span><span style="color: #006600;">command</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;ECHO ---&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	Xchat<span style="color: #339933;">::</span><span style="color: #006600;">command</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;ECHO LastFM 1.0 by Phill84 loaded&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	Xchat<span style="color: #339933;">::</span><span style="color: #006600;">command</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;ECHO For HELP type /lasthelp&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	Xchat<span style="color: #339933;">::</span><span style="color: #006600;">command</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;ECHO ---&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000066;">return</span> Xchat<span style="color: #339933;">::</span><span style="color: #006600;">EAT_NONE</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
lastfm_load<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">## 	Help 					##</span>
<span style="color: #000000; font-weight: bold;">sub</span> lasthelp <span style="color: #009900;">&#123;</span>
	Xchat<span style="color: #339933;">::</span><span style="color: #006600;">command</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;ECHO ---&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	Xchat<span style="color: #339933;">::</span><span style="color: #006600;">command</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;ECHO just type /lastfm, what's so difficult about it?&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	Xchat<span style="color: #339933;">::</span><span style="color: #006600;">command</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;ECHO ---&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000066;">return</span> Xchat<span style="color: #339933;">::</span><span style="color: #006600;">EAT_NONE</span><span style="color: #339933;">;</span>	
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">## 	Main function 			##</span>
<span style="color: #000000; font-weight: bold;">sub</span> lastfm <span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$xml</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> XML<span style="color: #339933;">::</span><span style="color: #006600;">Simple</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$content</span> <span style="color: #339933;">=</span> get<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$url</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #0000ff;">$content</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		Xchat<span style="color: #339933;">::</span><span style="color: #006600;">command</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;ECHO Could not retrieve $url&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000066;">return</span> Xchat<span style="color: #339933;">::</span><span style="color: #006600;">EAT_NONE</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$rss</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$xml</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">XMLin</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$content</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		Xchat<span style="color: #339933;">::</span><span style="color: #006600;">command</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;SAY 10 recent updates on $home&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$i</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <span style="color: #0000ff;">$i</span> <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">10</span><span style="color: #339933;">;</span> <span style="color: #0000ff;">$i</span> <span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$title</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$rss</span><span style="color: #339933;">-&gt;</span><span style="color: #009900;">&#123;</span>channel<span style="color: #009900;">&#125;</span><span style="color: #339933;">-&gt;</span><span style="color: #009900;">&#123;</span>item<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">-&gt;</span><span style="color: #009900;">&#123;</span>title<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$date</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$rss</span><span style="color: #339933;">-&gt;</span><span style="color: #009900;">&#123;</span>channel<span style="color: #009900;">&#125;</span><span style="color: #339933;">-&gt;</span><span style="color: #009900;">&#123;</span>item<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">-&gt;</span><span style="color: #009900;">&#123;</span>pubDate<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
			<span style="color: #0000ff;">$date</span> <span style="color: #339933;">=~</span> <span style="color: #009966; font-style: italic;">s/\+0000//</span><span style="color: #339933;">;</span>
			Xchat<span style="color: #339933;">::</span><span style="color: #006600;">command</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;SAY $title - $date&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000066;">return</span> Xchat<span style="color: #339933;">::</span><span style="color: #006600;">EAT_NONE</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

Note: There is a file embedded within this post, please visit this post to download the file.
]]></content:encoded>
			<wfw:commentRss>http://phill84.org/2009/03/x-chat-lastfm-plugin/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>xchat 2.8.4 cvs 20050524</title>
		<link>http://phill84.org/2008/06/xchat-284-cvs-20050524/</link>
		<comments>http://phill84.org/2008/06/xchat-284-cvs-20050524/#comments</comments>
		<pubDate>Sat, 07 Jun 2008 08:05:07 +0000</pubDate>
		<dc:creator>phill84</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[2.8.4]]></category>
		<category><![CDATA[cvs]]></category>
		<category><![CDATA[deb]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[xchat]]></category>
		<category><![CDATA[xchat2]]></category>

		<guid isPermaLink="false">http://phill84.org/?p=78</guid>
		<description><![CDATA[Compiled: Jun  7 2008]]></description>
			<content:encoded><![CDATA[<p>Compiled: Jun  7 2008</p>
Note: There is a file embedded within this post, please visit this post to download the file.
]]></content:encoded>
			<wfw:commentRss>http://phill84.org/2008/06/xchat-284-cvs-20050524/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

