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\Providers; | |
use Illuminate\Support\Facades\Validator; | |
use Illuminate\Support\ServiceProvider; | |
class AppServiceProvider extends ServiceProvider | |
{ | |
/** |
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
# create prepend sql commands | |
echo "set autocommit=0;set unique_checks=0;set foreign_key_checks=0;" > prepend.sql | |
# prepend huge.sql above commands | |
cat huge.sql >> prepend.sql | |
# create append sql commands | |
echo "set autocommit=1;set unique_checks=1;set foreign_key_checks=1;" > append.sql | |
# prepend huge.sql with append.sql |
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
package main | |
import ( | |
"crypto/sha256" | |
"encoding/json" | |
"fmt" | |
"strconv" | |
"strings" | |
"time" | |
) |
Connect to MongoDB
sudo /snap/rocketchat-server/current/bin/mongo
Select Rocket.Chat Database
use parties
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 | |
collect( | |
glob(base_path('/routes/web/*.php')) | |
)->each(function ($path) { | |
require $path; | |
}); |
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 (! function_exists('time_period')) { | |
function time_period() | |
{ | |
// Morning: 6 a.m.-noon | |
// Afternoon: noon-6 p.m. | |
// Evening: 6-9 p.m. | |
$value = (int) date('H'); |
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\Exceptions; | |
use Exception; | |
class ContractException extends Exception | |
{ | |
public static function throwIf(bool $condition, string $method, ...$args) | |
{ |
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\Actions; | |
class MemoryUtilisation | |
{ | |
public $units = ['B','KB','MB','GB','TB','PB']; | |
public $start; | |
public $startTime; | |
public $end; |