Skip to content

Instantly share code, notes, and snippets.

View Yanovskiy's full-sized avatar

Miron Yanovskiy Yanovskiy

  • PropellerAds
  • Saint-Petersburg, Russia
View GitHub Profile
@Yanovskiy
Yanovskiy / find_dup.sql
Created March 26, 2014 11:40
Find duplicates MySQL
SELECT name, COUNT(*) c FROM table GROUP BY name HAVING c > 1;
@Yanovskiy
Yanovskiy / curl_folow_redirect.php
Created March 6, 2014 18:11
Curl to follow redirects
<?php
/**
* @author dweingart at pobox dot com
*
* If you want to Curl to follow redirects
* and you would also like Curl to echo back
* any cookies that are set in the process,
* use this:
*/
@Yanovskiy
Yanovskiy / xhprof_enable.php
Last active August 29, 2015 13:56
XHProf enable
<?php
if(extension_loaded('xhprof')) {
$utilsPath = '/usr/share/php5-xhprof/xhprof_lib/utils/';
include_once $utilsPath . 'xhprof_lib.php';
include_once $utilsPath . 'xhprof_runs.php';
xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY);
@Yanovskiy
Yanovskiy / test_anything.sh
Last active August 29, 2015 13:56
test anything
function test(){
echo -n "Testing configuration. Please wait..."
sleep 5
while true
do
echo -n "."
sleep 10
done
}
@Yanovskiy
Yanovskiy / gist:8934341
Created February 11, 2014 12:55
sed remove between lines
gsed -ni '/PATTERN_START/{p; :a; N; /PATTERN_END/!ba; s/.*\n//g}; p' <input_file>