<?xml version="1.0"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>10 Most Recently Updated Pages</title>
		<link>http://www.lxer.nl/webdevelopment/home-2/</link>
		<atom:link href="http://www.lxer.nl/webdevelopment/home-2/" rel="self" type="application/rss+xml" />
		<description>Shows a list of the 10 most recently updated pages.</description>

		
		<item>
			<title>use Python for http POST requests</title>
			<link>http://www.lxer.nl/webdevelopment/use-python-for-http-post-requests-2/</link>
			<description>&lt;p&gt;A little script that shows how to use Python for HTTP Requests&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;pre&gt;import string,urllib&lt;br /&gt;def format(items):&lt;br /&gt;     list = []&lt;br /&gt;     for k, v in items:&lt;br /&gt;        list.append(&quot;%s=%s&quot; % (k, urllib.quote_plus(v)))&lt;br /&gt;     return string.join(list, '&amp;amp;')&lt;br /&gt;data = { 'hidd':'en', 'email':'you at yourmail.com',&lt;br /&gt;          'POST':'post.gif' }&lt;br /&gt;d = format(data.items())&lt;br /&gt;try:&lt;br /&gt;     sock = urlopen(YourURL, d)&lt;br /&gt;     for l in sock.readlines():&lt;br /&gt;         print l&lt;br /&gt;     sock.close()&lt;br /&gt;     finally:&lt;br /&gt;         urlcleanup()&lt;/pre&gt;</description>
			<pubDate>Mon, 04 May 2009 16:40:46 +0200</pubDate>
			
			<guid>http://www.lxer.nl/webdevelopment/use-python-for-http-post-requests-2/</guid>
		</item>
		
		<item>
			<title>Server Configuration</title>
			<link>http://www.lxer.nl/webdevelopment/server-configuration-3/</link>
			<description>&lt;p&gt;Usefull stuff &amp;amp; server configurations&lt;/p&gt;</description>
			<pubDate>Mon, 04 May 2009 17:10:23 +0200</pubDate>
			
			<guid>http://www.lxer.nl/webdevelopment/server-configuration-3/</guid>
		</item>
		
		<item>
			<title>Keep SSH connection open</title>
			<link>http://www.lxer.nl/webdevelopment/keep-ssh-connection-open-2/</link>
			<description>&lt;p&gt;Many home and office routers kill &quot;idle&quot; connections after a certain length of time, forcing you to log in again. From an ISP's point of view this is understandable, but imho it's just annoying to loose a connection when you just went for a coffee and forget to be back in time.&lt;br /&gt; A one-line addition to the end of the client's SSH configuration file (found at /etc/ssh/ssh_config in many systems) can fix this:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;ServerAliveInterval 180&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;That should send a little ping out every three minutes to ensure the connection is kept alive. This tip should work on most OpenSSH servers that allows access to its sshd_config file. Just make sure you close your connection if you really don't use it for some time.&lt;/p&gt;</description>
			<pubDate>Mon, 04 May 2009 17:10:23 +0200</pubDate>
			
			<guid>http://www.lxer.nl/webdevelopment/keep-ssh-connection-open-2/</guid>
		</item>
		
		<item>
			<title>LXer WebDevelopment</title>
			<link>http://www.lxer.nl/webdevelopment/home-2/</link>
			<description>&lt;p class=&quot;center&quot;&gt;&lt;strong&gt;&lt;br /&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p class=&quot;center&quot;&gt;&lt;strong&gt;This website is currently under construction and will be ready soon. &lt;/strong&gt;&lt;/p&gt;
