This file contains 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
apt-get install percona-toolkit | |
pt-online-schema-change --print --progress time,5 --max-load Threads_running=500 --critical-load Threads_running=5000 --chunk-time 5 --set-vars "innodb_lock_wait_timeout=600" --nocheck-plan --execute -h {localhost} -u {user} --p "{password}" --alter "ADD {column} varchar(32) DEFAULT NULL" D={database},t={table} |
This file contains 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
# nano /etc/fail2ban/filter.d/nginx-4xx.conf | |
# | |
[Definition] | |
failregex = ^<HOST>.*"(GET|POST).*" (404|444|403|400) .*$ | |
ignoreregex = | |
This file contains 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 | |
if (($_SERVER['HTTP_PASSWORD'] ?? null) !== 'ProxyPassword') { | |
http_response_code(401); | |
exit(); | |
} | |
$response = file_get_contents(urldecode($_GET['url']), false, stream_context_create([ | |
'http' => [ | |
'ignore_errors' => true, |
This file contains 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 | |
$set = [ | |
[1, 1], | |
[2, 2], | |
[3, 3], | |
[4, 4], | |
[5, 5], | |
[6, 6], | |
[6, 6], |
This file contains 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\Services\Roles; | |
use App\User; | |
use Illuminate\Contracts\Auth\Access\Gate; | |
/** | |
* Class Permissions | |
* @package App\Services\Roles | |
* |
This file contains 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 | |
function csv_to_array($filename) | |
{ | |
if (!file_exists($filename) || !is_readable($filename)) { | |
throw new InvalidArgumentException('File does not exists or not readable'); | |
} | |
$headers = null; | |
$data = []; |
This file contains 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; | |
/** | |
* <code> | |
* $client = new \Http\Client(); | |
* | |
* $response = $client->get('http://google.com'); | |
* | |
* $response->content(); // text response |
This file contains 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
#!/usr/bin/env bash | |
REGEX="\sdd\((.*)\);|\/\/\sREMOVE" | |
DD=$(egrep -r ${REGEX} ./app) | |
if [[ ${DD} ]] | |
then | |
echo "$DD" | |
exit 1 |
This file contains 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
This is what worked for me on OS X Yosemite running MySql v5.7 (installed from the .dmg). | |
cd /usr/local/mysql/bin | |
mysql -u root -p --connect-expired-password | |
(Enter the temporary password generated by the installer.) | |
This gets you into sandbox mode and mysql> prompt. Then set desired root password with SET PASSWORD: | |
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('mySuperSecretPassword'); |
This file contains 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
(function () { | |
var socket = io($('#ws-url').val()); | |
var email = $('#user-name').val(); | |
var editUrls = [ | |
'filemanager/edit', | |
'media/update', | |
'courses/show', | |
'screenshot/index', | |
'card/update', | |
'skin/update', |
NewerOlder