Simply create a trigger which will insert unsubscribed users in the blacklist after every update on the subscriber table.
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 ]
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.
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:
Then execute one command on all the message tagged with this:
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:
Here is a great python script very useful to download an HD video from Youtube using the command line in Linux.
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.
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.
sudo apt-get install lamp-server^
Be careful not to delete the ^ character.
This will install:
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:
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:
Here is the code of my badge:
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:
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;