The Linux DD command

To detect the progress or how far dd has come in a running copy, open a second terminal window, run top to get the id of the dd process, then issue the command kill -USR1 xxxx (replace xxx with the actual ID of the process), now it may appear that nothing happened, but swicth the terminal to the one dd is running in

you should see something like

1036902161+0 records in
1036902160+0 records out
530893905920 bytes (531 GB) copied, 29702.1 s, 17.9 MB/s

MySQL – Can’t change ownership of the file Errcode: 1

When trying to repair tables (or optimise), there seems to be an error that is giving me a hard time.

The SQL statement REPAIR TABLE mytablename; returns the following

+---------------------+--------+----------+----------------------------------------------------------------------------------------------+
| Table               | Op     | Msg_type | Msg_text                                                                                     |
+---------------------+--------+----------+----------------------------------------------------------------------------------------------+
| mydbase.mytablename | repair | error    | 1 when fixing table                                                                          |
| mydbase.mytablename | repair | Error    | Can't change ownership of the file '/hds/wd1tb_2/mysql/mydbase/mytablename.MYD' (Errcode: 1) |
| mydbase.mytablename | repair | status   | Operation failed                                                                             |
+---------------------+--------+----------+----------------------------------------------------------------------------------------------+

So, the only solution up to now is to

chmod -R 700 /hds/wd1tb_2/mysql/
chown -R mysql:mysql /hds/wd1tb_2/mysql/

This error has already been reported as a big long time ago, but it seems to be still there, this is the only way around the situation, and it does not seem to have been resolved with MySQL 5.5.33-0+wheezy1

Extracting 7z files

On debian, i always recommend you install p7zip-full not p7zip

To extract with 7zip on linux, in order to maintain directory structure, use the x rather than the e, so the command to extract is

7za x file.7z

The file above would have been produced by a command such as

7z a -t7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on archive.7z dir1

The above line adds all files from directory “dir1” to archive archive.7z using “ultra settings”

Quickly disable and enable autoplay and autorun

Disable auto run and auto play.

1- Download : the first to disables windows auto play (to protect your computer), the other enables it if you ever change your mind.
You will want to save the files not to view them, so in firefox you would right click then “save link as”, similar functions are available in other browsers.
Download Disable Auto Play
Download Enable Auto Play

2- Run the file you downloaded
3- Restart your computer

Why diable autorun / autoplay ?

i disable it because i don’t like auto run viruses that my antivirus don’t catches ! maybe you have your reasons, like you don’t like the thing that pops up when you insert a flash stick or a DVD.

What is the difference between autorun and autoplay ?

AutoPlay is the new AutoRun (Windows vista and above)

Auto Run : the original from windows 95, the system executes the program mentioned in autorun.inf when removable media is inserted.

Auto Play : Like auto run, but when and if there is no autorun.inf file, the OS will try to guess and give you choices.

All you need to disable it, is to download the following from above, and run the one named disable-autoplay.reg, if you want to re-enable it for some reason, run the file that says enable-autoplay.reg

What happens when i run the files above ?

Rather than asking you to use regedit to edit your registry and change values or add them, we made a reg file with the values for you to download and use, what you are downloading is a text file (and not a program) that will instruct your computer on the new registry values.

The values that are modified (or added if the key does not exist) are

HKEY_LOCAL_MACHINESoftwareMicrosoftWindowsCurrentVersionPoliciesExplorer ENTRY NoDriveTypeAutoRun
HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionpoliciesExplorer ENTRY NoDriveTypeAutoRun

The disable file will set the values above to 000000FF (Decimal 255) to disable auto play (autorun), and the enable file above will set auto play (autorun) to 00000001 (Decimal 1).

Windows provides a tool to do it too, you can do this using gpedit.msc.
Hit start, type gpedit.msc then when that appears in the list, hit enter.
Computer Configuration >> Administrative Templates >> Windows Components >> AutoPlay Policies

That will open a new window that will allow you to enable or disable autorun.

Or you could just click one of the files above and run it on your computer.

My SSL price hunt, what’s on the market.

Edited on 2014-10-20. I use this post to keep track of where to get SSL certificates when i need them, thought i should share this stuff and save people some time looking for cheap SSL certificates

I also changed the title of this post from “workaround to no godaddy promo code works for ssl” to “My SSL price hunt, what’s on the market”. because godaddy and his resellers are no longer the no brainer choice, Hence i am looking for something else. I changed the title even before looking, but let’s see how it goes, i will also keep this page updated every time i look for SSL deals.

Irrelevant to most: Today i am not only looking for any SSL supported by many browsers, i am looking for a certificate that works with PolarSSL and openssl since communication is going to be done through lib cURL.

Note: If you buy the certificate for 1 year, you can use the promo code 3.88DEAL to get the ssl for $3.88, this coupon was valid on 3 December 2014.

I will look no further, i found SSL certificates as cheap as $4 at SSLs.com, i am not affiliated with them, i do not know who they are, and i am not making any money out of you buying this certificate, It is just honest advice. ssls.com is namecheap, their paypal payment address on the time of this post is (You sent a payment of $3.88 USD to UnifiedRegistrar (support@namecheap.com))

