Block 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 -P /root/ –output-document=/root/ unzip /root/ > /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 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”;