This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Script from http://www.cyberciti.biz/tips/howto-linux-unix-write-to-syslog.html | |
result=$(echo -e "ping\n\r" | nc localhost 6082|grep PONG|wc -l); | |
if [ "${result}" -lt "1" ]; | |
then | |
/etc/init.d/varnish stop; | |
sleep 5; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UPDATE wp_postmeta SET meta_value = replace(meta_value, 'http://www.olddomain.com', 'http://www.newdomain.com') WHERE instr(meta_value, 'http://www.olddomain.com') > 0; | |
UPDATE wp_posts SET guid = replace(guid, 'http://www.olddomain.com', 'http://www.newdomain.com') WHERE instr(guid, 'http://www.olddomain.com') > 0; | |
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.olddomain.com', 'http://www.newdomain.com') WHERE instr(post_content, 'http://www.olddomain.com') > 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Read | |
# http://wiki.nginx.org/Pitfalls | |
# http://wiki.nginx.org/QuickStart# | |
# http://tautt.com/best-nginx-configuration-for-security/ | |
# | |
# Generate your key with: openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 | |
# Generate certificate: sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/nginx/ssl/nginx.key -out /etc/nginx/ssl/nginx.crt | |
server_tokens off; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* getPostFromBody | |
* | |
* Returns an array obtained from reading and decoding the post body | |
* Optionally supply an array of fields that are required to be present | |
* | |
* @version 1.0.0 | |
* @author Andy Beak | |
* @since 1.0.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* store | |
* | |
* Stores a large array into memcache as a number of key=>values in order to overcome the limitation placed | |
* on memcache. You'll need to use discretion when choosing to do this. | |
* | |
* The principle is to split the data into several smaller chunks. The original key is used to store an | |
* index array which provides retrieveBigCacheValue() with information on where to look for the data. | |
* | |
* See retrieveBigCacheValue for the inverse |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Version": "2008-10-17", | |
"Statement": [ | |
{ | |
"Sid": "AllowPublicRead", | |
"Effect": "Allow", | |
"Principal": { | |
"AWS": "*" | |
}, | |
"Action": "s3:GetObject", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Doctrine\ORM\Tools\Console\ConsoleRunner; | |
use Doctrine\ORM\Tools\Setup; | |
use Doctrine\ORM\EntityManager; | |
$paths = ['/home/andy/development/metagrated/poc/restengine/app/Lib/Domain/Mappings']; | |
require_once __DIR__.'/../../../../bootstrap/autoload.php'; | |
$paths = [ __DIR__ ]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Read | |
# http://wiki.nginx.org/Pitfalls | |
# http://wiki.nginx.org/QuickStart# | |
# http://tautt.com/best-nginx-configuration-for-security/ | |
# https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html | |
# | |
# Generate your key with: openssl dhparam -out /etc/nginx/ssl/dhparam.pem 4096 | |
# Generate certificate: sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/nginx/ssl/nginx.key -out /etc/nginx/ssl/nginx.crt | |
server { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php namespace App\Http\Middleware; | |
use Auth; | |
use Closure; | |
use Config; | |
use Log; | |
class LoggingMiddleware { | |
/** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* xml2array() will convert the given XML text to an array in the XML structure. | |
* Link: http://www.bin-co.com/php/scripts/xml2array/ | |
* Arguments : $contents - The XML text | |
* $get_attributes - 1 or 0. If this is 1 the function will get the attributes as well as the tag values - this results in a different array structure in the return value. | |
* $priority - Can be 'tag' or 'attribute'. This will change the way the resulting array sturcture. For 'tag', the tags are given more importance. | |
* Return: The parsed XML in an array form. Use print_r() to see the resulting array structure. | |
* Examples: $array = xml2array(file_get_contents('feed.xml')); | |
* $array = xml2array(file_get_contents('feed.xml', 1, 'attribute')); |