nix, shell, perl, php, mysql and mac os x tips and tricks

Friday, February 10, 2012

Check that curl is connecting through your proxy

http_proxy=http://localhost:8082 curl -C - -O -# -v -A 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13' http://www.cotse.com/proxycheck2.htm > index.html

Then open that html file in your browser

Friday, February 3, 2012

Replace windows specials characters like curly quotes and ellipses in MySQL

UPDATE `table` SET `column` = REPLACE(`column`, 0xE28098, "'");
UPDATE `table` SET `column` = REPLACE(`column`, 0xE28099, "'");
UPDATE `table` SET `column` = REPLACE(`column`, 0xE2809C, '"');
UPDATE `table` SET `column` = REPLACE(`column`, 0xE2809D, '"');
UPDATE `table` SET `column` = REPLACE(`column`, 0xE28093, '-');
UPDATE `table` SET `column` = REPLACE(`column`, 0xE28094, '--');
UPDATE `table` SET `column` = REPLACE(`column`, 0xE280A6, '...');
UPDATE `table` SET `column` = REPLACE(`column`, CHAR(145), "'");
UPDATE `table` SET `column` = REPLACE(`column`, CHAR(146), "'");
UPDATE `table` SET `column` = REPLACE(`column`, CHAR(147), '"');
UPDATE `table` SET `column` = REPLACE(`column`, CHAR(148), '"');
UPDATE `table` SET `column` = REPLACE(`column`, CHAR(150), '-');
UPDATE `table` SET `column` = REPLACE(`column`, CHAR(151), '--');
UPDATE `table` SET `column` = REPLACE(`column`, CHAR(133), '...');