Skip to content

Instantly share code, notes, and snippets.

Working from home

Vagner Luz do Carmo vluzrmos

Working from home
View GitHub Profile
vluzrmos /
Last active Aug 29, 2015
Function to import tgz file to mysql.
tar -xOzf $1 | mysql -u ${2:-root} -p${3:-1234}
devster / gist:9545326
Created Mar 14, 2014
Install mscorefonts on debian wheezy
View gist:9545326
# Add this repo to the /etc/apt/source.list file
deb stable contrib non-free
# And run these commands
sudo apt-get update
sudo apt-get install ttf-mscorefonts-installer
vluzrmos / DatabaseSeeder.php
Last active Apr 19, 2017
Laravel - Seeding 100k many rows at 1s
View DatabaseSeeder.php
use Illuminate\Database\Seeder;
use Illuminate\Database\Eloquent\Model;
use App\User;
class DatabaseSeeder extends Seeder {
* Run the database seeds.
Repox / laravel
Created Aug 18, 2014
Laravel logrotate configuration (1 daily rotation, 7 days retention)
View laravel
/home/laravel/app/storage/logs/laravel.log {
rotate 7
maxage 7
create 755 user group
su user group
langemike / streamed.php
Last active Jun 22, 2020 — forked from m4tthumphrey/streamed.php
Laravel response macro for streamed responses with seeking support (with bug fixes & usage example)
View streamed.php
Response::macro('streamed', function($type, $size, $name, $callback) {
$start = 0;
$length = $size;
$status = 200;
$headers = [
'Content-Type' => $type,
'Content-Length' => $size,
ManojKiranAppathurai / full.php
Last active Dec 21, 2021
Inertia Js Paginate
View full.php
Route::get('/', function (\Illuminate\Http\Request $request) {
$initialSearch = $request->query('search', '');
$userQuery = User::query()
->when($request->filled('search'),function($query) use ($initialSearch){
loilo /
Last active Jul 12, 2022
Find Free Port with PHP

Find Free Port with PHP

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.