Code refactoring

Feb 21
2009

An example (The Bible, Genesis 1)

1: In the beginning God created the heaven and the earth.



4: And God saw the light, that it was good: and God divided the light from the darkness.

… and God saw that it was good.

… and God saw that it was good.



and so on …

iptables – blocking incoming traffic

Feb 14
2009

This iptables config will block all incoming traffic, except from machines, identified by thier MAC addresses:

iptables -F INPUT

iptables -A INPUT -m mac—mac-source 00:3f:5f:ab:2c:7d -j ACCEPT

iptables -A INPUT -m mac—mac-source 00:1e:32:36:97:4a -j ACCEPT

iptables -A INPUT -m mac—mac-source 00:44:11:a5:1d:6d -j ACCEPT

# or by ip address:

#iptables -A INPUT -p tcp -s 1.1.1.1 -j ACCEPT

#iptables -A INPUT -p tcp -s 2.2.2.2 -j ACCEPT

#iptables -A INPUT -p tcp -s 3.3.3.3 -j ACCEPT

iptables -A INPUT -m state—state ESTABLISHED -j ACCEPT

iptables -A INPUT -s 127.0.0.1 -j ACCEPT

iptables -A INPUT -j REJECT

PS1 colors

Feb 14
2009

I like to see green prompt for userid > 0 and red for root, also the hostname and the history number of a command.

PS1="\[\e[32;1m\]\u\[\e[30;1m\]@\[\e[32;1m\]\H[\!]\W\[\e[30;1m\]\\$\[\e[0m\]"
PS1="\[\e[32;1m\]\u\[\e[30;1m\]@\[\e[32;1m\]\H[\!]\W\[\e[30;1m\]\\$\[\e[0m\]"

just another perlmonks’ post

Feb 06
2009

perldoc perlfaq1 | perl -ne ’/((?< =”)(.+hack…(?:OR)?))/&&die$2.$/’ -

Calendar

February 2009
M T W T F S S
« Jan   Mar »
 1
2345678
9101112131415
16171819202122
232425262728  

Tags