<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" gd:etag="W/&quot;CUcMR3kzeCp7ImA9WhdXF00.&quot;"><id>tag:blogger.com,1999:blog-6009132216257803808</id><updated>2011-08-30T13:18:06.780+02:00</updated><category term="tetris" /><category term="psexec" /><category term="msdn" /><category term="wrt54gl" /><category term="proxy" /><category term="javascript" /><category term="lists" /><category term="ping" /><category term="snake" /><category term="projects" /><category term="youtube" /><category term="ip" /><category term="arkanoid" /><category term="wireless networks" /><category term="powershell" /><category term="python" /><category term="classic game" /><category term="kris cieslak" /><category term="video" /><category term="windows" /><category term="code" /><category term="hdaps" /><category term="scripts" /><category term="linux" /><category term="personal" /><category term="kamikaze" /><category term="netsh" /><category term="knowledge base" /><category term="arrays" /><category term="security" /><category term="nmap" /><category term="games" /><category term="digitalinsane.com" /><category term="game" /><category term="bash" /><category term="linksys" /><category term="nping" /><category term="visual studio" /><category term="thinkpad" /><category term="virtual labs" /><category term="list comprehensions" /><category term="openwrt" /><category term="backfire" /><category term="microsoft" /><category term="pstools" /><category term="com object" /><category term="ubuntu" /><category term="event log" /><category term="iptables" /><category term="cpp" /><category term="port scanning" /><category term="videoo" /><title>./defaultset</title><subtitle type="html">{ Programming, scripting and other fun stuff }</subtitle><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://defaultset.blogspot.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://defaultset.blogspot.com/" /><author><name>Kris Cieslak</name><uri>http://www.blogger.com/profile/03070399087643391214</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>25</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/defaultset" /><feedburner:info uri="defaultset" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:browserFriendly></feedburner:browserFriendly><entry gd:etag="W/&quot;CUcGSXcyeip7ImA9Wx5TGUk.&quot;"><id>tag:blogger.com,1999:blog-6009132216257803808.post-6665640591550672883</id><published>2010-08-04T18:32:00.004+02:00</published><updated>2010-08-04T19:30:28.992+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-08-04T19:30:28.992+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="python" /><category scheme="http://www.blogger.com/atom/ns#" term="code" /><title>Inline csv to list loader (not recommended) - Python</title><content type="html">This is a nice trick that once again shows the power of Python. But I do not recommend to use this solution in a regular programming or at least check for any errors while opening a file.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Example 1&lt;/span&gt; - &lt;br /&gt;csv file (test1.csv):&lt;br /&gt;&lt;code&gt;&lt;br /&gt;line 1 field 1,line 1 field 2,line 1 field 3,line 1 field 4&lt;br /&gt;line 2 field 1,line 2 field 2,line 2 field 3,line 2 field 4&lt;br /&gt;line 3 field 1,line 3 field 2,line 3 field 3,line 3 field 4&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;loading as a list &lt;br /&gt;&lt;code&gt;&lt;br /&gt;import re&lt;br /&gt;&lt;br /&gt;csv = [ re.split(",",l) for l in re.split("\n",open("test1.csv").read()) ]&lt;br /&gt;print csv&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;result&lt;br /&gt;&lt;code&gt;&lt;br /&gt;[&lt;br /&gt;   ['line 1 field 1', 'line 1 field 2', 'line 1 field 3', 'line 1 field 4'], &lt;br /&gt;   ['line 2 field 1', 'line 2 field 2', 'line 2 field 3', 'line 2 field 4'], &lt;br /&gt;   ['line 3 field 1', 'line 3 field 2', 'line 3 field 3', 'line 3 field 4']&lt;br /&gt;]&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Example 2&lt;/span&gt; - &lt;br /&gt;csv file (test2.csv):&lt;br /&gt;&lt;code&gt;&lt;br /&gt;"line 1,field 1","line 1,field 2","line 1,field 3","line 1,field 4"&lt;br /&gt;"line 2,field 1","line 2,field 2","line 2,field 3","line 2,field 4"&lt;br /&gt;"line 3,field 1","line 3,field 2","line 3,field 3","line 3,field 4"&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;loading as a list:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;import re&lt;br /&gt;&lt;br /&gt;csv = [ re.findall('"[^"]+"',l) for l in re.split("\n",open("test2.csv").read()) ]&lt;br /&gt;print csv&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;result&lt;br /&gt;&lt;code&gt;&lt;br /&gt;[&lt;br /&gt;['"line 1,field 1"', '"line 1,field 2"', '"line 1,field 3"', '"line 1,field 4"'],&lt;br /&gt;['"line 2,field 1"', '"line 2,field 2"', '"line 2,field 3"', '"line 2,field 4"'], &lt;br /&gt;['"line 3,field 1"', '"line 3,field 2"', '"line 3,field 3"', '"line 3,field 4"']&lt;br /&gt;]&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Example 3&lt;/span&gt;&lt;br /&gt;and instruction that will handle all two files:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;import re&lt;br /&gt;&lt;br /&gt;csv = [ re.findall('"[^"]+"',l) if re.match("\"",l) else re.split(",",l) for l in re.split("\n",open("test2.csv").read()) ]&lt;br /&gt;print csv&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;result are the same like in example 1 or 2.&lt;br /&gt;&lt;br /&gt;Any questions and suggestions are welcome.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6009132216257803808-6665640591550672883?l=defaultset.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://defaultset.blogspot.com/feeds/6665640591550672883/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://defaultset.blogspot.com/2010/08/inline-csv-to-list-loader-not.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6009132216257803808/posts/default/6665640591550672883?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6009132216257803808/posts/default/6665640591550672883?v=2" /><link rel="alternate" type="text/html" href="http://defaultset.blogspot.com/2010/08/inline-csv-to-list-loader-not.html" title="Inline csv to list loader (not recommended) - Python" /><author><name>Kris Cieslak</name><uri>http://www.blogger.com/profile/03070399087643391214</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;C0cDQHY4cCp7ImA9WxFbGE4.&quot;"><id>tag:blogger.com,1999:blog-6009132216257803808.post-1849426324122242779</id><published>2010-07-11T08:47:00.002+02:00</published><updated>2010-07-11T08:51:11.838+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-07-11T08:51:11.838+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="python" /><category scheme="http://www.blogger.com/atom/ns#" term="videoo" /><category scheme="http://www.blogger.com/atom/ns#" term="classic game" /><category scheme="http://www.blogger.com/atom/ns#" term="arkanoid" /><title>Video - Arkanoid in 11 or 34 lines of code.</title><content type="html">Promotion video. See previous post for more details.&lt;br /&gt;Music: Talking Droids.&lt;br /&gt;Watch in HD!&lt;br /&gt;&lt;br /&gt;&lt;object width="580" height="360"&gt;&lt;param name="movie" value="http://www.youtube.com/v/TBKMsgasZAk&amp;amp;hl=en_US&amp;amp;fs=1?rel=0&amp;amp;hd=1&amp;amp;border=1"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/TBKMsgasZAk&amp;amp;hl=en_US&amp;amp;fs=1?rel=0&amp;amp;hd=1&amp;amp;border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="580" height="360"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6009132216257803808-1849426324122242779?l=defaultset.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://defaultset.blogspot.com/feeds/1849426324122242779/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://defaultset.blogspot.com/2010/07/video-arkanoid-in-11-or-34-lines-of.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6009132216257803808/posts/default/1849426324122242779?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6009132216257803808/posts/default/1849426324122242779?v=2" /><link rel="alternate" type="text/html" href="http://defaultset.blogspot.com/2010/07/video-arkanoid-in-11-or-34-lines-of.html" title="Video - Arkanoid in 11 or 34 lines of code." /><author><name>Kris Cieslak</name><uri>http://www.blogger.com/profile/03070399087643391214</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>1</thr:total></entry><entry gd:etag="W/&quot;DU4MRnY-fSp7ImA9WxFbF0k.&quot;"><id>tag:blogger.com,1999:blog-6009132216257803808.post-3930261665408488964</id><published>2010-07-10T09:32:00.004+02:00</published><updated>2010-07-10T09:46:27.855+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-07-10T09:46:27.855+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="python" /><category scheme="http://www.blogger.com/atom/ns#" term="code" /><category scheme="http://www.blogger.com/atom/ns#" term="classic game" /><category scheme="http://www.blogger.com/atom/ns#" term="arkanoid" /><title>Python - Arkanoid in 11 or 34 lines of code.</title><content type="html">And another classic game written in Python, this time Arkanoid (Breakout).Of course code is highly optimized for size and only standard modules are used.&lt;br /&gt;&lt;br /&gt;Standard version: &lt;a href="http://paste.pocoo.org/show/235669/" target="_blank"&gt;34 lines&lt;/a&gt;&lt;br /&gt;Short version (same code): &lt;a href="http://paste.pocoo.org/show/235670/" target="_blank"&gt;11 lines&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Download: &lt;a href="http://arkanoid3411l.googlecode.com/files/arkanoid3411l.tar.bz2"&gt;arkanoid3411l.tar.bz2&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Lx7GGL0U3cI/TDglF8v0-MI/AAAAAAAAAWc/9Erca56RNLQ/s1600/arkanoid.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 158px; height: 200px;" src="http://2.bp.blogspot.com/_Lx7GGL0U3cI/TDglF8v0-MI/AAAAAAAAAWc/9Erca56RNLQ/s200/arkanoid.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5492180529714624706" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6009132216257803808-3930261665408488964?l=defaultset.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://defaultset.blogspot.com/feeds/3930261665408488964/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://defaultset.blogspot.com/2010/07/python-arkanoid-in-11-or-34-lines-of.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6009132216257803808/posts/default/3930261665408488964?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6009132216257803808/posts/default/3930261665408488964?v=2" /><link rel="alternate" type="text/html" href="http://defaultset.blogspot.com/2010/07/python-arkanoid-in-11-or-34-lines-of.html" title="Python - Arkanoid in 11 or 34 lines of code." /><author><name>Kris Cieslak</name><uri>http://www.blogger.com/profile/03070399087643391214</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/_Lx7GGL0U3cI/TDglF8v0-MI/AAAAAAAAAWc/9Erca56RNLQ/s72-c/arkanoid.png" height="72" width="72" /><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;D0YFSXw4fyp7ImA9WxFbEk4.&quot;"><id>tag:blogger.com,1999:blog-6009132216257803808.post-8257261955447276798</id><published>2010-07-04T10:31:00.003+02:00</published><updated>2010-07-04T11:18:38.237+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-07-04T11:18:38.237+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="javascript" /><category scheme="http://www.blogger.com/atom/ns#" term="projects" /><category scheme="http://www.blogger.com/atom/ns#" term="games" /><category scheme="http://www.blogger.com/atom/ns#" term="kris cieslak" /><category scheme="http://www.blogger.com/atom/ns#" term="digitalinsane.com" /><title>digitalinsane.com is back</title><content type="html">New look, new/old like style - &lt;a href="http://digitalinsane.com" targer="_blank"&gt;digitalinsane.com&lt;/a&gt;. Now, it's some kind of my project portfolio rather than regular blog. Also, old links to my javascript games has been changed, previous are still available but it is only redirections to the new ones. &lt;br /&gt;&lt;br /&gt;New links:&lt;br /&gt;&lt;a href="http://digitalinsane.com/games/pacman"&gt;Pacman&lt;/a&gt;&lt;br /&gt;&lt;a href="http://digitalinsane.com/games/solitaire"&gt;Solitaire&lt;/a&gt;&lt;br /&gt;&lt;a href="http://digitalinsane.com/games/space-invaders"&gt;Space-Invaders&lt;/a&gt;&lt;br /&gt;&lt;a href="http://digitalinsane.com/games/puzzle"&gt;Puzzle&lt;/a&gt; now it's working!&lt;br /&gt;&lt;a href="http://digitalinsane.com/games/yetris"&gt;Yetris&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Enjoy!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6009132216257803808-8257261955447276798?l=defaultset.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://defaultset.blogspot.com/feeds/8257261955447276798/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://defaultset.blogspot.com/2010/07/digitalinsanecom-is-back.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6009132216257803808/posts/default/8257261955447276798?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6009132216257803808/posts/default/8257261955447276798?v=2" /><link rel="alternate" type="text/html" href="http://defaultset.blogspot.com/2010/07/digitalinsanecom-is-back.html" title="digitalinsane.com is back" /><author><name>Kris Cieslak</name><uri>http://www.blogger.com/profile/03070399087643391214</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;CEIHRnw7fip7ImA9WxFVFEs.&quot;"><id>tag:blogger.com,1999:blog-6009132216257803808.post-8305229241993301195</id><published>2010-06-13T22:42:00.004+02:00</published><updated>2010-06-13T22:55:37.206+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-06-13T22:55:37.206+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="video" /><category scheme="http://www.blogger.com/atom/ns#" term="python" /><category scheme="http://www.blogger.com/atom/ns#" term="code" /><category scheme="http://www.blogger.com/atom/ns#" term="game" /><title>VIDEO - SNAKE game in 26/15 lines of PYTHON code</title><content type="html">Promotion video. See previous post for more details.&lt;br /&gt;Watch in HD!&lt;br /&gt;&lt;br /&gt;&lt;object width="580" height="360"&gt;&lt;param name="movie" value="http://www.youtube.com/v/Bj-H9uPEa5U&amp;hl=en_US&amp;fs=1&amp;border=1"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/Bj-H9uPEa5U&amp;hl=en_US&amp;fs=1&amp;border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="580" height="360"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6009132216257803808-8305229241993301195?l=defaultset.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://defaultset.blogspot.com/feeds/8305229241993301195/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://defaultset.blogspot.com/2010/06/video-snake-game-in-2615-lines-of.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6009132216257803808/posts/default/8305229241993301195?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6009132216257803808/posts/default/8305229241993301195?v=2" /><link rel="alternate" type="text/html" href="http://defaultset.blogspot.com/2010/06/video-snake-game-in-2615-lines-of.html" title="VIDEO - SNAKE game in 26/15 lines of PYTHON code" /><author><name>Kris Cieslak</name><uri>http://www.blogger.com/profile/03070399087643391214</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;DEUCQHszeSp7ImA9WxFWGEg.&quot;"><id>tag:blogger.com,1999:blog-6009132216257803808.post-7080013212291804525</id><published>2010-06-06T09:04:00.009+02:00</published><updated>2010-06-06T22:31:01.581+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-06-06T22:31:01.581+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="scripts" /><category scheme="http://www.blogger.com/atom/ns#" term="snake" /><category scheme="http://www.blogger.com/atom/ns#" term="linux" /><category scheme="http://www.blogger.com/atom/ns#" term="python" /><category scheme="http://www.blogger.com/atom/ns#" term="code" /><category scheme="http://www.blogger.com/atom/ns#" term="game" /><title>Python - Snake game in 15 or 26 lines of code.</title><content type="html">This time fully functional Snake game written in Python 2.6.5 (linux / text-mode). The code is highly optimized for size / only standard modules are used.&lt;br /&gt;&lt;br /&gt;Standard version: &lt;a href="http://paste.pocoo.org/show/222646/"&gt;26 lines&lt;/a&gt;&lt;br /&gt;Short version (same code): &lt;a href="http://paste.pocoo.org/show/222648/"&gt;15 lines&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Download: &lt;a href="http://code.google.com/p/snake-1526l/downloads/detail?name=snake2615l.tar.bz2"&gt;snake2615l.tar.bz2&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Lx7GGL0U3cI/TAtLc03B4ZI/AAAAAAAAAVk/iI_oeVZr4Rw/s1600/snakePY.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 200px; height: 132px;" src="http://2.bp.blogspot.com/_Lx7GGL0U3cI/TAtLc03B4ZI/AAAAAAAAAVk/iI_oeVZr4Rw/s200/snakePY.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5479556330224214418" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Lx7GGL0U3cI/TAtLlNP5ixI/AAAAAAAAAVs/Kc9HcDGbGo8/s1600/snake15l.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 200px; height: 140px;" src="http://3.bp.blogspot.com/_Lx7GGL0U3cI/TAtLlNP5ixI/AAAAAAAAAVs/Kc9HcDGbGo8/s200/snake15l.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5479556474209930002" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Lx7GGL0U3cI/TAtLxBdf53I/AAAAAAAAAV0/M6QYFiyXCCA/s1600/snake26l.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 200px; height: 140px;" src="http://1.bp.blogspot.com/_Lx7GGL0U3cI/TAtLxBdf53I/AAAAAAAAAV0/M6QYFiyXCCA/s200/snake26l.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5479556677204174706" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6009132216257803808-7080013212291804525?l=defaultset.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://defaultset.blogspot.com/feeds/7080013212291804525/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://defaultset.blogspot.com/2010/06/python-snake-game-in-15-or-26-lines-of.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6009132216257803808/posts/default/7080013212291804525?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6009132216257803808/posts/default/7080013212291804525?v=2" /><link rel="alternate" type="text/html" href="http://defaultset.blogspot.com/2010/06/python-snake-game-in-15-or-26-lines-of.html" title="Python - Snake game in 15 or 26 lines of code." /><author><name>Kris Cieslak</name><uri>http://www.blogger.com/profile/03070399087643391214</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/_Lx7GGL0U3cI/TAtLc03B4ZI/AAAAAAAAAVk/iI_oeVZr4Rw/s72-c/snakePY.png" height="72" width="72" /><thr:total>1</thr:total></entry><entry gd:etag="W/&quot;AkUDSHk_cCp7ImA9WxFWFUo.&quot;"><id>tag:blogger.com,1999:blog-6009132216257803808.post-9100448977834150834</id><published>2010-06-03T17:10:00.003+02:00</published><updated>2010-06-03T17:17:59.748+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-06-03T17:17:59.748+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="video" /><category scheme="http://www.blogger.com/atom/ns#" term="tetris" /><category scheme="http://www.blogger.com/atom/ns#" term="python" /><title>VIDEO - Tetris in 50/28 lines of PYTHON code</title><content type="html">Promotion video for my Python Tetris game (super short code).Enjoy&lt;br /&gt;Watch in HD!&lt;br /&gt;&lt;br /&gt;&lt;object width="580" height="360"&gt;&lt;param name="movie" value="http://www.youtube.com/v/P76rnjmdIdU&amp;hl=en_US&amp;fs=1&amp;border=1"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/P76rnjmdIdU&amp;hl=en_US&amp;fs=1&amp;border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="580" height="360"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6009132216257803808-9100448977834150834?l=defaultset.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://defaultset.blogspot.com/feeds/9100448977834150834/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://defaultset.blogspot.com/2010/06/video-tetris-in-5028-lines-of-python.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6009132216257803808/posts/default/9100448977834150834?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6009132216257803808/posts/default/9100448977834150834?v=2" /><link rel="alternate" type="text/html" href="http://defaultset.blogspot.com/2010/06/video-tetris-in-5028-lines-of-python.html" title="VIDEO - Tetris in 50/28 lines of PYTHON code" /><author><name>Kris Cieslak</name><uri>http://www.blogger.com/profile/03070399087643391214</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;C0UHRHY6fCp7ImA9WxFWEk4.&quot;"><id>tag:blogger.com,1999:blog-6009132216257803808.post-6123913956358706075</id><published>2010-05-30T16:47:00.004+02:00</published><updated>2010-05-30T16:53:55.814+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-05-30T16:53:55.814+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="scripts" /><category scheme="http://www.blogger.com/atom/ns#" term="list comprehensions" /><category scheme="http://www.blogger.com/atom/ns#" term="python" /><category scheme="http://www.blogger.com/atom/ns#" term="code" /><category scheme="http://www.blogger.com/atom/ns#" term="arrays" /><category scheme="http://www.blogger.com/atom/ns#" term="lists" /><title>Python - fun with list comprehensions</title><content type="html">Jumping between dimensions or making lists from lists. &lt;br /&gt;The power of the inline loops.&lt;br /&gt;&lt;br /&gt;Suppose we have three-dimensional array:&lt;br /&gt;&lt;code&gt;d3 = [ [ [101,100], [99,98] ] , [ [97,96], [95,94] ]  ]&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Let's transform it into two-dimensional array&lt;br /&gt;&lt;code&gt;d2 = [ d3[a][b] for a in range(2) for b in range(len(d3)) ]&lt;/code&gt;&lt;br /&gt;Result:&lt;br /&gt;&lt;code&gt;[[101, 100], [99, 98], [97, 96], [95, 94]]&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;and into one-dimensional array:&lt;br /&gt;&lt;code&gt;d1 = [ d2[b][a] for b in range(len(d2)) for a in range(2) ]&lt;/code&gt;&lt;br /&gt;Result:&lt;br /&gt;&lt;code&gt;[101, 100, 99, 98, 97, 96, 95, 94]&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;We can also jump from 3d to 1d:&lt;br /&gt;&lt;code&gt;d1 = [ d3[a][b][c] for a in range(len(d3)) for b in range(2) for c in range(2) ] &lt;/code&gt;&lt;br /&gt;Result:&lt;br /&gt;&lt;code&gt;[101, 100, 99, 98, 97, 96, 95, 94]&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Now, let's do reverse transformation:&lt;br /&gt;From 1d to 2d:&lt;br /&gt;&lt;code&gt;d2 = [ [ d1[a+b] for b in range(2) ] for a in range(0,len(d1),2) ]&lt;/code&gt;&lt;br /&gt;Result:&lt;br /&gt;&lt;code&gt;[[101, 100], [99, 98], [97, 96], [95, 94]]&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;and from 2d to 3d:&lt;br /&gt;&lt;code&gt;d3 = [ [ d2[a+b] for b in range(2) ] for a in range(0,3,2) ]&lt;/code&gt;&lt;br /&gt;Result:&lt;br /&gt;&lt;code&gt;[[[101, 100], [99, 98]], [[97, 96], [95, 94]]]&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;And of course we can do far-jump from 1d to 3d:&lt;br /&gt;&lt;code&gt;d3 = [ [ [ d1[b+a+c] for c in range(2) ] for b in range(0,3,2) ] for a in range(0,5,4)]&lt;/code&gt;&lt;br /&gt;Result:&lt;br /&gt;&lt;code&gt;[[[101, 100], [99, 98]], [[97, 96], [95, 94]]]&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;More about list comprehensions:&lt;br /&gt;&lt;a href="http://docs.python.org/tutorial/datastructures.html#list-comprehensions"&gt;list-comprehensions&lt;/a&gt;&lt;br /&gt;&lt;a href="http://en.wikipedia.org/wiki/List_comprehension"&gt;wiki-list-comprehensions&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6009132216257803808-6123913956358706075?l=defaultset.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://defaultset.blogspot.com/feeds/6123913956358706075/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://defaultset.blogspot.com/2010/05/python-fun-with-list-comprehensions.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6009132216257803808/posts/default/6123913956358706075?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6009132216257803808/posts/default/6123913956358706075?v=2" /><link rel="alternate" type="text/html" href="http://defaultset.blogspot.com/2010/05/python-fun-with-list-comprehensions.html" title="Python - fun with list comprehensions" /><author><name>Kris Cieslak</name><uri>http://www.blogger.com/profile/03070399087643391214</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;D0ABSH8_eSp7ImA9WxFWEU4.&quot;"><id>tag:blogger.com,1999:blog-6009132216257803808.post-2579527149266812156</id><published>2010-05-29T11:38:00.005+02:00</published><updated>2010-05-29T14:22:39.141+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-05-29T14:22:39.141+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="scripts" /><category scheme="http://www.blogger.com/atom/ns#" term="powershell" /><category scheme="http://www.blogger.com/atom/ns#" term="windows" /><category scheme="http://www.blogger.com/atom/ns#" term="knowledge base" /><title>Powershell - Identifying knowledge base article by id number.</title><content type="html">This script may help you identify the Microsoft's installation file by getting the link and title of the knowledge base article that regard to that file. As the parameter you can use id number, file name or string with a number.&lt;br /&gt;&lt;br /&gt;&lt;script type="text/javascript" src="http://PoshCode.org/embed/1881"&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Example:&lt;/span&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Lx7GGL0U3cI/TAEETeNJcnI/AAAAAAAAAVc/s3Cmr8o2L_M/s1600/getkbinfo.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 200px; height: 83px;" src="http://2.bp.blogspot.com/_Lx7GGL0U3cI/TAEETeNJcnI/AAAAAAAAAVc/s3Cmr8o2L_M/s200/getkbinfo.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5476663354431468146" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6009132216257803808-2579527149266812156?l=defaultset.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://defaultset.blogspot.com/feeds/2579527149266812156/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://defaultset.blogspot.com/2010/05/powershell-identify-knowledge-base.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6009132216257803808/posts/default/2579527149266812156?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6009132216257803808/posts/default/2579527149266812156?v=2" /><link rel="alternate" type="text/html" href="http://defaultset.blogspot.com/2010/05/powershell-identify-knowledge-base.html" title="Powershell - Identifying knowledge base article by id number." /><author><name>Kris Cieslak</name><uri>http://www.blogger.com/profile/03070399087643391214</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/_Lx7GGL0U3cI/TAEETeNJcnI/AAAAAAAAAVc/s3Cmr8o2L_M/s72-c/getkbinfo.jpg" height="72" width="72" /><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;DkIAR3k8fSp7ImA9WxFXGUg.&quot;"><id>tag:blogger.com,1999:blog-6009132216257803808.post-3701805297887002282</id><published>2010-05-26T23:27:00.008+02:00</published><updated>2010-05-27T12:02:26.775+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-05-27T12:02:26.775+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="tetris" /><category scheme="http://www.blogger.com/atom/ns#" term="linux" /><category scheme="http://www.blogger.com/atom/ns#" term="python" /><category scheme="http://www.blogger.com/atom/ns#" term="code" /><category scheme="http://www.blogger.com/atom/ns#" term="game" /><title>Python - Tetris in 28 or 50 lines of code.</title><content type="html">Fully functional classic Tetris game written in Python 2.6.5 for Linux, text mode (curses module), only standard libraries.&lt;br /&gt;The code is highly optimized for size, not for performance or speed, it looks ogly and you shouldn't write your programs like that, it's only the proof of concept. &lt;br /&gt;&lt;br /&gt;Normal version: 50 lines&lt;br /&gt;Squeezed code: 28 lines&lt;br /&gt;&lt;br /&gt;Download: &lt;a href="http://tetris-2850l.googlecode.com/files/tetris2850l.tar.bz2"&gt;tetris2850l.tar.bz2&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Lx7GGL0U3cI/S_2ZYCoHXzI/AAAAAAAAAVE/3e0YsiOoQFk/s1600/s1.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:right;cursor:pointer; cursor:hand;width: 200px; height: 132px;" src="http://3.bp.blogspot.com/_Lx7GGL0U3cI/S_2ZYCoHXzI/AAAAAAAAAVE/3e0YsiOoQFk/s200/s1.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5475701360253427506" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Lx7GGL0U3cI/S_2bdkswXrI/AAAAAAAAAVU/ChekS837za4/s1600/tetris50l.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:right;cursor:pointer; cursor:hand;width: 200px; height: 140px;" src="http://2.bp.blogspot.com/_Lx7GGL0U3cI/S_2bdkswXrI/AAAAAAAAAVU/ChekS837za4/s200/tetris50l.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5475703654322298546" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Lx7GGL0U3cI/S_2bdcpt2dI/AAAAAAAAAVM/xs2CLOxAqNI/s1600/tetris28l.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:right;cursor:pointer; cursor:hand;width: 200px; height: 140px;" src="http://2.bp.blogspot.com/_Lx7GGL0U3cI/S_2bdcpt2dI/AAAAAAAAAVM/xs2CLOxAqNI/s200/tetris28l.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5475703652162066898" /&gt;&lt;/a&gt;&lt;br /&gt;If you have an idea how to make it even more shorter, please let me know by posting comments here.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6009132216257803808-3701805297887002282?l=defaultset.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://defaultset.blogspot.com/feeds/3701805297887002282/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://defaultset.blogspot.com/2010/05/python-tetris-in-28-or-50-lines-of-code.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6009132216257803808/posts/default/3701805297887002282?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6009132216257803808/posts/default/3701805297887002282?v=2" /><link rel="alternate" type="text/html" href="http://defaultset.blogspot.com/2010/05/python-tetris-in-28-or-50-lines-of-code.html" title="Python - Tetris in 28 or 50 lines of code." /><author><name>Kris Cieslak</name><uri>http://www.blogger.com/profile/03070399087643391214</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/_Lx7GGL0U3cI/S_2ZYCoHXzI/AAAAAAAAAVE/3e0YsiOoQFk/s72-c/s1.png" height="72" width="72" /><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;CUYBRnc8cCp7ImA9WxFXEE8.&quot;"><id>tag:blogger.com,1999:blog-6009132216257803808.post-6723173202265164783</id><published>2010-05-15T22:39:00.010+02:00</published><updated>2010-05-16T17:19:17.978+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-05-16T17:19:17.978+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="scripts" /><category scheme="http://www.blogger.com/atom/ns#" term="bash" /><category scheme="http://www.blogger.com/atom/ns#" term="kamikaze" /><category scheme="http://www.blogger.com/atom/ns#" term="openwrt" /><category scheme="http://www.blogger.com/atom/ns#" term="iptables" /><category scheme="http://www.blogger.com/atom/ns#" term="proxy" /><title>OpenWrt - iptables proxy configuration.</title><content type="html">Simple script that redirects http traffic to a proxy server by using iptables. &lt;br /&gt;Redirection only affects lan clients (not the router). &lt;br /&gt;Tested on Kamikaze 8.09.2 configured in &lt;i&gt;sta mode&lt;/i&gt; (as wireless client).&lt;br /&gt;If it doesn't work on your OpenWrt version try to replace &lt;strong&gt;PREROUTING&lt;/strong&gt; with &lt;strong&gt;prerouting_rule&lt;/strong&gt;,&lt;strong&gt;POSROUTING&lt;/strong&gt; with &lt;strong&gt;postrouting_rule&lt;/strong&gt; and &lt;strong&gt;FORWARD&lt;/strong&gt; with &lt;strong&gt;forwarding_rule&lt;/strong&gt;.&lt;br /&gt;Also change the LAN variable to your LAN interface - &lt;strong&gt;br-lan&lt;/strong&gt; in my case.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;#!/bin/sh&lt;br /&gt;&lt;br /&gt;LAN=&lt;strong&gt;br-lan&lt;/strong&gt;&lt;br /&gt;LANIP=$(ifconfig $LAN | awk '/dr:/{gsub(/.*:/,"",$2);print $2}')&lt;br /&gt;INTERNAL_NETWORK=$(echo $LANIP | sed 's/[0-9]*$//g')'0/24'&lt;br /&gt;PROXYIP=$2&lt;br /&gt;PROXYPORT=$3&lt;br /&gt;&lt;br /&gt;ConfigProxyOn() {&lt;br /&gt;&amp;nbsp;&amp;nbsp;echo "HTTP proxy enabled - $PROXYIP:$PROXYPORT"&lt;br /&gt;&amp;nbsp;&amp;nbsp;iptables -t nat -A PREROUTING -i $LAN -s ! $PROXYIP -p tcp --dport 80 -j DNAT --to $PROXYIP:$PROXYPORT&lt;br /&gt;&amp;nbsp;&amp;nbsp;iptables -t nat -A POSTROUTING -o $LAN -s $INTERNAL_NETWORK -d $PROXYIP -j SNAT --to $LANIP&lt;br /&gt;&amp;nbsp;&amp;nbsp;iptables -A FORWARD -s $INTERNAL_NETWORK -d $PROXYIP -i $LAN -o $LAN -p tcp --dport $PROXYPORT -j ACCEPT&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;ConfigProxyOff() {&lt;br /&gt;&amp;nbsp;&amp;nbsp;iptables -t nat -D PREROUTING -i $LAN -s ! $PROXYIP -p tcp --dport 80 -j DNAT --to $PROXYIP:$PROXYPORT&lt;br /&gt;&amp;nbsp;&amp;nbsp;iptables -t nat -D POSTROUTING -o $LAN -s $INTERNAL_NETWORK -d $PROXYIP -j SNAT --to $LANIP&lt;br /&gt;&amp;nbsp;&amp;nbsp;iptables -D FORWARD -s $INTERNAL_NETWORK -d $PROXYIP -i $LAN -o $LAN -p tcp --dport $PROXYPORT -j ACCEPT&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;GetStatus() {&lt;br /&gt;&amp;nbsp;&amp;nbsp;iptables -t nat -L PREROUTING&lt;br /&gt;&amp;nbsp;&amp;nbsp;iptables -t nat -L POSTROUTING&lt;br /&gt;&amp;nbsp;&amp;nbsp;iptables -L FORWARD&lt;br /&gt;}&lt;br /&gt;case "$1" in&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;on)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ConfigProxyOn&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;off)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ConfigProxyOff&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;status)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;GetStatus&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*)&lt;br /&gt;           echo "Usage: "&lt;br /&gt;           echo "       Turn on http proxy  - proxy.sh on &lt;ip&gt; &lt;port&gt;"&lt;br /&gt;           echo "       Turn off http proxy - proxy.sh off &lt;ip&gt; &lt;port&gt;"&lt;br /&gt;           echo "       Current status      - proxy.sh status"&lt;br /&gt;           echo&lt;br /&gt;           exit 1&lt;br /&gt;esac&lt;br /&gt;&lt;/port&gt;&lt;/ip&gt;&lt;/port&gt;&lt;/ip&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6009132216257803808-6723173202265164783?l=defaultset.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://defaultset.blogspot.com/feeds/6723173202265164783/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://defaultset.blogspot.com/2010/05/openwrt-iptables-proxy-configuration.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6009132216257803808/posts/default/6723173202265164783?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6009132216257803808/posts/default/6723173202265164783?v=2" /><link rel="alternate" type="text/html" href="http://defaultset.blogspot.com/2010/05/openwrt-iptables-proxy-configuration.html" title="OpenWrt - iptables proxy configuration." /><author><name>Kris Cieslak</name><uri>http://www.blogger.com/profile/03070399087643391214</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;AkUGRXkzfip7ImA9WxFQFko.&quot;"><id>tag:blogger.com,1999:blog-6009132216257803808.post-5174190821985078304</id><published>2010-05-12T17:15:00.002+02:00</published><updated>2010-05-12T17:30:24.786+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-05-12T17:30:24.786+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="video" /><category scheme="http://www.blogger.com/atom/ns#" term="linux" /><category scheme="http://www.blogger.com/atom/ns#" term="wrt54gl" /><category scheme="http://www.blogger.com/atom/ns#" term="linksys" /><category scheme="http://www.blogger.com/atom/ns#" term="kamikaze" /><category scheme="http://www.blogger.com/atom/ns#" term="openwrt" /><category scheme="http://www.blogger.com/atom/ns#" term="youtube" /><category scheme="http://www.blogger.com/atom/ns#" term="backfire" /><title>OpenWrt - upgrading Kamikaze to Backfire</title><content type="html">My new video. Simple tutorial how to prepare trx image and upgrade the OpenWrt Kamikaze 8.09.2 to Backfire 10.03 on Linksys wrt54gl 1.1&lt;br /&gt;&lt;br /&gt;&lt;object width="580" height="360"&gt;&lt;param name="movie" value="http://www.youtube.com/v/SflT9yFR_lo&amp;hl=en_US&amp;fs=1&amp;border=1"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/SflT9yFR_lo&amp;hl=en_US&amp;fs=1&amp;border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="580" height="360"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6009132216257803808-5174190821985078304?l=defaultset.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://defaultset.blogspot.com/feeds/5174190821985078304/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://defaultset.blogspot.com/2010/05/openwrt-upgrading-kamikaze-to-backfire.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6009132216257803808/posts/default/5174190821985078304?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6009132216257803808/posts/default/5174190821985078304?v=2" /><link rel="alternate" type="text/html" href="http://defaultset.blogspot.com/2010/05/openwrt-upgrading-kamikaze-to-backfire.html" title="OpenWrt - upgrading Kamikaze to Backfire" /><author><name>Kris Cieslak</name><uri>http://www.blogger.com/profile/03070399087643391214</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>1</thr:total></entry><entry gd:etag="W/&quot;C0MERn05eSp7ImA9WxFQEkg.&quot;"><id>tag:blogger.com,1999:blog-6009132216257803808.post-5985100257661345569</id><published>2010-05-07T18:49:00.003+02:00</published><updated>2010-05-07T18:56:47.321+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-05-07T18:56:47.321+02:00</app:edited><title>Strange YOUTUBE error.</title><content type="html">500 Internal Server Error&lt;br /&gt;&lt;br /&gt;A team of highly trained monkeys has been dispatched to deal with this situation.&lt;br /&gt;&lt;br /&gt;Also, please include the following information in your error report:&lt;br /&gt;&lt;br /&gt;....&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Lx7GGL0U3cI/S-RGOhmUeSI/AAAAAAAAAUI/-3lU0mvOY_U/s1600/Screenshot-500+Internal+Server+Error+-+Google+Chrome.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 200px; height: 146px;" src="http://1.bp.blogspot.com/_Lx7GGL0U3cI/S-RGOhmUeSI/AAAAAAAAAUI/-3lU0mvOY_U/s200/Screenshot-500+Internal+Server+Error+-+Google+Chrome.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5468573062885832994" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6009132216257803808-5985100257661345569?l=defaultset.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://defaultset.blogspot.com/feeds/5985100257661345569/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://defaultset.blogspot.com/2010/05/strange-youtube-error.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6009132216257803808/posts/default/5985100257661345569?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6009132216257803808/posts/default/5985100257661345569?v=2" /><link rel="alternate" type="text/html" href="http://defaultset.blogspot.com/2010/05/strange-youtube-error.html" title="Strange YOUTUBE error." /><author><name>Kris Cieslak</name><uri>http://www.blogger.com/profile/03070399087643391214</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_Lx7GGL0U3cI/S-RGOhmUeSI/AAAAAAAAAUI/-3lU0mvOY_U/s72-c/Screenshot-500+Internal+Server+Error+-+Google+Chrome.jpg" height="72" width="72" /><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;CU8CRns_fip7ImA9WxFRGUs.&quot;"><id>tag:blogger.com,1999:blog-6009132216257803808.post-7505342441135886263</id><published>2010-05-04T11:01:00.002+02:00</published><updated>2010-05-04T11:04:27.546+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-05-04T11:04:27.546+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="visual studio" /><category scheme="http://www.blogger.com/atom/ns#" term="msdn" /><category scheme="http://www.blogger.com/atom/ns#" term="microsoft" /><category scheme="http://www.blogger.com/atom/ns#" term="virtual labs" /><title>Microsoft teaches you how to exploit and secure your code.</title><content type="html">Virtual Labs is a one of Microsoft's online services that gives you opportunity to work on some MS products by doing exercises on a specialy prepared virtual machines. Labs are divided into two sections, Technet - for those who's interested on operating systems, databases and similiar products and MSDN labs which are aimed to developers. Here's the full list&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.microsoft.com/events/vlabs/default.mspx"&gt;Microsoft Virtual Labs&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;One of the interesting section is the Security at the MSDN site. Currently there is about fifteen labs where you will see examples of buffer overflow, Cross-site scripting and sql injection vulnerabilities, and learn how to detect and fix them using tools avaliable in Visual Studio.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Lx7GGL0U3cI/S98W8TciBpI/AAAAAAAAAT4/S9GyoOVu_rg/s1600/vlab.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 200px; height: 135px;" src="http://1.bp.blogspot.com/_Lx7GGL0U3cI/S98W8TciBpI/AAAAAAAAAT4/S9GyoOVu_rg/s200/vlab.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5467113697918977682" /&gt;&lt;/a&gt;&lt;br /&gt;These labs are very short and simple, most of them can be done in few minutes but are worth to see especially if you work on Visual Studio.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/aa740391.aspx"&gt;Security Labs&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6009132216257803808-7505342441135886263?l=defaultset.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://defaultset.blogspot.com/feeds/7505342441135886263/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://defaultset.blogspot.com/2010/05/microsoft-teaches-you-how-to-exploit.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6009132216257803808/posts/default/7505342441135886263?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6009132216257803808/posts/default/7505342441135886263?v=2" /><link rel="alternate" type="text/html" href="http://defaultset.blogspot.com/2010/05/microsoft-teaches-you-how-to-exploit.html" title="Microsoft teaches you how to exploit and secure your code." /><author><name>Kris Cieslak</name><uri>http://www.blogger.com/profile/03070399087643391214</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_Lx7GGL0U3cI/S98W8TciBpI/AAAAAAAAAT4/S9GyoOVu_rg/s72-c/vlab.jpg" height="72" width="72" /><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;Ck8GRHY9eSp7ImA9WxFRGEQ.&quot;"><id>tag:blogger.com,1999:blog-6009132216257803808.post-4737959281126497342</id><published>2010-05-02T21:03:00.020+02:00</published><updated>2010-05-03T14:47:05.861+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-05-03T14:47:05.861+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="linux" /><category scheme="http://www.blogger.com/atom/ns#" term="thinkpad" /><category scheme="http://www.blogger.com/atom/ns#" term="hdaps" /><category scheme="http://www.blogger.com/atom/ns#" term="ubuntu" /><title>Installing HDAPS on UBUNTU Lynx (10.04)</title><content type="html">I did it on a clean UBUNTU Lynx installation by using tutorial founded on the thinkwiki.org.&lt;br /&gt;&lt;br /&gt;This is the main how-to&lt;br /&gt;&lt;a href="http://www.thinkwiki.org/wiki/Installing_Ubuntu_9.10_(Karmic_Koala)_on_a_ThinkPad_T61#Install_HDAPS_-_IBM_Active_Protection_System_Linux_Driver" target="_blank"&gt;http://www.thinkwiki.org/wiki/Installing_Ubuntu_9.10_(Karmic_Koala)_on_a_ThinkPad_T61#Install_HDAPS_-_IBM_Active_Protection_System_Linux_Driver&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I think you should also install the following modules before starting the installation:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;sudo apt-get install build-essential module-assistant&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;If you want to check if everything works correctly use &lt;strong&gt;hdaps-gl&lt;/strong&gt; from &lt;strong&gt;hdaps-utils&lt;/strong&gt; package. This is the simple opengl application that displays laptop position in real-time.&lt;br /&gt;&lt;br /&gt;The package - &lt;a href="http://fi.archive.ubuntu.com/ubuntu/pool/universe/h/hdaps-utils/hdaps-utils_0.1-1.1_i386.deb"  target="_blank"&gt;hdaps-utils_0.1-1.1_i386.deb&lt;/a&gt; - works fine for my setup. &lt;br /&gt;&lt;br /&gt;You can also use the Avant Window Navigator with the ThinkHDAPS applet.&lt;br /&gt;&lt;br /&gt;To change the sensitivity edit the file (as the root user)&lt;br /&gt;&lt;br /&gt;&lt;code&gt;/etc/default/hdaps&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;and change the SENSITIVITY line. The higher value means less sensitivity. &lt;br /&gt;&lt;br /&gt;To restart the hdapsd execute following command&lt;br /&gt;&lt;br /&gt;&lt;code&gt;sudo /etc/init.d/hdapsd restart&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Screenshot from Synaptic Package Manager:&lt;br /&gt;&lt;div style="width: 200px; margin:10px auto"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Lx7GGL0U3cI/S93UH1fmE5I/AAAAAAAAAS0/BBOorChDjfk/s1600/Screenshot-Synaptic+Package+Manager+.png"&gt;&lt;img style="margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 200px; height: 140px;" src="http://1.bp.blogspot.com/_Lx7GGL0U3cI/S93UH1fmE5I/AAAAAAAAAS0/BBOorChDjfk/s200/Screenshot-Synaptic+Package+Manager+.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5466758753781420946" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6009132216257803808-4737959281126497342?l=defaultset.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://defaultset.blogspot.com/feeds/4737959281126497342/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://defaultset.blogspot.com/2010/05/installing-hdaps-on-ubuntu-lynx-1004.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6009132216257803808/posts/default/4737959281126497342?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6009132216257803808/posts/default/4737959281126497342?v=2" /><link rel="alternate" type="text/html" href="http://defaultset.blogspot.com/2010/05/installing-hdaps-on-ubuntu-lynx-1004.html" title="Installing HDAPS on UBUNTU Lynx (10.04)" /><author><name>Kris Cieslak</name><uri>http://www.blogger.com/profile/03070399087643391214</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_Lx7GGL0U3cI/S93UH1fmE5I/AAAAAAAAAS0/BBOorChDjfk/s72-c/Screenshot-Synaptic+Package+Manager+.png" height="72" width="72" /><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;CEAMQHo9fCp7ImA9WxFRGE4.&quot;"><id>tag:blogger.com,1999:blog-6009132216257803808.post-2111653370312720555</id><published>2010-04-27T22:38:00.008+02:00</published><updated>2010-05-02T22:39:41.464+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-05-02T22:39:41.464+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="powershell" /><category scheme="http://www.blogger.com/atom/ns#" term="com object" /><category scheme="http://www.blogger.com/atom/ns#" term="python" /><category scheme="http://www.blogger.com/atom/ns#" term="thinkpad" /><title>The Thinkvantage Power Manager COM object.</title><content type="html">If you have IBM/Lenovo Thinkpad Laptop with Thinkvantage Power Manager installed  you can use the PWRMGR object to check the battery status, charging progress, remaining time and also change the screen brightness. &lt;br /&gt;This is undocumented method, probably you can't make any damage on your hardware, however use it at your own risk. &lt;br /&gt;These examples were tested on Thinkpad T60 with windows 7.&lt;br /&gt;&lt;br /&gt;First, let's get the list of avaliable objects:&lt;br /&gt;&lt;br /&gt;&lt;code&gt; gwmi win32_classiccomclasssetting | ? { $_.InprocServer32 -like '*PWRMGR*' } | select VersionIndependentProgId&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;We will work with &lt;strong&gt;PWRMGR.Slider&lt;/strong&gt; and &lt;strong&gt;PWRMGR.Battery&lt;/strong&gt;.&lt;br /&gt;Next, let's create a new instances and check avaliable methods and properties:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;$slider = new-object -com PWRMGR.Slider&lt;br /&gt;$battery = new-object -com PWRMGR.Battery&lt;br /&gt;&lt;br /&gt;$slider | gm&lt;br /&gt;$battery | gm&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Lx7GGL0U3cI/S9dN5cT19cI/AAAAAAAAASc/UtAVOYteijc/s1600/tppmCOM.gif"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer;float:none;cursor:hand;width: 320px; height: 214px;" src="http://4.bp.blogspot.com/_Lx7GGL0U3cI/S9dN5cT19cI/AAAAAAAAASc/UtAVOYteijc/s320/tppmCOM.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5464922322084689346" /&gt;&lt;/a&gt;&lt;br /&gt;and now the cool part, unplug the power cable from your laptop and execute following commands :&lt;br /&gt;&lt;br /&gt;&lt;code&gt;$battery.Update()&lt;br /&gt;$battery.ChargeStatus&lt;br /&gt;$battery.RemainingPercentage&lt;br /&gt;$battery.RemainingTime&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;as you can see we have an informaiton about the remaining percentage and time (which are the same as on the taskbar), Plug back the power cable and run these commands:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;$battery.Update()&lt;br /&gt;$battery.ChargeStatus&lt;br /&gt;$battery.RemainingPercentage&lt;br /&gt;$battery.ChargeTime&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;this time we've got the charging time, also the ChargeStatus was changed, you can use this function to detect if your laptop is on battery or not. &lt;br /&gt;It's important to execute &lt;i&gt;Update()&lt;/i&gt; method to get the current values before you check any property.&lt;br /&gt;&lt;br /&gt;And the last cool trick is changing the screen brightness, this time we'll use &lt;i&gt;PerformBrightnessSimulation&lt;/i&gt; from &lt;i&gt;PWRMGR.Slider&lt;/i&gt; object.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;$slider.PerformBrightnessSimulation(0)&lt;br /&gt;$slider.PerformBrightnessSimulation(10)&lt;br /&gt;.. (step by 10)&lt;br /&gt;$slider.PerformBrightnessSimulation(90)&lt;br /&gt;$slider.PerformBrightnessSimulation(100)&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Of course I didn't exhaust the subject, these was only few things that I found exploring that object.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Note:&lt;/strong&gt;&lt;br /&gt;If you prefer Python as your scripting language you can use pywin32 to work with the COM objects.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;import win32com.client&lt;br /&gt;battery = win32com.client.Dispatch("PWRMGR.Battery")&lt;br /&gt;battery.Update()&lt;br /&gt;print(battery.RemainingPercentage)&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6009132216257803808-2111653370312720555?l=defaultset.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://defaultset.blogspot.com/feeds/2111653370312720555/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://defaultset.blogspot.com/2010/04/thinkvantage-power-manager-com-object.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6009132216257803808/posts/default/2111653370312720555?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6009132216257803808/posts/default/2111653370312720555?v=2" /><link rel="alternate" type="text/html" href="http://defaultset.blogspot.com/2010/04/thinkvantage-power-manager-com-object.html" title="The Thinkvantage Power Manager COM object." /><author><name>Kris Cieslak</name><uri>http://www.blogger.com/profile/03070399087643391214</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/_Lx7GGL0U3cI/S9dN5cT19cI/AAAAAAAAASc/UtAVOYteijc/s72-c/tppmCOM.gif" height="72" width="72" /><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;CUMHSXo5eCp7ImA9WxFRGE4.&quot;"><id>tag:blogger.com,1999:blog-6009132216257803808.post-774404613480433817</id><published>2010-04-22T18:20:00.007+02:00</published><updated>2010-05-02T22:50:38.420+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-05-02T22:50:38.420+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="scripts" /><category scheme="http://www.blogger.com/atom/ns#" term="powershell" /><title>Powershell, Enabling/Disabling Network Card, two methods.</title><content type="html">Yet another powershell script from my collection. This time it's a connection of two different methods of changing the state of the network card. I read on few forums that people are looking for a script that could disable or enable the network card, however some of them are using windows xp but the others Vista and higher. The problem is that on Vista and 7 we can use WMI to make this job quickly and clean but on Windows XP it's not that simple, we need to use the com object to do that.&lt;br /&gt;The following script checks the operating system version and decides which method must be used.&lt;br /&gt;If you are using windows xp, you will need to change highlighted variables depends on your os-language.&lt;/p&gt;&lt;p&gt;At the end of this post I've put few lines of code that will help you determine the values for variables.&lt;br /&gt;&lt;script type="text/javascript" src="http://PoshCode.org/embed/1800"&gt;&lt;/script&gt;&lt;br /&gt;Check values for your operating system (these depends on the system language):&lt;br /&gt;&lt;br /&gt;&lt;code&gt;$shell = New-object -com Shell.Application&lt;br /&gt;(($shell.NameSpace(3).Items() | ? { $_.Path -like '*7007ACC7-3202-11D1-AAD2-00805FC1270E*'}).GetFolder.Items() | ? { $_.Name -eq &lt;span class="Apple-style-span"  style="color:#FF0000;"&gt;&lt;b&gt;'change to your interface Name'&lt;/b&gt;&lt;/span&gt; }).Verbs() | Select Name&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6009132216257803808-774404613480433817?l=defaultset.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://defaultset.blogspot.com/feeds/774404613480433817/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://defaultset.blogspot.com/2010/04/powershell-enablingdisabling-network.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6009132216257803808/posts/default/774404613480433817?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6009132216257803808/posts/default/774404613480433817?v=2" /><link rel="alternate" type="text/html" href="http://defaultset.blogspot.com/2010/04/powershell-enablingdisabling-network.html" title="Powershell, Enabling/Disabling Network Card, two methods." /><author><name>Kris Cieslak</name><uri>http://www.blogger.com/profile/03070399087643391214</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;CUIFRH08eyp7ImA9WxFRGE4.&quot;"><id>tag:blogger.com,1999:blog-6009132216257803808.post-6663922381563827839</id><published>2010-04-11T09:41:00.025+02:00</published><updated>2010-05-02T22:51:55.373+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-05-02T22:51:55.373+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="projects" /><category scheme="http://www.blogger.com/atom/ns#" term="cpp" /><title>External MessageBox</title><content type="html">I wrote External MessageBox about year ago for use in a batch scripts to control execution flow and communicate with a user.&lt;br /&gt;The utility is very simple, as the name suggests it shows the dialog box with specified caption, message, icon and one or several buttons. If you look at the source code you'll see that it just a call of the system MessageBox function (more about it &lt;a href="http://msdn.microsoft.com/en-us/library/ms645505%28VS.85%29.aspx" target="_blank"&gt;here&lt;/a&gt;).&lt;br /&gt;One of the cool feature is that you can pin the MessageBox to another running application, and block it until the user click one of the buttons.&lt;br /&gt;Here is an example:&lt;br /&gt;&lt;ol style="list-style-type: decimal"&gt;&lt;li&gt;Run windows calculator (calc.exe),&lt;/li&gt;&lt;li&gt;Open cmd shell and change directory to where you unzip the emsgbox.exe,&lt;/li&gt;&lt;li&gt;run following command:&lt;/li&gt;&lt;/ol&gt; &lt;br /&gt;&lt;code&gt;emsgbox.exe /n calc.exe /c Calculator Info /m 2+2=5 /t 48&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;The calulcator will be blocked until you click OK button.&lt;br /&gt;The button number which user has clicked is placed in &lt;span style="font-weight:bold;"&gt;%errorlevel%&lt;/span&gt; environment variable (or $lasterrorcode - powershell), however this method works only if you write a batch script or in the cmd shell when you use emsgbox.exe as follow:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;start /wait emsgbox.exe /n calc.exe /c Calculator Info /m 2+2=5 /t 48&lt;br /&gt;echo %errorlevel%&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;(as I said if you use it in batch script you don't have to use "start /wait" statement)&lt;br /&gt;Link to the project/download page:&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a href="http://code.google.com/p/emsgbox/" target="_blank"&gt;EMSGBOX project page&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6009132216257803808-6663922381563827839?l=defaultset.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://defaultset.blogspot.com/feeds/6663922381563827839/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://defaultset.blogspot.com/2010/04/external-messagebox.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6009132216257803808/posts/default/6663922381563827839?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6009132216257803808/posts/default/6663922381563827839?v=2" /><link rel="alternate" type="text/html" href="http://defaultset.blogspot.com/2010/04/external-messagebox.html" title="External MessageBox" /><author><name>Kris Cieslak</name><uri>http://www.blogger.com/profile/03070399087643391214</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;CUIBRnc6fCp7ImA9WxFRGE4.&quot;"><id>tag:blogger.com,1999:blog-6009132216257803808.post-7351145915271161134</id><published>2010-04-08T22:08:00.015+02:00</published><updated>2010-05-02T22:52:37.914+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-05-02T22:52:37.914+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="powershell" /><title>Powershell, problem with the comma character.</title><content type="html">I'm using powershell a lot, and I want to use it like a normal shell environment, but I can't.&lt;/p&gt;&lt;p&gt;Well, I give you example, try this in powershell:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;nmap -sS -p80,22 -PN -n 192.168.1.1&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;The comma character is the reason. It is a some kind of special character in powershell so you can't use it like that. In that case lets try the same command with ps escape character (backward apostrophe (`))&lt;br /&gt;&lt;br /&gt;&lt;code&gt;nmap -sS -p80`,22 -PN -n 192.168.1.1&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;still not working, but the error is different.&lt;/p&gt;&lt;p&gt;So how to fix this?&lt;/p&gt;&lt;p&gt;Solution number one (add space between -p and 80):&lt;br /&gt;&lt;br /&gt;&lt;code&gt;nmap -sS -p 80`,22 -PN -n 192.168.1.1&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;or solution number two (specify a protocol):&lt;br /&gt;&lt;br /&gt;&lt;code&gt;nmap -sS -pT:80`,22 -PN -n 192.168.1.1&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Lx7GGL0U3cI/S745n12UYnI/AAAAAAAAARQ/xfCRvaQLFKw/s1600/e1.gif"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 173px;" src="http://4.bp.blogspot.com/_Lx7GGL0U3cI/S745n12UYnI/AAAAAAAAARQ/xfCRvaQLFKw/s320/e1.gif" border="0" alt="" id="BLOGGER_PHOTO_ID_5457863155052208754" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6009132216257803808-7351145915271161134?l=defaultset.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://defaultset.blogspot.com/feeds/7351145915271161134/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://defaultset.blogspot.com/2010/04/powershell-problem-with-comma-character.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6009132216257803808/posts/default/7351145915271161134?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6009132216257803808/posts/default/7351145915271161134?v=2" /><link rel="alternate" type="text/html" href="http://defaultset.blogspot.com/2010/04/powershell-problem-with-comma-character.html" title="Powershell, problem with the comma character." /><author><name>Kris Cieslak</name><uri>http://www.blogger.com/profile/03070399087643391214</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/_Lx7GGL0U3cI/S745n12UYnI/AAAAAAAAARQ/xfCRvaQLFKw/s72-c/e1.gif" height="72" width="72" /><thr:total>2</thr:total></entry><entry gd:etag="W/&quot;CUEFSHg_eCp7ImA9WxFRGE4.&quot;"><id>tag:blogger.com,1999:blog-6009132216257803808.post-4385901788797259716</id><published>2010-04-05T15:31:00.026+02:00</published><updated>2010-05-02T22:53:39.640+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-05-02T22:53:39.640+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="scripts" /><category scheme="http://www.blogger.com/atom/ns#" term="powershell" /><category scheme="http://www.blogger.com/atom/ns#" term="ip" /><category scheme="http://www.blogger.com/atom/ns#" term="bash" /><category scheme="http://www.blogger.com/atom/ns#" term="python" /><title>What is my external IP?</title><content type="html">Sometimes, when I'm connected to the local network I have to check what is my external IP address. If I'm on an unknown network and have no access to the router or the server configuration I need external IP to check who is the ISP or what services are avaliable behind the NAT.&lt;br /&gt;There are two ways to get the external IP. First, is to check the IP configuration on the NAT server or router, but this works only if:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;the router is directly connected to the internet, not to the another router on the other lan network,&lt;/li&gt;&lt;li&gt;the static IP address is configured,&lt;/li&gt;&lt;li&gt;you have an access to the configuration&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Second, and most easiest way is to open your browser, go to your favorite search engine, search for 'what is my ip' and click the first result from the top. If you are lucky, that address is your external IP. If you for some reasons have no luck, check the links at the end of this post.&lt;br /&gt;The other thing could be the command line instruction that will return the IP address, so we can use it for other purposes, as a part of some other scripts. One of possible way is to write a script that fetch the website and get the IP address from its content. Most of the WHAT-IS-MY-IP pages are not script friendly since they are regular web pages full of html tags and it is hard to dermine where the IP address is placed and even if you find it you can never be sure that it is correct (you may find not just one). Anyway, if you want to search through the content of the page,&lt;br /&gt;I recommend you to use Regular Expression:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Specially for this post, I searched for those websites that shows only IP addresses, no html tags and other content.&lt;br /&gt;Here is the list:&lt;br /&gt;&lt;a href="http://www.whatismyip.org/"&gt;http://www.whatismyip.org/&lt;/a&gt;&lt;br /&gt;&lt;a target="_blank"  href="http://www.whatismyip.com/automation/n09230945.asp"&gt;http://www.whatismyip.com/automation/n09230945.asp&lt;/a&gt;&lt;br /&gt;&lt;a target="_blank" href="http://icanhazip.com/"&gt;http://icanhazip.com/&lt;/a&gt;&lt;br /&gt;&lt;a target="_blank"  href="http://whatismyip.akamai.com/"&gt;http://whatismyip.akamai.com/&lt;/a&gt;&lt;br /&gt;&lt;a target="_blank"  href="http://b10m.swal.org/ip"&gt;http://b10m.swal.org/ip&lt;/a&gt;&lt;br /&gt;&lt;a target="_blank"  href="http://b10m.swal.org/cgi-bin/whatsmyip.cgi?just-ip"&gt;http://b10m.swal.org/cgi-bin/whatsmyip.cgi?just-ip&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;And the script that has been ported to a different platforms:&lt;br /&gt;&lt;b&gt;Powershell:&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;(New-Object System.Net.WebClient).DownloadString('http://whatismyip.org')&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Python 3:&lt;/b&gt;&lt;br /&gt;&lt;code&gt;import urllib.request&lt;br /&gt;page = urllib.request.urlopen('http://whatismyip.org')&lt;br /&gt;ip = page.read().decode("utf8");&lt;br /&gt;page.close()&lt;br /&gt;print (ip)&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Python 2:&lt;/b&gt;&lt;br /&gt;&lt;code&gt;import urllib&lt;br /&gt;ip = urllib.urlopen('http://whatismyip.org').read()&lt;br /&gt;print ip&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Linux (bash) using wget:&lt;/b&gt;&lt;br /&gt;&lt;code&gt;#!/bin/sh&lt;br /&gt;wget -qO - http://www.whatismyip.com/automation/n09230945.asp&lt;br /&gt;echo&lt;br /&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6009132216257803808-4385901788797259716?l=defaultset.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://defaultset.blogspot.com/feeds/4385901788797259716/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://defaultset.blogspot.com/2010/04/what-is-my-external-ip.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6009132216257803808/posts/default/4385901788797259716?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6009132216257803808/posts/default/4385901788797259716?v=2" /><link rel="alternate" type="text/html" href="http://defaultset.blogspot.com/2010/04/what-is-my-external-ip.html" title="What is my external IP?" /><author><name>Kris Cieslak</name><uri>http://www.blogger.com/profile/03070399087643391214</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;Ak8DRHs_fSp7ImA9WxFREEU.&quot;"><id>tag:blogger.com,1999:blog-6009132216257803808.post-8193711881345331242</id><published>2010-04-03T17:19:00.015+02:00</published><updated>2010-04-24T08:01:15.545+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-04-24T08:01:15.545+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="scripts" /><category scheme="http://www.blogger.com/atom/ns#" term="powershell" /><category scheme="http://www.blogger.com/atom/ns#" term="netsh" /><category scheme="http://www.blogger.com/atom/ns#" term="wireless networks" /><title>Scanning for available WLAN networks with PowerShell</title><content type="html">Everyone interested knows how great tool netsh is if it comes about network configuration on Windows, especially when you are command line geek. Personally, I am often using it for setting ip addresses or managing Windows firewall. Starting from Windows Vista Microsoft has changed few and add new contexts giving you more control over network configuration. One of my  favorite is "wlan". If you use Windows as your Wireless connection manager and, as I mentioned you are command line person the &lt;span style="font-weight: bold;"&gt;netsh wlan&lt;/span&gt; context is just for you. Not every wlan settings are changeable, but those that are available are enough to control wireless configuration through command line.&lt;br /&gt;Few days ago I wrote a script that transform the result from 'netsh wlan show networks' command into something that looks familiar to airodump-ng scan, I think table form is more readable.&lt;br /&gt;&lt;br /&gt;Here is the script (oh, I forgot to mention, this is PowerShell script):&lt;br /&gt;&lt;script type="text/javascript" src="http://PoshCode.org/embed/1731"&gt;&lt;/script&gt;&lt;br /&gt;&lt;strong&gt;Usage example:&lt;/strong&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Lx7GGL0U3cI/S7eyBiDw3AI/AAAAAAAAAQ4/A79MW6mEUSI/s1600/wlanscan.gif"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 122px;" src="http://4.bp.blogspot.com/_Lx7GGL0U3cI/S7eyBiDw3AI/AAAAAAAAAQ4/A79MW6mEUSI/s320/wlanscan.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5456025212974849026" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6009132216257803808-8193711881345331242?l=defaultset.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://defaultset.blogspot.com/feeds/8193711881345331242/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://defaultset.blogspot.com/2010/04/powershell-wireless-network-scan-script.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6009132216257803808/posts/default/8193711881345331242?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6009132216257803808/posts/default/8193711881345331242?v=2" /><link rel="alternate" type="text/html" href="http://defaultset.blogspot.com/2010/04/powershell-wireless-network-scan-script.html" title="Scanning for available WLAN networks with PowerShell" /><author><name>Kris Cieslak</name><uri>http://www.blogger.com/profile/03070399087643391214</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/_Lx7GGL0U3cI/S7eyBiDw3AI/AAAAAAAAAQ4/A79MW6mEUSI/s72-c/wlanscan.gif" height="72" width="72" /><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;CEIMSX48fCp7ImA9WxFRFE0.&quot;"><id>tag:blogger.com,1999:blog-6009132216257803808.post-2499313226265685960</id><published>2010-03-31T18:24:00.010+02:00</published><updated>2010-04-27T23:09:48.074+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-04-27T23:09:48.074+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="ping" /><category scheme="http://www.blogger.com/atom/ns#" term="nmap" /><category scheme="http://www.blogger.com/atom/ns#" term="nping" /><category scheme="http://www.blogger.com/atom/ns#" term="port scanning" /><title>Nping - port redirection detection.</title><content type="html">Yesterday I got an email from insecure.org about the beta version (5.30) of nmap. For&lt;br /&gt;those who use nmap I recommend to read the changelog, they fix and change few things and add new interesting scripts. Also, from now on Nping will be the part od nmap distribution (like ncat).&lt;br /&gt;&lt;br /&gt;Nping is a "ping" like tool but on steroids (something simillar to hping2), it has a lot of powerfull features that can expand host discovery techiques in many different ways. Like nmap ping option with packet trace, using Nping you can check the response TTL values, and more or less determine if there is a port redirection on a remote router (Read my previous posts about finding port redirecition with nmap)&lt;br /&gt;&lt;br /&gt;Here is a simple example:&lt;br /&gt;&lt;code&gt;nping --tcp -flags syn -p3389,22,1723 -c 1 -H [x.x.x.x]&lt;/code&gt;&lt;br /&gt;(where x.x.x.x is an IP address)&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;--tcp -flags syn&lt;/strong&gt; tcp protocol, only syn flag will be set&lt;br /&gt;&lt;strong&gt;-p&lt;/strong&gt; ports to check&lt;br /&gt;&lt;strong&gt;-c 1&lt;/strong&gt; this is for reducing count of packets (for more information check Nping man page)&lt;br /&gt;&lt;strong&gt;-H&lt;/strong&gt; show only response&lt;br /&gt;&lt;br /&gt;One of the difference that I found between the nmap and nping is that nping is a little bit slower (nmap ~0,4sec / nping ~3sec), currently I don't know why this happening and how can I (as a user) speed it up. Maybe it's a parameter issue.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6009132216257803808-2499313226265685960?l=defaultset.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://defaultset.blogspot.com/feeds/2499313226265685960/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://defaultset.blogspot.com/2010/03/nping-port-redirection-detection.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6009132216257803808/posts/default/2499313226265685960?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6009132216257803808/posts/default/2499313226265685960?v=2" /><link rel="alternate" type="text/html" href="http://defaultset.blogspot.com/2010/03/nping-port-redirection-detection.html" title="Nping - port redirection detection." /><author><name>Kris Cieslak</name><uri>http://www.blogger.com/profile/03070399087643391214</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;CUECSXw4fSp7ImA9WxFRGE4.&quot;"><id>tag:blogger.com,1999:blog-6009132216257803808.post-1228019144880458016</id><published>2010-03-29T18:13:00.017+02:00</published><updated>2010-05-02T22:54:28.235+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-05-02T22:54:28.235+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="event log" /><category scheme="http://www.blogger.com/atom/ns#" term="security" /><category scheme="http://www.blogger.com/atom/ns#" term="pstools" /><category scheme="http://www.blogger.com/atom/ns#" term="psexec" /><title>How to clear security eventlog with the SYSTEM account.</title><content type="html">After you clear the security log, one log entry is created (Event ID 1120) with the information who did this (account name, domain name) and when.&lt;br /&gt;If you, for some reasons, want to hide that information you can clear the security log (or other event logs) with the SYSTEM account. This account is on every Windows operating system, so it is hard to guess who really cleared that log. &lt;br /&gt;Let's do it.&lt;br /&gt;First of all, you need two applications &lt;a href="http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx"&gt;psexec.exe&lt;/a&gt; and &lt;a href="http://technet.microsoft.com/en-us/sysinternals/bb897544.aspx"&gt;psloglist.exe&lt;/a&gt;, you can get them from systinternals.com. Next, open your command prompt, and change directory to where you have downloaded these files. Type the following command:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;psexec -accepteula -s -c psloglist.exe -accepteula -c system -n 1&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;psexec switches:&lt;/b&gt;&lt;br /&gt;-s&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;  Run remote process in the System account.&lt;br /&gt;-c      Copy the specified program to the remote system for execution. (psloglist.exe in our case)&lt;br /&gt;&lt;br /&gt;&lt;b&gt;psloglist switches:&lt;/b&gt;&lt;br /&gt;-c&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;   Clear the event log after displaying,&lt;br /&gt;-n 1    Show only most recent entry (you can omit this if you want to see all events)&lt;br /&gt;&lt;br /&gt;&lt;b&gt;-accepteula&lt;/b&gt;      automatic license agreement (if you run sysinternals tools for the first           time you have to accept the license, this switch prevents from waitng for user response)&lt;br /&gt;The really cool thing about this trick is to use it on remote machine: &lt;br /&gt;&lt;br /&gt;&lt;code&gt;psexec \\[host] -u [user] -p [password] -accepteula -s -c psloglist.exe -accepteula -c security -n 1&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Of course you must have suitable privileges to clear the security log (in most cases you have to be an administrator).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6009132216257803808-1228019144880458016?l=defaultset.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://defaultset.blogspot.com/feeds/1228019144880458016/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://defaultset.blogspot.com/2010/03/how-to-clear-security-eventlog-with.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6009132216257803808/posts/default/1228019144880458016?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6009132216257803808/posts/default/1228019144880458016?v=2" /><link rel="alternate" type="text/html" href="http://defaultset.blogspot.com/2010/03/how-to-clear-security-eventlog-with.html" title="How to clear security eventlog with the SYSTEM account." /><author><name>Kris Cieslak</name><uri>http://www.blogger.com/profile/03070399087643391214</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;CUAEQHw6fip7ImA9WxFRGE4.&quot;"><id>tag:blogger.com,1999:blog-6009132216257803808.post-860847484426436013</id><published>2010-03-28T18:21:00.008+02:00</published><updated>2010-05-02T22:55:01.216+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-05-02T22:55:01.216+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="nmap" /><title>Nmap - port redirection detection.</title><content type="html">Not perfect! port redirection detection method, example:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;nmap -sS -PN -n --max-parallelism 1 --packet-trace -p1723,3389 x.x.x.x&lt;/code&gt;&lt;br /&gt;(where x.x.x.x is an IP address)&lt;br /&gt;&lt;br /&gt;If SYN/ACK TTLs for both ports are different then sometimes it means that there is port redirection on a router. Also looking at TTL values you can identify the remote os (ex. TTL close to 128 it's probably MS Windows).&lt;br /&gt;&lt;br /&gt;BTW. shorter version of --max-parallelism is -M. Maybe i'm wrong but -M is undocumented shortcut, I found it when I used --max-parallelism with 0 value, this caused error "Argument to -M must be at least 1!". :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6009132216257803808-860847484426436013?l=defaultset.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://defaultset.blogspot.com/feeds/860847484426436013/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://defaultset.blogspot.com/2010/03/nmap-port-redirection-detecion.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6009132216257803808/posts/default/860847484426436013?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6009132216257803808/posts/default/860847484426436013?v=2" /><link rel="alternate" type="text/html" href="http://defaultset.blogspot.com/2010/03/nmap-port-redirection-detecion.html" title="Nmap - port redirection detection." /><author><name>Kris Cieslak</name><uri>http://www.blogger.com/profile/03070399087643391214</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;DUEASHYzeSp7ImA9WxFREEU.&quot;"><id>tag:blogger.com,1999:blog-6009132216257803808.post-5731127075564263588</id><published>2010-03-28T14:25:00.011+02:00</published><updated>2010-04-24T07:40:49.881+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-04-24T07:40:49.881+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="personal" /><title>Welcome!</title><content type="html">Hello and welcome to my new playground. It's been a while since I've made something ambitious, like for example my previous blog (digitalinsane.com). For about two year I've been working in small company as an ERP application developer. It's a fine job however I feel that I'm stuck. If someone will ask me "Do you like your job?", the answer will be "I have to.". Like every human being on the planet I need money to survive, and doing boring business things it's currently only way to survive, so I have to like my job. Anyway, I did few cool things in JavaScript couple of years ago and I thought I'll do this until I get completely bored of it, but my job has changed me. Now I'm focused on operating systems, networking, SQL servers, business intelligence applications, etc. As you can see these things are not related in what I've been doing in the past, so I had to change my interests.Also, I needed to find something that makes all these things less boring and free myself from feeling stuck. So, I've started interesting in computer security, pentesting, the bright and dark side, I've desired to be a ninja or Jedi (please stop laughing), and because of that I decided to create new blog instead of continuing digitalinsane.com, which was mostly about JavaScript frameworks.&lt;br /&gt;&lt;br /&gt;I hope you enjoy this one.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6009132216257803808-5731127075564263588?l=defaultset.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://defaultset.blogspot.com/feeds/5731127075564263588/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://defaultset.blogspot.com/2010/03/welcome.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6009132216257803808/posts/default/5731127075564263588?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6009132216257803808/posts/default/5731127075564263588?v=2" /><link rel="alternate" type="text/html" href="http://defaultset.blogspot.com/2010/03/welcome.html" title="Welcome!" /><author><name>Kris Cieslak</name><uri>http://www.blogger.com/profile/03070399087643391214</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total></entry></feed>

