HELO example.com
MAIL FROM: user@example.com
RCPT TO: otheruser@example.com
RCPT TO: anotheruser@example.com
DATA
From: spammer@example.com
To: people@example.com
Subject: spam alert
Buy my crappy product!!
only $19.95
Get the version of sendmail
/usr/lib/sendmail -d0 < /dev/null | grep -i version
awk '{SUM=$5+SUM} END {print SUM,"in kbytes"}' < datafile
Override an ActiveRecord accessor method
class Ipinterface < ActiveRecord::Base
def macaddress=(macaddr)
super(Ipinterface.sanitize_macaddress(macaddr))
end
def macaddress
Ipinterface.sanitize_macaddress(super)
end
def Ipinterface.sanitize_macaddress(macaddr)
# Take a MAC address that looks like:
# 0:14:4f:8b:7:ba
# and convert it to
# 00:14:4f:8b:07:ba
split_mac = macaddr.split(/:/)
adjusted_mac = Array.new
split_mac.each do |bytes|
adjusted_mac << bytes.rjust(2,"0")
end
adjusted_mac.join(':')
end
end
Set up SSH port forwarding through an intermediary host