&lt;p class=&quot;center&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class=&quot;center&quot;&gt;&lt;em&gt;For more information, email us at: &amp;nbsp; info@lxer.nl&lt;/em&gt;&lt;/p&gt;
&lt;p class=&quot;center&quot;&gt;&amp;nbsp;&lt;/p&gt;</description>
			<pubDate>Mon, 04 May 2009 17:07:39 +0200</pubDate>
			
			<guid>http://www.lxer.nl/webdevelopment/home-2/</guid>
		</item>
		
		<item>
			<title>ICT-security</title>
			<link>http://www.lxer.nl/webdevelopment/ict-security-2/</link>
			<description>&lt;p&gt;Tech security articles&lt;/p&gt;</description>
			<pubDate>Mon, 04 May 2009 17:08:38 +0200</pubDate>
			
			<guid>http://www.lxer.nl/webdevelopment/ict-security-2/</guid>
		</item>
		
		<item>
			<title>Fail2ban - Prevent Bruteforce Attacks </title>
			<link>http://www.lxer.nl/webdevelopment/fail2ban-prevent-bruteforce-attacks-2/</link>
			<description>&lt;p&gt;&amp;nbsp;Howto use Fail2Ban to lock out evil Haxxors after they fail trying to log in to your systems.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;em&gt; (ssh, apache, vsftp, proftp, wuftp, postfix, couriersmtp, sasl&lt;/em&gt;)&lt;/p&gt;
