<?xml version="1.0" encoding="ISO-8859-1"?>
<feed version="0.3" xmlns="http://purl.org/atom/ns#" xml:lang="en-US">
	<title>Jack Hacks</title>
	<link rel="alternate" type="text/html" href="http://www.notany.net/blog/index.php" />
	<modified>2012-05-20T14:15:33Z</modified>
	<author>
		<name>Jack</name>
	</author>
	<copyright>Copyright 2012, Jack</copyright>
	<generator url="http://www.sourceforge.net/projects/sphpblog" version="0.5.1">SPHPBLOG</generator>
	<entry>
		<title>MacBook Unibody fix</title>
		<link rel="alternate" type="text/html" href="http://www.notany.net/blog/index.php?entry=entry120319-121922" />
		<content type="text/html" mode="escaped"><![CDATA[Simple and inexpensive fix for MacBook Unibody.<br /><br />I own MacBook since 2009 and about 8 months after purchase the small black legs at the bottom started to peel off. These are with quite complicated design - very thin internal and external plastic mounting parts underneath the rubber-like plastic leg. The problem is that plastic ages faster due to constant heating and become fragile and brakes.<br /><br />What I did was to buy a set of rubber pipe seals for showers (5 pieces 20mm in diameter for about $0.50) and replace all the original legs using double adhesive tape.<br /><br />Here is the resulting look.<br /><br /><a href="javascript:openpopup('http://notany.net/images/macfix/bottom.jpg',800,600,false);"><img src="http://notany.net/images/macfix/bottom.jpg" border="0" alt="" /></a><br /><br />]]></content>
		<id>http://www.notany.net/blog/index.php?entry=entry120319-121922</id>
		<issued>2012-03-19T00:00:00Z</issued>
		<modified>2012-03-19T00:00:00Z</modified>
	</entry>
	<entry>
		<title>Useful exim commands</title>
		<link rel="alternate" type="text/html" href="http://www.notany.net/blog/index.php?entry=entry100122-193406" />
		<content type="text/html" mode="escaped"><![CDATA[Here are some helpful hints on exim administration. All of the commands are formated for debian (exim4) but are also tested on centos (exim).<br /><br />List message count in message queue:<br /><code># exim4 -bpc</code><br /><br />List all messages in the queue, sorted by date:<br /><code># exim4 -bp</code><br /><br />Print message headers:<br /><code># exim4 -Mvh 1NY1cq-0003jb-Qh</code><br /><br />Print message body:<br /><code># exim4 -Mvb 1NY1cq-0003jb-Qh</code><br /><br />Print message logs:<br /><code># exim4 -Mvl 1NY1cq-0003jb-Qh</code><br /><br />Remove message from queue:<br /><code># exim4 -Mrm 1NY1cq-0003jb-Qh</code><br /><br />Force message delivery:<br /><code># exim4 -M 1NY1cq-0003jb-Qh</code><br /><br />Print count of all messages<br />- from specified sender (From:):<br /><code># exiqgrep -f &quot;user@domain.com&quot; -c</code><br /><br />- from specified sender domain:<br /><code># exiqgrep -f &quot;domain.com&quot; -c</code><br /><br />- for specified recipient:<br /><code># exiqgrep -r &quot;user@domain.com&quot; -c</code><br /><br />Print message IDs for all messages from specified sender and pipe them to exim for deletion:<br /><code># exiqgrep -f &quot;user@domain.com&quot; -i | xargs exim4 -Mrm</code><br /><br />Sometimes exiqgrep throws an error for nonexistent message or so, commonly caused by frequent server restarts or out of disk space conditions. This is easily fixed by deleting the printed message ID. But sometimes these errors are too many to fix one by one. To get around the problem I use a simple bash script (tested on debian and centos):<br /><code><br />while [ -n &quot;`exiqgrep -r &#039;president&#039; 2&gt;&amp;1 | awk &#039;{if($3 != &quot;id&quot;)print $4}&#039; | xargs exim4 -Mrm`&quot; ]; do echo Deleting erroneous message...; done<br /></code><br /><br />It is always useful to collect some statistics on any running service. For exim you can do it like this:<br /><code># tail -20000 /var/log/exim4/mainlog | eximstats -nr | less</code><br />Depending on your exim configuration it could be meaningful or not :)<br /><br />Hope the above would help anyone.]]></content>
		<id>http://www.notany.net/blog/index.php?entry=entry100122-193406</id>
		<issued>2010-01-22T00:00:00Z</issued>
		<modified>2010-01-22T00:00:00Z</modified>
	</entry>
	<entry>
		<title>List user open sockets on cPanel server</title>
		<link rel="alternate" type="text/html" href="http://www.notany.net/blog/index.php?entry=entry070317-004147" />
		<content type="text/html" mode="escaped"><![CDATA[As simple as this:<br /><b><br /><code><br />lsof -n -u^65534,^`cat /etc/passwd | awk -F&#039;:&#039; &#039;{if($3 &lt; 32000) print $3}&#039; | xargs | sed -e &#039;s/ /,\^/g&#039;` -i | awk &#039;{if ($2 ~ /[0-9]*/) print $3, $1}&#039; | sort | uniq -c | sort -n<br /></code><br /></b><br />The awk part is for excluding the system users ids &lt; 32000.]]></content>
		<id>http://www.notany.net/blog/index.php?entry=entry070317-004147</id>
		<issued>2007-03-16T00:00:00Z</issued>
		<modified>2007-03-16T00:00:00Z</modified>
	</entry>
	<entry>
		<title>How to extract SYN packets with tcpdump</title>
		<link rel="alternate" type="text/html" href="http://www.notany.net/blog/index.php?entry=entry070221-233617" />
		<content type="text/html" mode="escaped"><![CDATA[<b>tcpdump</b><br /><b><code><br /># tcpdump -ne dst port 80 and &#039;tcp[13] &amp; 2 == 2&#039;<br /></code></b><br />This way effectively filtering only SYN packets on port 80.<br /><br /><b><code><br /># tcpdump -c 30000 -ne dst port 80 and &#039;tcp[13] &amp; 2 == 2&#039; | awk &#039;{print $11}&#039; | cut -d. -f1|sort | uniq -c | sort -n<br /></code></b><br />Dumping 30K packets,cutting the first octet from the IPs and sorting by number of packets originating from this A class net.<br /><br />A bit more complicated:<br /><b><code><br /># for i in `tcpdump -c 30000 -ne dst port 80 and &#039;tcp[13] &amp; 2 == 2&#039; | awk &#039;{print $11} | cut -d. -f1|sort | uniq -c | awk &#039;{if ($1 &gt; 4000) print $2}&#039;`; do \<br />      iptables -I INPUT -s $i.0.0.0/8 -j DROP; \<br />done<br /></code></b><br />Dumping 30K packets and if more than 4000 packets originate from the same A class net - block the net via iptables.]]></content>
		<id>http://www.notany.net/blog/index.php?entry=entry070221-233617</id>
		<issued>2007-02-21T00:00:00Z</issued>
		<modified>2007-02-21T00:00:00Z</modified>
	</entry>
	<entry>
		<title>WPA for Ubuntu</title>
		<link rel="alternate" type="text/html" href="http://www.notany.net/blog/index.php?entry=entry070218-005903" />
		<content type="text/html" mode="escaped"><![CDATA[It is a bit tricky (took me almost two days :), but basically this is the procedure:<br /><br /><b>- configure your wireless card</b><br />(using ndiswrapper is described in another article)<br />in case your wifi card is identified as wlan0 add the following to <i>/etc/network/interfaces</i><br /><code><br />auto wlan0<br />iface wlan0 inet dhcp<br />pre-up wpa_supplicant -Bw -Dwext -iwlan0 -c/etc/wpa_supplicant.conf<br />post-down killall -q wpa_supplicant<br /></code><br /><br /><b>- install and configure <i>wpasupplicant</i></b><br /><code># apt-get install wpasupplicant</code><br /><br />create <i>/etc/wpa_supplicant.conf</i> with simular content <br /><code><br />network={<br />  ssid=&quot;testwlan&quot;<br />  psk=&quot;7cHBV294H_something_long_and complicate&quot;<br />  scan_ssid=1<br />  key_mgmt=WPA-PSK<br />  proto=WPA<br />  pairwise=CCMP TKIP<br />  group=CCMP TKIP<br />}<br /></code><br /><br />This would automatically engage/shutdown wpasupplicant on up/down of the wlan0 interface.<br />Works nice for me :)]]></content>
		<id>http://www.notany.net/blog/index.php?entry=entry070218-005903</id>
		<issued>2007-02-17T00:00:00Z</issued>
		<modified>2007-02-17T00:00:00Z</modified>
	</entry>
	<entry>
		<title>Make BASH update your terminal window title after logon</title>
		<link rel="alternate" type="text/html" href="http://www.notany.net/blog/index.php?entry=entry070218-004821" />
		<content type="text/html" mode="escaped"><![CDATA[<b>~/.bash_profile</b><br /><br />This code would do the trick:<br /><br /><pre><br />if [ &quot;$TERM&quot; = &quot;xterm&quot; ] ; then<br />    export PROMPT_COMMAND=&#039;echo -ne &quot;\033]0;${USER}@${HOSTNAME}\007&quot;&#039;<br />else<br />    unset PROMPT_COMMAND<br />fi<br /></pre><br /><br />After logon the terminal title would be updated in the form &#039;jack@server&#039; and after logout the old value will be restored.]]></content>
		<id>http://www.notany.net/blog/index.php?entry=entry070218-004821</id>
		<issued>2007-02-17T00:00:00Z</issued>
		<modified>2007-02-17T00:00:00Z</modified>
	</entry>
	<entry>
		<title>FreeBSD rc.firewall fix for blacklisted ip support</title>
		<link rel="alternate" type="text/html" href="http://www.notany.net/blog/index.php?entry=entry070218-002731" />
		<content type="text/html" mode="escaped"><![CDATA[<b>/etc/rc.firewall</b><br /><br />Add this code at the end of the set_loopback function:<br /><br /><pre><br />        if [ -f &quot;${banned_ips}&quot; ]; then<br />                for i in `cat ${banned_ips} | grep -vE &quot;^#&quot;`; do<br />                        echo ${fwcmd} add deny ip from ${i} to me<br />                done<br />        fi<br /></pre><br /><br />This expects a variable banned_ips to be defined in rc.conf and to point to a file containing list (one per line) of blacklisted IPs/NETs in the form:<br /><br /><pre><br />192.168.1.0/24<br />10.2.2.2<br /># This is a comment<br /></pre><br /><br />Firewall rules would be up on the next reboot or after running /etc/netstart. <br /><br />This is more a way to preserve blocked IPs/NETs across the reboots.]]></content>
		<id>http://www.notany.net/blog/index.php?entry=entry070218-002731</id>
		<issued>2007-02-17T00:00:00Z</issued>
		<modified>2007-02-17T00:00:00Z</modified>
	</entry>
</feed>

