<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/7081" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2004-03-18T08:02:29-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/7081</id>

		<entry>
		<author><name><![CDATA[Ofloo]]></name></author>
		<updated>2004-03-18T08:02:29-04:00</updated>

		<published>2004-03-18T08:02:29-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=34740#p34740</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=34740#p34740"/>
		<title type="html"><![CDATA[Is there a place where i can post snippe scripts..?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=34740#p34740"><![CDATA[
<blockquote class="uncited"><div>1 kB is 2^10 bytes (1024) </div></blockquote>right wasn't sur it was applyed for bandwith as well but now u mention it makes sence..<br><blockquote class="uncited"><div>That's NOT the way to create an endless loop in tcl. You're doing recursive calls and there's a limit to the number of nested calls, so your code will eventually generate an error. <br>Use something like this instead: </div></blockquote>tnx for the tip<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3151">Ofloo</a> — Thu Mar 18, 2004 8:02 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2004-03-17T07:38:44-04:00</updated>

		<published>2004-03-17T07:38:44-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=34710#p34710</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=34710#p34710"/>
		<title type="html"><![CDATA[Re: Is there a place where i can post snippe scripts..?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=34710#p34710"><![CDATA[
<blockquote class="uncited"><div><div class="codebox"><p>Code: </p><pre><code>proc speedcheck {} {  ...  after 1000  speedcheck}</code></pre></div></div></blockquote>That's NOT the way to create an endless loop in tcl. You're doing recursive calls and there's a limit to the number of nested calls, so your code will eventually generate an error.<br>Use something like this instead:<div class="codebox"><p>Code: </p><pre><code>proc continous_speedcheck {} {while 1 {speedcheckafter 1000}}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2878">user</a> — Wed Mar 17, 2004 7:38 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[spock]]></name></author>
		<updated>2004-03-16T13:23:42-04:00</updated>

		<published>2004-03-16T13:23:42-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=34676#p34676</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=34676#p34676"/>
		<title type="html"><![CDATA[Is there a place where i can post snippe scripts..?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=34676#p34676"><![CDATA[
1 kB is 2^10 bytes (1024)<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2369">spock</a> — Tue Mar 16, 2004 1:23 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Ofloo]]></name></author>
		<updated>2004-03-16T10:39:58-04:00</updated>

		<published>2004-03-16T10:39:58-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=34673#p34673</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=34673#p34673"/>
		<title type="html"><![CDATA[Is there a place where i can post snippe scripts..?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=34673#p34673"><![CDATA[
Sorry not sur where to post snippes or whatever there called sample scripts .. <br><br>this script shows u how u can read the incomming and out going speed on ur linux box maybe usefull to show in channel when u ask stats like this u can make an average speed or something .. or mrtg .. change ppp0 to eth0 or eth1 .. what ever you prefer ..<br><br>Constant readout<br><div class="codebox"><p>Code: </p><pre><code>#!/usr/bin/tclshproc speedcheck {} {  global gouttraf ginctraf  set cache [open "/proc/net/dev" "r"]  set rfile [read $cache]  close $cache  foreach line [split $rfile "\n"] {    if {[string match -nocase "ppp0" [lindex [split [lindex $line 0] \x3A] 0]]} {      set inctraf [lindex [split [lindex $line 0] \x3A] 1]      set outtraf [lindex $line 8]    }  }  if {![info exists ginctraf]} {    set ginctraf "$inctraf"  }  if {![info exists gouttraf]} {    set gouttraf "$outtraf"  }  if {[info exists gouttraf] &amp;&amp; [info exists ginctraf]} {    set sinctraf [expr [expr $inctraf-$ginctraf]/1000]    set souttraf [expr [expr $outtraf-$gouttraf]/1000]    set gouttraf "$outtraf"    set ginctraf "$inctraf"    puts "Incoming $sinctraf kb/s"    puts "Outgoing $souttraf kb/s"  }  after 1000  speedcheck}speedcheck</code></pre></div>Read only once<br><div class="codebox"><p>Code: </p><pre><code>#!/usr/bin/tclshproc speedcheck {} {  foreach line [split [exec "/bin/cat" "/proc/net/dev"] "\n"] {    if {[string match -nocase "ppp0" [lindex [split [lindex $line 0] \x3A] 0]]} {      set ginctraf [lindex [split [lindex $line 0] \x3A] 1]      set gouttraf [lindex $line 8]    }  }  after 500  foreach line [split [exec "/bin/cat" "/proc/net/dev"] "\n"] {    if {[string match -nocase "ppp0" [lindex [split [lindex $line 0] \x3A] 0]]} {      set inctraf [lindex [split [lindex $line 0] \x3A] 1]      set outtraf [lindex $line 8]    }  }  set sinctraf [expr [expr $inctraf-$ginctraf]/500.0]  set souttraf [expr [expr $outtraf-$gouttraf]/500.0]  puts "Incoming: $sinctraf kb/s"  puts "Outgoing: $souttraf kb/s"}speedcheck</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3151">Ofloo</a> — Tue Mar 16, 2004 10:39 am</p><hr />
]]></content>
	</entry>
	</feed>
