Skip to content

Instantly share code, notes, and snippets.

💭
Travelling 🌴

Peter Mescalchin magnetikonline

💭
Travelling 🌴
Block or report user

Report or block magnetikonline

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@magnetikonline
magnetikonline / gist:8746669
Created Feb 1, 2014
Webalizer IgnoreAgent/SearchEngine rule sets conf - 2014-01
View gist:8746669
IgnoreAgent +http://www.baidu.com/search/spider.html)
IgnoreAgent ; 360Spider
IgnoreAgent ; Claritybot)
IgnoreAgent ; Google Web Preview)
IgnoreAgent ; Googlebot
IgnoreAgent www.webwombat.com.au
IgnoreAgent Aboundex/*
IgnoreAgent Apache-HttpAsyncClient/*
IgnoreAgent Apache-HttpClient/*
IgnoreAgent AppEngine-Google*
@magnetikonline
magnetikonline / README.md
Last active Aug 29, 2015
Create favicon.ico from PNG source using ImageMagick.
View README.md

Create favicon.ico from PNG source using ImageMagick

Using a source PNG image with dimensions of 144x144, which will be our apple-touch-icon used for Apple iOS and tablet devices.

$ convert -resize 32x32 -colors 256 favicon.png favicon.ico

Markup for HTML page <head> area:

@magnetikonline
magnetikonline / README.md
Last active Aug 29, 2015
Check Linux filesystem for bad blocks.
View README.md

Check Linux filesystem for bad blocks

List filesystem(s) to check

$ df -h

Will be listed as /dev/sdX1.

@magnetikonline
magnetikonline / gist:9497941
Last active Aug 29, 2015
Webalizer IgnoreAgent/SearchEngine rule sets conf - 2014-03
View gist:9497941
IgnoreAgent +http://www.baidu.com/search/spider.html)
IgnoreAgent ; 360Spider
IgnoreAgent ; Claritybot)
IgnoreAgent ; Google Web Preview)
IgnoreAgent ; Googlebot
IgnoreAgent Aboundex/*
IgnoreAgent Apache-HttpAsyncClient/*
IgnoreAgent Apache-HttpClient/*
IgnoreAgent AppEngine-Google*
IgnoreAgent Baiduspider*
@magnetikonline
magnetikonline / README.md
Last active Aug 29, 2015
Update WordPress database dump URL paths.
View README.md

Update WordPress URL paths

PHP script that takes a mysqldump file and brute force replaces URLs into an output dump file.

Ensure to dump the source SQL database using the --skip-extended-insert switch to ensure INSERT INTO() statements don't end up on singular and very long lines, which won't help the script crunch all the replacements.

E.g.

$ mysqldump \
	-hlocalhost -uUSERNAME -p \
@magnetikonline
magnetikonline / test.php
Created Mar 28, 2014
Enabling PHP PCRE case insensitive searching for specific sections of your regular expression.
View test.php
<?php
$testExpression = '/(?i)te(?-i)st/';
testPCRESectionOnly($testExpression,'test');
testPCRESectionOnly($testExpression,'TEst');
testPCRESectionOnly($testExpression,'teST');
testPCRESectionOnly($testExpression,'TEST');
/*
Should return:
@magnetikonline
magnetikonline / generate.php
Last active Aug 29, 2015
PHP generate random string with characters [0-9a-f].
View generate.php
<?php
function generateRandString() {
$randString = '';
while (strlen($randString) < 32) {
// generate a character between 0-9 a-f
$character = mt_rand(0,15);
if ($character > 9) $character += 39;
$randString .= chr($character + 48);
}
@magnetikonline
magnetikonline / emailcheck.php
Last active Aug 29, 2015
Very liberal PHP is valid email check.
View emailcheck.php
<?php
function isValidEmailAddress($email) {
return (
(preg_match('/^[^\r\n\t]+@[^\r\n\t ]+\.(?i)[a-z]{2,10}$/',$email)) &&
(count($partList = explode('@',$email)) == 2) &&
(!preg_match('/\.{2}/',$partList[1]))
);
}
@magnetikonline
magnetikonline / README.md
Last active Aug 29, 2015
Essential Sublime Text 3 packages.
@magnetikonline
magnetikonline / README.md
Created Apr 19, 2014
Essential Google Chrome browser extensions.
View README.md
You can’t perform that action at this time.