The older post from 2013 recommended using a godaddy reseller (http://store.polodomains.com/ssl/ssl-certificate.aspx?ci=8347&prog_id=easywebdns) since godaddy SSL coupons are no longer a good enough discount to go below 28.99, one year after, i am redoing the investigation.

Again, this is where i keep record of what is available on the market for proper SSL certificates, this is not an exhaustive study, If you know of anything cheaper, please let me know.

Reminders and state of affairs.

– Free – startssl provides free SSL certificates, but the certificate will have to bear my personal details (Emailing passport, and other identification ), when this is a company, I don’t want my name on it especially if this is a client, the idea is cool, but unfortunately, only suitable for personal use.

– $29 – Godaddy’s $69 certificate has coupons on the internet, best of which gives around 40% off, this makes the certificate cost around $41.4, still more expensive that the reseller ( http://store.polodomains.com/ssl/ssl-certificate.aspx?ci=8347&prog_id=easywebdns ) so godaddy certificates are still, when baught from a reseller priced at $29

– $4 – Commodo certificates can be bought from any reseller for $4 (try ssls, they are a reseller of this).
———————————–
Older post from 2013-11-4
———————————–
So it seems there are no working promo codes available for godaddy. i am not coming to this as a conclusion, i actually made an affiliate account and went in to take a look at the available promo codes. Nothing for SSL that can take you under $28.

the best deal i found was 32% off which is still not cheap

So, the solution for me was to get the SSL certificate from a godaddy reseller for $29. i got mine through this link… while godaddy puts up new promo codes for SSL

NOTE: THIS IS NOT AN AFFILIATE LINK, THIS IS A DIRECT LINK TO THE PAGE
http://store.polodomains.com/ssl/ssl-certificates.aspx?ci=1790&prog_id=easywebdns

Happy savings

Stopping backscatter from postfix bounce

This is a quick one because i know you have no time to look into how mail servers work in extreme detail, so here it is.
This is a fast resolution to your backscatter problem, yet, after this resolution, it might take the spammer some time to realize that your server is no longer including the original message in the responce.

postconf -e 'bounce_size_limit = 1'

What this does is that it makes your message bounce with the headers but not the body of the message, which makes the spammer who is targeting your server loose interest *(because she can not make use of the bounced message if the body is missing)

right after you need to

/etc/init.d/postfix reload
/etc/init.d/postfix restart

Your choice 🙂

And this is the fastest solution, this is because any other solution will require you to investigate the whole setup, while this solution is a simple solution that is still effective.

Configuring firefox display mixed content

Well, not long after chrome started blocking active content from non https locations when pages were in https, firefox is doing the same with the new version.

The answer is simple and very intuitive (found it in 10 seconds), and i am not sure why no one has blogged about it yet.

1- In the address bar, visit about:config (Yes, just type this in the firefox URL address bar)
2- in the search, look for the word active, you will see a few parameters with the word active
3- find the one that reads (security.mixed_content.block_active_content) and double click the word TRUE that is in front of it so that it becomes false.
4- Close the config page

Now firefox would not mind active content

Always keep in mind that firefox did not do this for nothing, and that there is a security issue with mixed active content, in an ideal world, website makers would resolve the issue, and would make wise judgment on when it is ok to stream mixed content, and when cookies should only work in SSL (Part of cookie functionality), but since we don’t live in that world, Firefox has decided to deal with it from the browser side.

Linux PIPE, BZIP2 in parallel, multiple threads

I am getting old, my brain aint all that bright no more, for example i am so used to using

mysqldump –opt -u root –password=”LaooIa12@Hsu” mytodolist | gzip > mytodolist.bin.gz

So to compress the database while dumping it without having it hit the disk first in what is called piping.

the problem is that i didn’t think of checking whether pbzip2 supports this so that i can use all 6 CPU cores (12 vCPUs)

So, turns out that pbzip2 (parallel BZIP) does work

mysqldump –opt -u root –password=”LaooIa12@Hsu” mytodolist | pbzip2 -vc > mytodolist.bin.bz2

Now, i can get it done much much faster, 6-12 times faster

Intel processor Lithography explained

In short, it is the average space between the processor’s logic gates (transistors).

It makes all the difference in speed, and a considerable difference in power consumption.

For example, i ran a certain task on both of the following processors

E3300 which is a low cost celeron processor with a lithography of 45nm and (1M Cache, 2.50 GHz, 800 MHz FSB)
Q6600 Which is a much more expensive (at the time when both were purchased) with a lithography of 65nm and (8M Cache, 2.40 GHz, 1066 MHz FSB)

When comparing a single core’s throughput, the cheap celeron processor beat the quad core by a very considerable number, much higher than the difference in clock speed, The actual numbers would need me to explain many factors such as the nature of the millions of records that needed processing, how they were processed, how jobs were distributed between computers, how the random sample is guaranteed to be random and so on, and i don’t think this is very relevant to you.

So, lithography is something you should really consider when buying a processor, the lower the better, my laptop’s I7 is built with a lithography of 22nm, this is the best number as of 2013.

Running Debian wheezy from a USB stick in read and write mode, and maintaining the changes between reboots ( persistent )

My mission: at the office there are WINDOWS computers that don’t run 24/7, they are on a few hours a day, and i would like to make those computers do some processing for my programs at night and when they are not in use. to run my programs they need to be running linux, so here is my plan.

One very simple way is to install a second hard drive on those computers and boot from it (Because i dont want to touch drives that have people’s data. But this is alot of work, and i don’t want to end up having people accidentally booting the second drive or even have an extra spinning disk in the computer that does absolutly nothing while people are working with windos.

So, My plan is to get cheap 4GB flash pen drives and boot all those computers from them.

Step 1: get debian live (http://live.debian.net/) iso file

I am downloading debian-live-7.0.0-amd64-standard.iso.log But if you want a desktop GUI environment like gnome or KDE you should get a different file.

Step 2: Dump the ISO file onto the flash stick, on windows this can simply be done with
Step 3: Change some stuff to make the live image persistent and not read only (Could be step 2, or 3 if we mount the USB and edit directly)
Step 4: Deploy