{"id":10,"date":"2012-03-01T13:28:00","date_gmt":"2012-03-01T13:28:00","guid":{"rendered":"http:\/\/speaking-code.net\/?page_id=10"},"modified":"2014-06-07T06:25:17","modified_gmt":"2014-06-07T06:25:17","slug":"code","status":"publish","type":"page","link":"https:\/\/speaking-code.lurk.org\/?page_id=10","title":{"rendered":"Code"},"content":{"rendered":"<p>Here are some code examples from the book, written by\u00a0<a href=\"http:\/\/www.slab.org\">Alex McLean<\/a>. \u00a0<\/p>\n<p><strong>&gt; hello-network.py<\/strong><\/p>\n<p><code>#!\/usr\/bin\/python<br \/>\n# A script for greeting every server on the Internet.<br \/>\nimport iptools, httplib<br \/>\nfor ip in iptools.IpRangeList('0.0.0.0\/0'):<br \/>\ntry:<br \/>\nprint \"Greeting \" + ip<br \/>\ncx = httplib.HTTPConnection(\"%s:80\" % ip)<br \/>\ncx.request(\"POST\", '\/', \"message=Hello+world!\")<br \/>\nexcept:<br \/>\npass<\/code><\/p>\n<p>You can find a video of Franco Bifo Berardi reading this script at <a href=\"http:\/\/vimeo.com\/48294959\">http:\/\/vimeo.com\/48294959<\/a>. <\/p>\n<hr>\n<p><strong>&gt; interpellate.pl<\/strong><\/p>\n<p><code>#!\/usr\/bin\/perl<br \/>\nuse Graph::Easy;<br \/>\nmy $g = Graph::Easy-&gt;new();<br \/>\n@ids = (0 .. 15);<br \/>\n$ids[rand(@ids)] = 'you';<br \/>\nforeach $id (0 .. $#ids) {<br \/>\n$to = rand(@ids) - 1;<br \/>\n$to++ if ($to &gt;= $id);<br \/>\n$g-&gt;add_edge($ids[$id], $ids[$to]);<br \/>\n}<br \/>\nprint($g-&gt;as_ascii . \"Hey, you there.\\n\");<\/code><\/p>\n<hr>\n<p><strong>&gt; ungovernable.patch<\/strong><\/p>\n<p><code># (c) 2011 Alex McLean, released under the GPL version 2<br \/>\ndiff -uNr linux.vanilla\/drivers\/cpufreq\/cpufreq_ondemand.c linux.new\/drivers\/cpufreq\/cpufreq_ondemand.c<br \/>\n--- linux.vanilla\/drivers\/cpufreq\/cpufreq_ondemand.c 2011-11-21 22:47:46.000000000 +0000<br \/>\n+++ linux.new\/drivers\/cpufreq\/cpufreq_ondemand.c 2011-12-03 15:22:50.649318547 +0000<br \/>\n@@ -494,7 +494,7 @@<br \/>\n}<\/code><br \/>\n<code><br \/>\n\/* Check for frequency increase *\/<br \/>\n- if (max_load_freq &gt; dbs_tuners_ins.up_threshold * policy-&gt;cur) {<br \/>\n+ if (max_load_freq cur) {<br \/>\n\/* If switching to max speed, apply sampling_down_factor *\/<br \/>\nif (policy-&gt;cur &lt; policy-&gt;max)<br \/>\nthis_dbs_info-&gt;rate_mult =<br \/>\n@@ -513,7 +513,7 @@<br \/>\n* can support the current CPU usage without triggering the up<br \/>\n* policy. To be safe, we focus 10 points under the threshold.<br \/>\n*\/<br \/>\n- if (max_load_freq &lt;<br \/>\n+ if (max_load_freq &gt;=<br \/>\n(dbs_tuners_ins.up_threshold - dbs_tuners_ins.down_differential) *<br \/>\npolicy-&gt;cur) {<br \/>\nunsigned int freq_next;<br \/>\n<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here are some code examples from the book, written by\u00a0Alex McLean. \u00a0 &gt; hello-network.py #!\/usr\/bin\/python # A script for greeting every server on the Internet. import iptools, httplib for ip in iptools.IpRangeList(&#8216;0.0.0.0\/0&#8217;): try: print &#8220;Greeting &#8221; + ip cx = httplib.HTTPConnection(&#8220;%s:80&#8221; % ip) cx.request(&#8220;POST&#8221;, &#8216;\/&#8217;, &#8220;message=Hello+world!&#8221;) except: pass You can find a video of Franco [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"open","ping_status":"open","template":"","meta":{"spay_email":""},"jetpack_shortlink":"https:\/\/wp.me\/P2UJau-a","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/speaking-code.lurk.org\/index.php?rest_route=\/wp\/v2\/pages\/10"}],"collection":[{"href":"https:\/\/speaking-code.lurk.org\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/speaking-code.lurk.org\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/speaking-code.lurk.org\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/speaking-code.lurk.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10"}],"version-history":[{"count":22,"href":"https:\/\/speaking-code.lurk.org\/index.php?rest_route=\/wp\/v2\/pages\/10\/revisions"}],"predecessor-version":[{"id":220,"href":"https:\/\/speaking-code.lurk.org\/index.php?rest_route=\/wp\/v2\/pages\/10\/revisions\/220"}],"wp:attachment":[{"href":"https:\/\/speaking-code.lurk.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}