How to add a 32M query cache with an item limit of 1M.
NOTE: You might need to add '-p' to the following command if 'root'@'localhost' requires a password on your environment.
# mysql \
<?php | |
/************************************************************************* | |
* Get File Information | |
*/ | |
// Assuming these come from some data source in your app | |
$s3FileKey = 's3/key/path/to/file.ext'; | |
$fileName = 'file.ext'; |
<?php | |
namespace App\Http\Middleware; | |
use Closure; | |
class RewriteLinks | |
{ | |
/** | |
* Handle an incoming request. |
/** | |
* Scope a query to only include models matching the supplied ID or UUID. | |
* Returns the model by default, or supply a second flag `false` to get the Query Builder instance. | |
* | |
* @throws \Illuminate\Database\Eloquent\ModelNotFoundException | |
* | |
* @param \Illuminate\Database\Schema\Builder $query The Query Builder instance. | |
* @param string $uuid The UUID of the model. | |
* @param bool|true $first Returns the model by default, or set to `false` to chain for query builder. | |
* @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Builder |
#!/bin/bash | |
if [ "$EUID" -ne 0 ] | |
then echo "Please run as root" | |
exit | |
fi | |
apt-get install pkg-config libmagickwand-dev -y | |
cd /tmp | |
wget https://pecl.php.net/get/imagick-3.4.0.tgz | |
tar xvzf imagick-3.4.0.tgz |
If you're not familiar: What is fail2ban? fail2ban is an awesome linux service/monitor that scans log files (e.g. auth.log for SSH) for potentially malicious behavior. Once fail2ban is tripped it will ban users for a specified duration by adding rules to Iptables. If you're unfamiliar with fail2ban Chris Fidao has a wonderful (& free!) series about security including setting up fail2ban here.
Recently Laravel released a new feature in 5.1 to throttle authentication attempts by simply adding a trait to your authentication controller. The Laravel throttle trait uses the inputted username, and IP address to throttle attempts. I love seeing this added to a framework out of the box, but what about some of our other apps not built on Laravel? Like a WordPress login? Or even an open API etc.? Ultimately,
<?php | |
public function mapStylesUrlArgs($mapStyleJson) | |
{ | |
$params = []; | |
foreach (json_decode($mapStyleJson, true) as $style) { | |
$styleString = ''; | |
if (isset($style['stylers']) && count($style['stylers']) > 0) { |
<?php | |
// find your api key on the bottom of page @ https://webapp.imgix.com | |
define('IMGIX_API_KEY', ''); | |
// pass the url you want to purge | |
function imgix_purge($url) { | |
$headers = array( | |
'Content-Type:application/json', | |
'Authorization: Basic '. base64_encode(IMGIX_API_KEY.':') |
#!/bin/bash | |
# exports DNS records from Rackspace Cloud DNS to text files | |
# Depends on https://github.com/wichert/clouddns/blob/master/src/clouddns.py | |
set -e | |
me=export-zone | |
base_domain= | |
rackspace_region= | |
rackspace_rate_limit_delay=3 |