Skip to content

Instantly share code, notes, and snippets.

View gist:35b5708cd6cc1ccf38b0
// init multi handler
$multihandler = curl_multi_init();
$handlers = $result = array();
...
// init each url
foreach ($urls as $i) {
$handlers[$i] = curl_init($i);
curl_setopt($handlers[$i], CURLOPT_RETURNTRANSFER, TRUE);
@spin0us
spin0us / gist:11376298
Created Apr 28, 2014
mMySQL : Convert all table from MyISAM to InnoDB
View gist:11376298
SELECT CONCAT('ALTER TABLE ',table_schema,'.',table_name,' ENGINE=InnoDB;')
FROM information_schema.tables
WHERE table_schema NOT IN ('mysql','test','performance_schema','information_schema')
AND ENGINE='MyISAM'
@spin0us
spin0us / gist:5583418
Created May 15, 2013
Check if date (english datetime or unix timestamp) is a french holiday
View gist:5583418
if(!function_exists('isFrenchHoliday'))
{
function isFrenchHoliday($str)
{
$ts = (preg_match('/^[0-9]{10}$/', $str)) ? $str : strtotime($str);
$date = date("md", $ts);
if($date == '0101') return true; // 1er janvier
if($date == '0501') return true; // 1er mai
if($date == '0508') return true; // 8 mai
if($date == '0714') return true; // 14 juillet
@spin0us
spin0us / gist:5500741
Created May 2, 2013
Ubuntu : clean /boot
View gist:5500741
dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge
@spin0us
spin0us / gist:5413229
Created Apr 18, 2013
Display all errors
View gist:5413229
error_reporting(E_ALL);
ini_set('display_errors', '1');
@spin0us
spin0us / gist:5261580
Created Mar 28, 2013
Unable to install Linux Mint 14 on some AMD processor : ubiquity crash
View gist:5261580
Boot from live CD
Start Terminal
sudo apt-get purge ubiquity-slideshow-mint
Close Terminal
Start installation process
@spin0us
spin0us / gist:5254193
Last active Dec 15, 2015
Server tips to install new gcc from sources and use it
View gist:5254193
### Install new version of gcc
tar xzf gcc-4.6.2.tar.gz
cd gcc-4.6.2
./contrib/download_prerequisites
cd ..
mkdir objdir
cd objdir
$PWD/../gcc-4.6.2/configure --prefix=/opt/gcc-4.6.2
make
View php_do_post_request.php
function do_post_request($url, $data, $optional_headers = null) {
$params = array('http' => array(
'method' => 'POST',
'content' => $data
));
if ($optional_headers !== null) {
$params['http']['header'] = $optional_headers;
}
$ctx = stream_context_create($params);
You can’t perform that action at this time.