how to automatically blacklist unsubscribed emails on interspire email marketer

Reading Time: < 1 minute

Simply create a trigger which will insert unsubscribed users in the blacklist after every update on the subscriber table.

CREATE TRIGGER `banned_email` AFTER UPDATE ON `iem_list_subscribers` 
FOR EACH ROW INSERT IGNORE INTO ya_banned_emails 
(emailaddress, list, bandate)
SELECT emailaddress, ‘g’, UNIX_TIMESTAMP( ) 
FROM iem_list_subscribers
WHERE unsubscribed != ‘0’;

How to make a script sleep for a random amount of seconds

Reading Time: < 1 minute

If you want to insert a sleep in a script for a random number of seconds, you can do the following:

        NUMBER=$[ ( $RANDOM % 60 )  + 1 ]
        sleep $NUMBER

Replace 60 with the interval chosen and you will get a random sleep between 1 and 60 seconds.

This can be useful if you are trying to fetch data from a server who’s monitoring the number of connections you are opening and tends to blacklist you if you do too much.

How to forward a lot of emails with Mutt

Reading Time: < 1 minute

Today I had to forward 2200 emails from a mailbox to another address. I looked around a bit to find a way to automate this process but all I could find was how to forward new messages.

That’s easy, just put a .forward file in your home dir with the email where you want to forward and it works.

But to forward already received email, it’s a bit trickier.

I was already using Mutt and I know it is a very powerful tool so I looked a bit more into it.

In order to solve my problem I found the following:

You can Tag many messages with this command:

T.*

Then execute one command on all the message tagged with this:

;b

It will then ask you the email address where to bounce all this emails.

Fill it in and off you go. It took 3 minutes to send the 2200 mails. Cool 🙂

Then you can easily delete all these files with this:

;d

How to download a youtube video under linux command line

Reading Time: < 1 minute

Here is a great python script very useful to download an HD video from Youtube using the command line in Linux.

http://rg3.github.com/youtube-dl

It’s very simple, download and run. The result is an mp4 file that you can watch offline with VLC or Media Player Classsic under Windows or any other mp4 player under Linux.

Fix a ubuntu upgrade problem with Grub2

Reading Time: < 1 minute

With Ubuntu 10.04 came a new version of Grub. During an upgrade from a previous version to 10.04 or higher there will be a time when the system will ask you if you want to keep your own version of the configuration or get the package maintener version.

If I am not mistaken, you should say you want the maintener one.

But then something strange may happen depending on your upgrade path.

install a lamp server on ubuntu

Reading Time: < 1 minute

Easy!

sudo apt-get install lamp-server^

Be careful not to delete the ^ character.

This will install: 

Assign a fix MAC address to a vmware network interface

Reading Time: < 1 minute

MAC addresses are assigned at the bootup of a virtual machine. But there is a way to assign a fix hardware address to a vmware network interface by editing the virtual machine with Vi.

Simply connect with SSH to your ESXi and go to /vnfs/datastore1 or anywhere you put your vm.

If your virtual machine is called vm1, go to /vmfs/datastore1/vm1

Open the file vm1.vmx using Vi.

Around the end of the file there will be the configuration of the network interfaces.

You should see things like:

how to speed up social network badge loading

Reading Time: < 1 minute

I have had some problem with my Tripit badge on the left of the screen. For some strange reason it wouldn’t load on my Google Chrome. It would load if I would open this page with Firefox or IE though. The weirdest thing is that after loading it from Firefox or IE, I could then load it with Chrome. 

So I decided I would take a different approach and cache the badge somewhere.

Here is how to do it:

First get the URL of the javascript file of your badge.

Here is the code of my badge:

bypass authentication for a specific URL with squid and webmin

Reading Time: 2 minutes If you need to setup some webmin rule for bypassing authentication for a specific URL, it’s VERY easy to setup.

This is something that can be needed if you have a windows server behind a proxy and that server needs direct access to the internet in order to be activated:

Activation fails when you try to activate Windows 2008 over the Internet… 

How to find which SQL is executed by a process

Reading Time: < 1 minute

If you are looking for the last SQL query ran by a specific process, try this: 

 
select substr(sa.sql_text,1,1000) txt
from v$process p, v$session s, v$sqlarea sa
where p.addr=s.paddr
and s.username is not null
and s.sql_address=sa.address(+)
and s.sql_hash_value=sa.hash_value(+)
and spid=&SPID;