map $http_cookie $devroot {
default "/home/user/sandbox.test.co/public";
"~*devroot=dev1;?.*" "/home/user/dev1.test.co/public";
"~*devroot=dev2;?.*" "/home/user/dev2.test.co/public";
}
server {
listen 443 ssl http2;
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
public function account(): BelongsTo | |
{ | |
return new BelongsTo( | |
Account::where('owner_id', $this->owner_id), | |
$this, | |
'owner_type', | |
'owner_type', | |
'BelongsToWithCompositeKey' | |
); | |
} |
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
#!/bin/sh | |
MYSQL="mysql" | |
max_connections=$(mysql -e "show variables like 'max_connections'" 2>/dev/null | grep -i "max_connections" | awk '{print $2}') | |
threads_connected=$(mysqladmin extended-status | grep -i 'threads_connected' | awk '{ print $4}') | |
cdate=$(date -u +%Y-%m-%dT%H:%M:00.000Z) | |
instanceid="${INSTANCE_ID}" | |
aws cloudwatch put-metric-data --metric-name MySQLMaxConnections --namespace "CustomMySQLMetrics" --dimensions="InstanceId=$instanceid" --value $max_connections --timestamp $cdate |
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
#!/bin/sh | |
wget https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash -O ~/.git-completion.bash | |
wget https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh -O ~/.git-prompt.sh | |
cat<<EOF >> ~/.bashrc | |
source ~/.git-completion.bash | |
source ~/.git-prompt.sh | |
export CLICOLOR=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
$tpAdmins = [ | |
$user1->email => $user1->email, | |
$user2->email => $user2->email, | |
]; | |
Notification::assertSentTo( | |
new AnonymousNotifiable(), | |
CompanyRegisteredNotification::class, | |
function ($notification, $channels, $notifiable) use ($tpAdmins) { | |
return $notifiable->routes['mail'] === $tpAdmins; |
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
const vueComponent = (component, propsData, uid = uuid.v1()) => { | |
// https://css-tricks.com/creating-vue-js-component-instances-programmatically/ | |
const ComponentClass = Vue.extend(component) | |
const instance = new ComponentClass({ propsData }) | |
instance.$mount() | |
const id = `tmp-${uid}` | |
window.setTimeout(() => { | |
// Replace dom | |
const old = document.querySelector(`#${id}`) |
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
#!/bin/bash | |
#ps --no-headers -o "rss,cmd" -C php-fpm7.4 | awk '{ sum+=$1 } END { printf ("%d%s\n", sum/NR/1024,"MB") }' | |
function chk() { | |
name="$1" | |
val=$(ps --no-headers -o "rss,cmd" -C "$name" | awk '{ sum+=$1 } END { printf ("%d%s\n", sum/NR/1024,"MB") }') | |
printf " %10s |" $val | |
} | |
function header() { |
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
'mysql_stream' => [ | |
'driver' => 'mysql', | |
'url' => env('DATABASE_URL'), | |
'host' => env('DB_HOST', '127.0.0.1'), | |
'port' => env('DB_PORT', '3306'), | |
'database' => env('DB_DATABASE', 'forge'), | |
'username' => env('DB_USERNAME', 'forge'), | |
'password' => env('DB_PASSWORD', ''), | |
'unix_socket' => env('DB_SOCKET', ''), | |
'charset' => 'utf8mb4', |
NewerOlder