&lt;p&gt;general info:&lt;/p&gt;
&lt;p&gt;install (Debian):&lt;br /&gt; apt-get install fail.ban&lt;/p&gt;
&lt;p&gt;configuration files:&lt;br /&gt; /etc/fail2ban/fail2ban.conf&lt;br /&gt; /etc/fail2ban/jail.conf&lt;/p&gt;
&lt;p&gt;fail2ban.conf&lt;br /&gt; Default seetings seem to be ok.&lt;br /&gt; jail.conf&lt;br /&gt; In this file you can set&lt;br /&gt; #maxretry    change this to what you think is neccesary&lt;br /&gt; #bantime     #seconds for someone to be banned (default = 600)&lt;br /&gt; -enable the deamons you want to monitor&lt;br /&gt; -set the email address&lt;/p&gt;
&lt;p&gt;If you want to do some extra configuration&lt;br /&gt; (like set different logfiles or change the ban-action, then this can be done in this file (jail.conf). For standard use, these settings seem to be ok.&lt;/p&gt;
&lt;p&gt;filter.d&lt;br /&gt; jail.conf contains references to patterns in the folder filter.d&lt;br /&gt; New configurations can be added here.&lt;/p&gt;
&lt;p&gt;example conf.:&lt;/p&gt;
&lt;pre&gt;# &quot;ignoreip&quot; can be an IP address, a CIDR mask or a DNS host&lt;br /&gt;ignoreip = 127.0.0.1 192.168.0.99&lt;br /&gt;bantime  = 600&lt;br /&gt;maxretry = 3&lt;br /&gt;&lt;br /&gt;# &quot;backend&quot; specifies the backend used to get files modification. Available&lt;br /&gt;# options are &quot;gamin&quot;, &quot;polling&quot; and &quot;auto&quot;.&lt;br /&gt;# yoh: For some reason Debian shipped python-gamin didn't work as expected&lt;br /&gt;#      This issue left ToDo, so polling is default backend for now&lt;br /&gt;backend = polling&lt;br /&gt;&lt;br /&gt;#&lt;br /&gt;# Destination email address used solely for the interpolations in&lt;br /&gt;# jail.{conf,local} configuration files.&lt;br /&gt;destemail = root@localhost&lt;br /&gt;&lt;br /&gt;# Default action to take: ban only&lt;br /&gt;action = iptables[name=%(__name__)s, port=%(port)s]&lt;br /&gt;&lt;br /&gt;[ssh]&lt;br /&gt;&lt;br /&gt;enabled = true&lt;br /&gt;port    = ssh&lt;br /&gt;filter  = sshd&lt;br /&gt;logpath  = /var/log/auth.log&lt;br /&gt;maxretry = 5&lt;br /&gt;&lt;br /&gt;[apache]&lt;br /&gt;&lt;br /&gt;enabled = true&lt;br /&gt;port    = http&lt;br /&gt;filter  = apache-auth&lt;br /&gt;logpath = /var/log/apache*/*error.log&lt;br /&gt;maxretry = 5&lt;br /&gt;&lt;br /&gt;[apache-noscript]&lt;br /&gt;&lt;br /&gt;enabled = false&lt;br /&gt;port    = http&lt;br /&gt;filter  = apache-noscript&lt;br /&gt;logpath = /var/log/apache*/*error.log&lt;br /&gt;maxretry = 5&lt;br /&gt;&lt;br /&gt;# Ban hosts which agent identifies spammer robots crawling the web&lt;br /&gt;# for email addresses. The mail outputs are buffered.&lt;br /&gt;[apache-badbots]&lt;br /&gt;&lt;br /&gt;enabled  = false&lt;br /&gt;filter   = apache-badbots&lt;br /&gt;action   = iptables-multiport[name=BadBots, port=&quot;http,https&quot;]&lt;br /&gt;sendmail-buffered[name=BadBots, lines=5, dest=you@mail.com]&lt;br /&gt;logpath  = /var/www/*/logs/access_log&lt;br /&gt;bantime  = 172800&lt;br /&gt;maxretry = 1&lt;br /&gt;&lt;br /&gt;[apache-tcpwrapper]&lt;br /&gt;&lt;br /&gt;enabled  = false&lt;br /&gt;filter   = apache-auth&lt;br /&gt;action   = hostsdeny&lt;br /&gt;logpath  = /var/log/apache*/*access.log&lt;br /&gt;/home/www/myhomepage/access.log&lt;br /&gt;maxretry = 6&lt;br /&gt;&lt;br /&gt;# Use shorewall instead of iptables.&lt;br /&gt;&lt;br /&gt;[apache-shorewall]&lt;br /&gt;&lt;br /&gt;enabled  = false&lt;br /&gt;filter   = apache-noscript&lt;br /&gt;action   = shorewall&lt;br /&gt;sendmail[name=Postfix, dest=you@mail.com]&lt;br /&gt;logpath  = /var/log/apache2/error_log&lt;br /&gt;&lt;br /&gt;# This jail uses ipfw, the standard firewall on FreeBSD. The &quot;ignoreip&quot;&lt;br /&gt;# option is overridden in this jail. Moreover, the action &quot;mail-whois&quot; defines&lt;br /&gt;# the variable &quot;name&quot; which contains a comma using &quot;&quot;. The characters '' are&lt;br /&gt;# valid too.&lt;br /&gt;[ssh-ipfw]&lt;br /&gt;&lt;br /&gt;enabled  = false&lt;br /&gt;filter   = sshd&lt;br /&gt;action   = ipfw[localhost=192.168.0.1]&lt;br /&gt;sendmail-whois[name=&quot;SSH,IPFW&quot;, dest=you@mail.com]&lt;br /&gt;logpath  = /var/log/auth.log&lt;br /&gt;ignoreip = 168.192.0.1&lt;br /&gt;&lt;br /&gt;# These jails block attacks against named (bind9). By default, logging is off&lt;br /&gt;# with bind9 installation. You will need something like this:&lt;br /&gt;#&lt;br /&gt;# logging {&lt;br /&gt;#     channel lame-servers_file {&lt;br /&gt;#         file &quot;/var/log/named/lame-servers.log&quot; versions 3 size 30m;&lt;br /&gt;#         severity dynamic;&lt;br /&gt;#         print-time yes;&lt;br /&gt;#     };&lt;br /&gt;#     category lame-servers {&lt;br /&gt;#         lame-servers_file;&lt;br /&gt;#     };&lt;br /&gt;# }&lt;br /&gt;#&lt;br /&gt;# in your named.conf to provide proper logging.&lt;br /&gt;# This jail blocks UDP traffic for DNS requests.&lt;br /&gt;&lt;br /&gt;[named-refused-udp]&lt;br /&gt;&lt;br /&gt;enabled  = false&lt;br /&gt;filter   = named-refused&lt;br /&gt;action   = iptables-multiport[name=Named, port=&quot;domain,953&quot;, protocol=udp]&lt;br /&gt;sendmail-whois[name=Named, dest=you@mail.com]&lt;br /&gt;logpath  = /var/log/named/lame-servers.log&lt;br /&gt;ignoreip = 168.192.0.1&lt;br /&gt;&lt;br /&gt;[vsftpd]&lt;br /&gt;&lt;br /&gt;enabled  = false&lt;br /&gt;port     = ftp&lt;br /&gt;filter   = vsftpd&lt;br /&gt;logpath  = /var/log/auth.log&lt;br /&gt;maxretry = 5&lt;br /&gt;&lt;br /&gt;[proftpd]&lt;br /&gt;&lt;br /&gt;enabled  = true&lt;br /&gt;port     = ftp&lt;br /&gt;filter   = proftpd&lt;br /&gt;logpath  = /var/log/auth.log&lt;br /&gt;failregex = proftpd: \(pam_unix\) authentication failure; .* rhost=&amp;lt;HOST&amp;gt;&lt;br /&gt;maxretry = 5&lt;br /&gt;&lt;br /&gt;[wuftpd]&lt;br /&gt;&lt;br /&gt;enabled  = false&lt;br /&gt;port     = ftp&lt;br /&gt;filter   = wuftpd&lt;br /&gt;logpath  = /var/log/auth.log&lt;br /&gt;maxretry = 5&lt;br /&gt;&lt;br /&gt;[postfix]&lt;br /&gt;&lt;br /&gt;enabled  = false&lt;br /&gt;port     = smtp&lt;br /&gt;filter   = postfix&lt;br /&gt;logpath  = /var/log/mail.log&lt;br /&gt;maxretry = 5&lt;br /&gt;&lt;br /&gt;[courierpop3]&lt;br /&gt;&lt;br /&gt;enabled  = true&lt;br /&gt;port     = pop3&lt;br /&gt;filter   = courierlogin&lt;br /&gt;failregex = courierpop3login: LOGIN FAILED.*ip=\[.*:&amp;lt;HOST&amp;gt;\]&lt;br /&gt;logpath  = /var/log/mail.log&lt;br /&gt;maxretry = 5&lt;br /&gt;&lt;br /&gt;[courierimap]&lt;br /&gt;&lt;br /&gt;enabled  = true&lt;br /&gt;port     = imap2&lt;br /&gt;filter   = courierlogin&lt;br /&gt;failregex = imapd: LOGIN FAILED.*ip=\[.*:&amp;lt;HOST&amp;gt;\]&lt;br /&gt;logpath  = /var/log/mail.log&lt;br /&gt;maxretry = 5&lt;br /&gt;&lt;br /&gt;[sasl]&lt;br /&gt;&lt;br /&gt;enabled  = true&lt;br /&gt;port     = smtp&lt;br /&gt;filter   = sasl&lt;br /&gt;failregex = warning: [-._\w]+\[&amp;lt;HOST&amp;gt;\]: SASL (?:LOGIN|PLAIN|(?:CRAM|DIGEST)-MD5) authentication failed&lt;br /&gt;logpath  = /var/log/mail.log&lt;br /&gt;maxretry = 5&lt;/pre&gt;</description>
			<pubDate>Mon, 04 May 2009 17:08:38 +0200</pubDate>
			
			<guid>http://www.lxer.nl/webdevelopment/fail2ban-prevent-bruteforce-attacks-2/</guid>
		</item>
		
		<item>
			<title>Apache Analyser</title>
			<link>http://www.lxer.nl/webdevelopment/apache-analyser-2/</link>
			<description>&lt;h3&gt;Getting usefull statistics from your Apache logs&lt;/h3&gt;
&lt;p&gt;If you're running Apache or a similar web server that uses the Common Log Format, there's quite a bit of quick statistical analysis that can be done with a shell script. The standard configuration for a server has an access_log and error_log written for the site; even ISPs make these raw data files available to customers, but if you've got your own server, you should definitely have and be archiving this valuable information.&lt;/p&gt;
&lt;p&gt;This bash script returns valuable statistics about your website:&lt;/p&gt;
&lt;pre&gt;#!/bin/sh&lt;br /&gt;&lt;br /&gt;# webaccess - analyze an Apache-format access_log file, extracting&lt;br /&gt;# useful and interesting statistics&lt;br /&gt;&lt;br /&gt;bytes_in_gb=1048576&lt;br /&gt;scriptbc=&quot;$HOME/bin/scriptbc&quot;&lt;br /&gt;nicenumber=&quot;$HOME/bin/nicenumber&quot;&lt;br /&gt;host=&quot;intuitive.com&quot;&lt;br /&gt;&lt;br /&gt;if [ $# -eq 0 -o ! -f &quot;$1&quot; ] ; then&lt;br /&gt;echo &quot;Usage: $(basename $0) logfile&quot; &amp;gt;&amp;amp;2&lt;br /&gt;exit 1&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;firstdate=&quot;$(head -1 &quot;$1&quot; | awk '{print $4}' | sed 's/\[//')&quot;&lt;br /&gt;lastdate=&quot;$(tail -1 &quot;$1&quot; | awk '{print $4}' | sed 's/\[//')&quot;&lt;br /&gt;&lt;br /&gt;echo &quot;Results of analyzing log file $1&quot;&lt;br /&gt;echo &quot;&quot;&lt;br /&gt;echo &quot; Start date: $(echo $firstdate|sed 's/:/ at /')&quot;&lt;br /&gt;echo &quot; End date: $(echo $lastdate|sed 's/:/ at /')&quot;&lt;br /&gt;&lt;br /&gt;hits=&quot;$(wc -l &amp;lt; &quot;$1&quot; | sed 's/[^[:digit:]]//g')&quot;&lt;br /&gt;&lt;br /&gt;echo &quot; Hits: $($nicenumber $hits) (total accesses)&quot;&lt;br /&gt;&lt;br /&gt;pages=&quot;$(grep -ivE '(.txt|.gif|.jpg|.png)' &quot;$1&quot; | wc -l | sed 's/[^[:digit:]]//g')&quot;&lt;br /&gt;&lt;br /&gt;echo &quot; Pageviews: $($nicenumber $pages) (hits minus graphics)&quot;&lt;br /&gt;&lt;br /&gt;totalbytes=&quot;$(awk '{sum+=$10} END {print sum}' &quot;$1&quot;)&quot;&lt;br /&gt;&lt;br /&gt;echo -n &quot; Transferred: $($nicenumber $totalbytes) bytes &quot;&lt;br /&gt;&lt;br /&gt;if [ $totalbytes -gt $bytes_in_gb ] ; then&lt;br /&gt;echo &quot;($($scriptbc $totalbytes / $bytes_in_gb) GB)&quot;&lt;br /&gt;elif [ $totalbytes -gt 1024 ] ; then&lt;br /&gt;echo &quot;($($scriptbc $totalbytes / 1024) MB)&quot;&lt;br /&gt;else&lt;br /&gt;echo &quot;&quot;&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;# now let's scrape the log file for some useful data:&lt;br /&gt;&lt;br /&gt;echo &quot;&quot;&lt;br /&gt;echo &quot;The ten most popular pages were:&quot;&lt;br /&gt;&lt;br /&gt;awk '{print $7}' &quot;$1&quot; | grep -ivE '(.gif|.jpg|.png)' | \&lt;br /&gt;sed 's/\/$//g' | sort | \&lt;br /&gt;uniq -c | sort -rn | head -10&lt;br /&gt;&lt;br /&gt;echo &quot;&quot;&lt;br /&gt;&lt;br /&gt;echo &quot;The ten most common referrer URLs were:&quot;&lt;br /&gt;&lt;br /&gt;awk '{print $11}' &quot;$1&quot; | \&lt;br /&gt;grep -vE &quot;(^&quot;-&quot;$|/www.$host|/$host)&quot; | \&lt;br /&gt;sort | uniq -c | sort -rn | head -10&lt;br /&gt;&lt;br /&gt;echo &quot;&quot;&lt;br /&gt;exit 0&lt;/pre&gt;</description>
			<pubDate>Mon, 04 May 2009 17:01:46 +0200</pubDate>
			
			<guid>http://www.lxer.nl/webdevelopment/apache-analyser-2/</guid>
		</item>
		
		<item>
			<title>Retrieve links and emailaddresses from some webpage </title>
			<link>http://www.lxer.nl/webdevelopment/links-and-emailaddresses-2/</link>
			<description>&lt;p&gt;This script started as a Bash coding exercise but turned out to be a very useful way of getting data from websites, and it contains many useful little coding tricks.&lt;/p&gt;
&lt;pre&gt;#!/bin/sh&lt;br /&gt;&lt;br /&gt;##############################################&lt;br /&gt;NAME_=&quot;webextract&quot;&lt;br /&gt;PURPOSE_=&quot;extract links and/or email-addresses from a webpage&quot;&lt;br /&gt;SYNOPSIS_=&quot;$NAME_ [-e  ] [-l  ] &quot;&lt;br /&gt;OPTIONS_=&quot;&lt;br /&gt;   -e     extract all emailaddresses from a url&lt;br /&gt;   -l     extract all links from url&lt;br /&gt;   -h          show help (this)&quot;&lt;br /&gt;REQUIRES_=&quot;Curl&quot;&lt;br /&gt;VERSION_=&quot;0.9&quot;&lt;br /&gt;PUROSE_=&quot;&quot;&lt;br /&gt;#Created by Lx&lt;br /&gt;#licence : GPL3&lt;br /&gt;#################################################&lt;br /&gt;&lt;br /&gt;usage () {&lt;br /&gt;echo &amp;gt;&amp;amp;2 &quot;&lt;br /&gt;\033[1m$NAME_ $VERSION_ \033[0m - $PURPOSE_&lt;br /&gt;Usage: $SYNOPSIS_&lt;br /&gt;Options: $OPTIONS_&lt;br /&gt;&quot;&lt;br /&gt;    exit 1&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;# tmp file set up&lt;br /&gt;tmp_1=/tmp/tmp.${RANDOM}$$&lt;br /&gt;&lt;br /&gt;# signal trapping and tmp file removal&lt;br /&gt;trap 'rm -f $tmp_1 &amp;gt;/dev/null 2&amp;gt;&amp;amp;1' 0&lt;br /&gt;trap &quot;exit 1&quot; 1 2 3 15&lt;br /&gt;&lt;br /&gt;extract () {&lt;br /&gt; while getopts &quot;:e:l:h:&quot; optname&lt;br /&gt;   do&lt;br /&gt;      case &quot;$optname&quot; in&lt;br /&gt;         &quot;e&quot;)&lt;br /&gt;         curl -s -S $OPTARG |{&lt;br /&gt;         tr ',;&amp;lt;&amp;gt;()&quot;\47 ' '[\n*]' | sed -n -e 's/mailto://gI' -e '/@/p'  &amp;gt; $tmp_1&lt;br /&gt;         cat $tmp_1&lt;br /&gt;         }&lt;br /&gt;            ;;&lt;br /&gt;         &quot;l&quot;)&lt;br /&gt;         curl -s -S $OPTARG |{&lt;br /&gt;         tr '&amp;lt;&amp;gt;&quot;\47 ' '[\n*]' | sed -n -e 's/href=//gI' -e 's/src=//gI' -e '/http:/Ip' &amp;gt; $tmp_1&lt;br /&gt;         cat $tmp_1&lt;br /&gt;         }&lt;br /&gt;            ;;&lt;br /&gt;         &quot;h&quot;)&lt;br /&gt;            usage&lt;br /&gt;            ;;&lt;br /&gt;         &quot;?&quot;)&lt;br /&gt;            echo &quot; Unknown option $OPTARG&quot;&lt;br /&gt;            usage&lt;br /&gt;            ;;&lt;br /&gt;         &quot;:&quot;)&lt;br /&gt;            usage&lt;br /&gt;            ;;&lt;br /&gt;         *)&lt;br /&gt;         # should not occur&lt;br /&gt;            echo &quot;unknown error&quot;&lt;br /&gt;            ;;&lt;br /&gt;         esac&lt;br /&gt;      done&lt;br /&gt;   return $OPTIND&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;showargs () {&lt;br /&gt;  for p in &quot;$@&quot;&lt;br /&gt;    do&lt;br /&gt;      echo &quot;[$p]&quot;&lt;br /&gt;    done&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;###&lt;br /&gt;if [ $# != 0 ]; then&lt;br /&gt;   extract  $@&lt;br /&gt;else&lt;br /&gt;   usage&lt;br /&gt;fi&lt;/pre&gt;</description>
			<pubDate>Mon, 04 May 2009 17:00:42 +0200</pubDate>
			
			<guid>http://www.lxer.nl/webdevelopment/links-and-emailaddresses-2/</guid>
		</item>
		
		<item>
			<title>Word Definitions (commandline Application)</title>
			<link>http://www.lxer.nl/webdevelopment/word-definitions-2/</link>
			<description>&lt;h4&gt;Get definitions for any word using the commandline.&lt;/h4&gt;
&lt;p&gt;This script is almost the same as the Synonyms script.&lt;br /&gt; (look for more info there)&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&amp;nbsp;lxer@server:~$&amp;nbsp; ./definition.py python&lt;br /&gt; Overview of noun python&lt;br /&gt; The noun python has 3 senses? (first 1 from tagged texts)&lt;br /&gt; 1. (3) python  (large Old World boas)&lt;/p&gt;
&lt;p&gt;2. python  (a soothsaying spirit or a person who is possessed by such a spirit)&lt;/p&gt;
&lt;p&gt;3. Python  ((Greek mythology) dragon killed by Apollo at Delphi)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;pre&gt;#!/usr/bin/python&lt;br /&gt;&lt;br /&gt;# get synonyms for any word from synonym.com&lt;br /&gt;# uses python + beautifulsoup&lt;br /&gt;&lt;br /&gt;import re, urllib, sys&lt;br /&gt;from BeautifulSoup import BeautifulSoup&lt;br /&gt;&lt;br /&gt;if (len(sys.argv) &amp;gt; 1):&lt;br /&gt;   word = sys.argv[1]&lt;br /&gt;else:&lt;br /&gt;   print &quot; usage:  synon word&quot;&lt;br /&gt;   exit(0)&lt;br /&gt;&lt;br /&gt;url = &quot;http://www.synonym.com/definition/&quot;+word&lt;br /&gt;f = urllib.urlopen(url)&lt;br /&gt;doc = f.read()&lt;br /&gt;&lt;br /&gt;soup = BeautifulSoup(''.join(doc))&lt;br /&gt;&lt;br /&gt;def strip_tags(value):&lt;br /&gt;   return re.sub(r'&amp;lt;[^&amp;gt;]*?&amp;gt;', '', value)&lt;br /&gt;&lt;br /&gt;divs = soup.findAll('div')&lt;br /&gt;result =  str(divs[9])&lt;br /&gt;result = result.replace(&quot;&amp;lt;br /&amp;gt;&quot;, &quot;\n&quot;)&lt;br /&gt;result = strip_tags(result)&lt;br /&gt;#remove empty lines&lt;br /&gt;a = result.split('\n')&lt;br /&gt;for b in a:&lt;br /&gt;   if b:&lt;br /&gt;      print b&lt;/pre&gt;</description>
			<pubDate>Mon, 04 May 2009 16:57:34 +0200</pubDate>
			
			<guid>http://www.lxer.nl/webdevelopment/word-definitions-2/</guid>
		</item>
		
		<item>
			<title>Gmail use command-line to check for new messages </title>
			<link>http://www.lxer.nl/webdevelopment/gmail-2/</link>
			<description>&lt;h3&gt;bash script for checking your gmail accounts&lt;/h3&gt;
&lt;p&gt;(This is probably one of the scripts that I use the most)&lt;br /&gt; Having multiple gmail accounts can be usefull, however opening your browser, logging in and out (multiple times) is annoying, especially when there wasn't really a new email.&lt;/p&gt;
&lt;p&gt;This bash script checks your gmail accounts, and reports how many new messages are in your inbox. Also, it activates your ScrLock led on your keyboard (really, when did you use that button anyway...?).&lt;/p&gt;
&lt;p&gt;To get the led function working, you might have to do this first:&lt;/p&gt;
&lt;pre&gt;lxer@local:~$  xmodmap -e 'add mod3 = Scroll_Lock'&lt;/pre&gt;
&lt;p&gt;or add it to modmap: nano ~/.Xmodmap ,  add mod3 = Scroll_Lock&lt;/p&gt;
&lt;pre&gt;#! /bin/bash&lt;br /&gt;# checking for new emails @ gmail&lt;br /&gt;&lt;br /&gt;# created by Lxer 2008&lt;br /&gt;#&lt;br /&gt;&lt;br /&gt;# check your modifier keysettings:  xmodmap&lt;br /&gt;# to get scroll lock led working: xmodmap -e 'add mod3 = Scroll_Lock'&lt;br /&gt;#  or add it to modmap: gedit ~/.Xmodmap ,  add mod3 = Scroll_Lock&lt;br /&gt;&lt;br /&gt;# to have this script running in the background and checking&lt;br /&gt;# it  repeatedly, use:&lt;br /&gt;#   sudo watch --interval=300 gmail &amp;amp;&amp;gt; /dev/null &amp;amp;&lt;br /&gt;# or set as cronjob&lt;br /&gt;#&lt;br /&gt;#####################&lt;br /&gt;# replace these with your account settings :&lt;br /&gt;username=( username1 username2 username3 )&lt;br /&gt;passwd=( pass1 pass2 pass3 )&lt;br /&gt;tempfile=&quot;/var/tmp/gm/&quot;&lt;br /&gt;&lt;br /&gt;#########&lt;br /&gt;a=0&lt;br /&gt;for (( i = 0 ; i &amp;lt; ${#username[@]} ; i++ )) ; do&lt;br /&gt;   wget -q -P $tempfile https://${username[$i]}:${passwd[$i]}@mail.google.com/mail/feed/atom&lt;br /&gt;   if [ -f $tempfile&quot;atom&quot; ]; then&lt;br /&gt;      email=`sed -n -e 's/&amp;lt;\/*fullcount&amp;gt;//pg'  $tempfile&quot;atom&quot;`&lt;br /&gt;   if [ &quot;$email&quot; != &quot;0&quot; ]; then&lt;br /&gt;      echo -e &quot;New emails: \033[1m $email \033[0m  account: \033[1m ${username[$i]}  \033[0m&quot;&lt;br /&gt;      sed -n -e 's/&amp;lt; \/*summary&amp;gt;/\r/pg' $tempfile&quot;atom&quot;&lt;br /&gt;      a=1&lt;br /&gt;   fi&lt;br /&gt;   rm $tempfile&quot;atom&quot;&lt;br /&gt;else&lt;br /&gt;   echo $name3 : Login failed.&lt;br /&gt;fi&lt;br /&gt;done&lt;br /&gt;&lt;br /&gt;# print url for easy access&lt;br /&gt;if [ $a -eq 1 ]; then&lt;br /&gt;   echo &quot;http://www.gmail.com&quot;&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;#blinkenlight&lt;br /&gt;if [[ $EUID -eq 0 ]]; then # only if root&lt;br /&gt;   if [ $a -eq 1 ]; then&lt;br /&gt;      ledcontrol set s5 on&lt;br /&gt;   else&lt;br /&gt;      ledcontrol set s5 off&lt;br /&gt;   fi&lt;br /&gt;fi&lt;/pre&gt;
&lt;p&gt;Save this file as, for example, 'gmail' and put it in your /usr/bin folder (and make it executable). A cronjob can be used to run this script like every 5 minutes or so.&lt;/p&gt;</description>
			<pubDate>Tue, 14 Apr 2009 15:31:06 +0200</pubDate>
			
			<guid>http://www.lxer.nl/webdevelopment/gmail-2/</guid>
		</item>
		

	</channel>
</rss>
