I have this knote on my desktop that I use to keep track of commands I use often, but not frequently enough to remember by heart. Its gets fairly long, and is invaluable for me in my daily internet building tasks. I occasionally clean it out, removing things I never use, have found better solutions for, or I just remember now without a reference to prompt me. I decided this time I should share some of these items so that others may reap the benefits of my collecting. Enjoy!
- # synflood listing (bash)
netstat -n -p | grep SYN_REC | awk '{print $5}' | awk -F: '{print $1}'- # current port 80 connections (bash)
netstat -an | grep :80 | sort- # bash for next loop
for i in `locate php~`;do echo $i;done- # sed text replace (bash)
sed -e s/$IN/$OUT/g $FILE > $NEWFILE- # ssh forward port 2525 to port 25 (bash)
ssh -NfC -R 2525:208.185.251.170:25 208.185.251.170
this is useful to provide clients a way to connect to your smtp server when their local port 25 is blocked. It's even easier to use rinetd.- # forward port 2525 to port 25 (rinetd.conf entry)
0.0.0.0 2525 192.168.0.100 25
**note! do not forward to an IP address that is in your 'mynetworks' entry in your postfix main.cf file, otherwise you will open a relay on port 2525 because postfix will see the mail coming in from there and not the originating IP.- # mail from command line (bash)
mail -s "Advomatic Test Email" -r from@advomatic.com to@advomatic.com- # new mysql user (sql)
grant all privileges on database.* to username@'192.168.1.%' identified by 'password'; flush privileges;- # mysql update across tables (sql)
UPDATE destination_table fd, source_table fs SET fd.options=fs.options WHERE fs.id=14 AND fd.id=5;- # mod_rewrite image redirect by referrer (apache conf or .htaccess)
RewriteCond %{HTTP_REFERER} ^http://hotlinker\.blogspot\.com/ [NC]
RewriteRule \.(jpe?g|gif|bmp|png)$ unseemlyimages/holyhell.gif [L]
this is a fun trick for punishing hotlinkers ;)- # find the big files (bash)
find / -type f -size +1000000k- # find duplicate records (sql)
SELECT mail, COUNT(mail) AS totalcount FROM users GROUP BY mail HAVING (COUNT(mail) > 1);- # vi find / replace a term throughout a file
:%s/search_string/replacement_string/g
a great vi cheatsheet is here- # cvs drupal module checkout with branch specified
cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib checkout -r DRUPAL-4-7 -d destination/directory contributions/modules/modulename
more here- # vi - get rid of stupid OSX ^M characters (be sure to use "CTRL-V CTRL-M" to make the ^M character)
:%s/^M/\r/g
got this here- # heartbeat haresources subnet config
node1 IPaddr::192.168.1.150/24/eth0
node2 IPaddr::192.168.1.151/24/eth0
this is useful for setting up multiple heartbeat node pairs on the same physical network so they wont complain about each other's broadcast messages. more here
Tue, 2006-10-03 04:35
I thought this internet machine was a series of tubes. Turns out, it was a big truck afterall.
I just the other day got, an internet was sent by my staff at 10 o'clock in the morning on Friday, and I just got it yesterday. Why?
Because it got tangled up with all the celluloid clogging the internets on the way to the Western Union, and by the time the Internet-o-gram boy got the to my office it was already Senate nap time so he just shoved it under my door, I can't believe. This is what happens when you rely on internets, and when our young internet delivery boys start smoking the marijuana they and they lose all sense of responsibilty. This is why, this is, what this is is.
And when my aides woke me for this vote, do you know what I realized? The internet had, they had sneakily rearranged my office furniture, if and I was unable to find my spectacles and pill organizer.
So you want to talk about commands? Let's talk about you and me. Let's talk about how cold it is in here. We are supposed to use this internet to communicate, and get movies from a warehouse, and look at nouns, but now suddenly they're, the Axis, Arab terrorist is using the internets to turn down the Senate thermostat.
I want pudding!
- reply
»Tue, 2006-10-03 04:24
I just thought this whole internet machine was a series of tubes. It turns out to be a big truck.
- reply
»