Block stopforumspam.com IP’s through iptables

WARNING: The following code will REPLACE your existing firewall rules as it uses iptables-restore in order to add hundreds of individual ip rules into the INPUT chain very fast. #!/bin/bash rm -f /root/listed_ip_* wget -q -c –no-cache http://www.stopforumspam.com/downloads/listed_ip_90.zip -P /root/ –output-document=/root/listed_ip_90.txt.zip unzip /root/listed_ip_90.txt.zip > /dev/null BLOCKDB=/root/listed_ip_90.txt echo “*filter” >/tmp/iptables-save echo “:INPUT ACCEPT [0:0]” >>/tmp/iptables-save echo…

SPL-C ERROR – Please use the proper driver on Samsung CLP-310N printer

If you get this error written on the test page when using Ubuntu or any other Linux distribution, you should install the Samsung Unified Driver. I’ve followed the tutorial on http://ubuntuforums.org/showthread.php?t=341621 point II.c and then I’ve added the network printer as lpd:///PASSTHRU with Make and Model “Samsung CLP-310 Series (SPL-C)” (NOT Samsung CLP-310 Foomatic/foo2qpdl)

How to programmatically dump the threads list of a running java process in bash

It seems that jdb cannot accept commands from command line, so we must use expect. I created the following expect script dumpthreads You can use it like: dumpthreads java_process_pid #!/usr/bin/expect set pid [lindex $argv 0]; spawn jdb -connect sun.jvm.hotspot.jdi.SAPIDAttachingConnector:pid=$pid; expect “>”; send “threads\n”; expect “>”; send “quit\n”;

How to convert DVD iso to avi using mplayer

Here is a python script to convert an .iso of a DVD to avi and to encode it using mpeg4. It is a slightly modified version of the script found at http://lists.mplayerhq.hu/pipermail/mplayer-users/2003-April/032226.html to work with newer versions of mplayer/mencoder. Later edit: It seems that mplayer/mencoder know to play/convert .iso files directly so we can do:…

How to convince the SmartGWT ListGrid to automatically fetch from the server only the data it displays

Since I was looking all over the net how to do this and I only found pieces of information, here is an example: [java] public class OperationsGrid extends ListGrid{ OperationsGrid(){ super(); TreeGridField accNoField = new TreeGridField(“accountNo”, 150); TreeGridField commentField = new TreeGridField(“comment”, 150); setFields(accNoField,commentField); setHeight100(); setWidth100(); setAutoFetchData(true); setAlternateRecordStyles(true); setDataSource(OperationsDS.getInstance()); setShowFilterEditor(true); } } [/java] [java] public…

MySQL Java SQLException error codes enum

Because I had this problem and I could not find a list of MySQL error codes on the Internet, I’ve decided to implement my own MySQL error codes enum. It is based on MySQL 5.1.35 sources, include/mysqld_ername.h file. Now I can do something like this: [java] catch (SQLException e) { if(e.getErrorCode() == MySQLExceptionCode.ER_DUP_ENTRY.getErrorCode()){ r =…