This is a quick way to find a random free port on a system using PHP:
$port = find_free_port();
Benchmarked locally, where finding a port always took around 0.15ms.
Route::get('/', function (\Illuminate\Http\Request $request) { | |
$initialSearch = $request->query('search', ''); | |
$userQuery = User::query() | |
->when($request->filled('search'),function($query) use ($initialSearch){ | |
$query->where('name','LIKE','%'.$initialSearch.'%') | |
->orWhere('email','LIKE','%'.$initialSearch.'%'); | |
}); |
<?php | |
Response::macro('streamed', function($type, $size, $name, $callback) { | |
$start = 0; | |
$length = $size; | |
$status = 200; | |
$headers = [ | |
'Content-Type' => $type, | |
'Content-Length' => $size, |
import_tgz(){ | |
tar -xOzf $1 | mysql -u ${2:-root} -p${3:-1234} | |
} |
<?php | |
use Illuminate\Database\Seeder; | |
use Illuminate\Database\Eloquent\Model; | |
use App\User; | |
class DatabaseSeeder extends Seeder { | |
/** | |
* Run the database seeds. |
/home/laravel/app/storage/logs/laravel.log { | |
daily | |
missingok | |
rotate 7 | |
maxage 7 | |
compress | |
notifempty | |
create 755 user group | |
su user group | |
} |
# Add this repo to the /etc/apt/source.list file | |
deb ftp://ftp.debian.org/debian stable contrib non-free | |
# And run these commands | |
sudo apt-get update | |
sudo apt-get install ttf-mscorefonts-installer |