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
SELECT RTRIM(CONCAT( | |
'`', | |
COLUMN_NAME, | |
'`', | |
' ', | |
COLUMN_TYPE, | |
' ', | |
IF (COLLATION_NAME IS NULL, '', CONCAT('COLLATE ', COLLATION_NAME, ' ')), | |
IF (IS_NULLABLE = 'YES', '', 'NOT NULL '), | |
IF (COLUMN_DEFAULT IS NULL, '', CONCAT('DEFAULT ', COLUMN_DEFAULT, ' ')), |
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
# SSH into an instance using the instance name (supports partial matching) | |
# Usage: gcessh <instance-name> | |
gcessh() { $(gcloud compute instances list --filter="name~'$1'" --sort-by name | tail -n +2 | head -1 | awk '{print "ssh "$1}' ) 2>/dev/null; }; | |
# Describe an instance using the instance name (exact match only) | |
# Usage: gcedesc <instance-name> | |
gcedesc() { $(gcloud compute instances list | grep $1 | awk '{print "gcloud compute instances describe "$1" --zone "$2}'); }; | |
# List all matching instances using a partially matched instance name (perfect for listing nodes from an instance group) | |
# Usage: gcelsn <instance-name> |
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 | |
$output = shell_exec('consul kv export'); | |
if (null === $output) { | |
echo 'Could not run `consul kv export`. Is consul installed?' . PHP_EOL; | |
exit(1); | |
} | |
$data = json_decode($output, true); |
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
BASE="/var/www/project" | |
RELEASES="$BASE/releases" | |
RELEASE="$RELEASES/`date +%s`" | |
SHARED="$BASE/shared" | |
CACHE="$BASE/deploy-cache" | |
cp -a $CACHE $RELEASE | |
cd $RELEASE | |
####### [Pre-launch commands] ####### |
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\Controllers\Api; | |
use GuzzleHttp\Client; | |
use Illuminate\Http\Request; | |
use App\Http\Controllers\Controller as BaseController; | |
use Illuminate\Http\Response; | |
use App\Mappers\Response\Address as AddressMapper; |
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 | |
// Usage: Upload to a random server of your choice and send the URL to http://browsershots.org (or similar) | |
// Prerequisites: | |
// composer require fabpot/goutte | |
include 'vendor/autoload.php'; | |
use Goutte\Client; |
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
date -s "$(curl -s --head http://google.com | grep ^Date: | sed 's/Date: //g')" |
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
# During an ALTER TABLE run, if you experience the following error: | |
# | |
# mysql> ALTER TABLE `my_table` ALGORITHM=INPLACE, ENGINE=InnoDB; | |
# ERROR 1034 (HY000): Incorrect key file for table 'my_table'; try to repair it | |
# | |
# It may be disk related. To track this, run the following commands (in a screen session) | |
# and leave them running whilst running the ALTER again. After the error displays, check | |
# the files for obvious signs of disk related issues. Please note, the results from the | |
# df-full.log may not be accurate (on their own), so use this with the lsof.log | |
# Also, please ensure the following commands are run seperatley in parallel (with seperate |
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/sh | |
# Run the following command to run this script locally: | |
# sh -c "$(curl -sSL https://gist.github.com/olivertappin/1628438fbb9460743a9021cddd7221ce/raw)" | |
headers=$(dpkg --list | grep -E 'linux-image-[0-9]+\.[0-9]+\.[0-9]+-[0-9]+[0-9]+-generic' | awk {'print $2'} | grep -v `uname -r`) | |
echo "Current header: " | |
uname -r |
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
<VirtualHost *:80> | |
ServerName %TRAVIS_HOSTNAME% | |
DocumentRoot %TRAVIS_BUILD_DIR% | |
LogFormat "%{UNIQUE_ID}e %h %l %u %t \"%r\" %>s %b" unique | |
CustomLog %TRAVIS_LOG_DIR%/access_log unique | |
ErrorLog %TRAVIS_LOG_DIR%/error_log | |
SetEnv APP_ENV local | |
<Directory "%TRAVIS_BUILD_DIR%"> | |
AllowOverride None | |
Require all granted |