Skip to content

Instantly share code, notes, and snippets.

View ma2thieu's full-sized avatar

Matthieu Robillard ma2thieu

View GitHub Profile
Verifying myself: My Bitcoin username is +ma2thieu. https://onename.io/ma2thieu
@ma2thieu
ma2thieu / direct.php
Last active December 16, 2015 15:50
testing jembe.http.get() in the browser
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $_POST["url"]);
curl_setopt($ch, CURLOPT_HEADER, false);
if ($_POST["headers"] && count($_POST["headers"]) > 0) {
$headers = array();
foreach ($_POST["headers"] as $k => $v) {
$headers[] = $k . ': ' . $v;
#!/bin/sh
# Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the
# CREATE block and create them in separate commands _after_ all the INSERTs.
# Awk is chosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk.
# The mysqldump file is traversed only once.
# Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite
# Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite
@ma2thieu
ma2thieu / replace_php_short_tags.sh
Created February 23, 2013 18:50
replace php short tags (<?) with long one (<?php)
#!/bin/bash
# first short tags with something that is not a letter after
find . -iname "*.php" -print0 | xargs -0 -I{} sed -i -r 's/(<\?)([^a-zA-Z])/\1php\2/g' '{}'
# then short tags at end of line
find . -iname "*.php" -print0 | xargs -0 -I{} sed -i -r 's/<\?$/<\?php/g' '{}'
@ma2thieu
ma2thieu / cc.php
Created February 29, 2012 17:20
script to delete Symfony2 cache folder from the browser
<?php
// --- cache location
$cache_dir = dirname(__FILE__) . '/../app/cache';
echo "<b>cache_dir : $cache_dir</b>";
// ---
function rrmdir($dir) {
if (is_dir($dir)) {