Skip to content

Instantly share code, notes, and snippets.


Vagner Luz do Carmo vluzrmos

Block or report user

Report or block vluzrmos

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
vluzrmos / docker-compose.yml
Created Aug 2, 2019
Docker-compose replace command
View docker-compose.yml
# ...
# ...
# ...
command: >
bash -c "
php artisan cache:clear &&
php artisan config:clear &&
vluzrmos /
Created May 8, 2019
Write into a SSH Remote File
echo 'Some Text' | ssh user@remotehost -T "cat > /remotefile.txt"
# The -T disables pseudo-terminal allocation and stops you from getting the message,
# Pseudo-terminal will not be allocated because stdin is not a terminal.
# @see
vluzrmos /
Last active Jun 20, 2019
Hyper-V and Ubuntu integration tools.
# Integração Ubuntu 18.04.2 + Hyper V
sudo apt-get update -y && sudo apt-get install -y \
linux-cloud-tools-common \
linux-tools-generic \
vluzrmos /
Last active May 1, 2019
WSL Ubuntu Configuration. (Microsoft Windows Subsystem For Linux)
## It will install apache2, php, mysql and another stuffs.
# Note: Should run this scripts as root or sudoer
# Note: If you want to connect with root user from WSL Host (from windows)
# you should replace mysql password plugin method from "auth_socket" to "mysql_native_password".
# @see
vluzrmos / guzzle_v6_resolve_http_redirection.php
Last active Sep 26, 2018
PHP URL Resolve HTTP Redirection Recursively
View guzzle_v6_resolve_http_redirection.php
* Resolver using Guzzle
if (!function_exists('resolve_http_redirection')) {
* @param string $url
* @param int $limit
* @return mixed
vluzrmos /
Last active Jul 4, 2019
Configurar o Laragon CMDER dentro do PHPSTORM

1- Adicionar a variável de ambiente CMDER_ROOT com o caminho para C:\laragon\bin\cmder (local do cmder no computador)

2- Abrir o phpstorm, ir em File (Menu) > Settings > Tools > Terminal e alterar o caminho padrão "cmd.exe" para:

"cmd.exe" /k ""%CMDER_ROOT%\vendor\init.bat""

3- Pode acontecer de a variável CMDER_ROOT não estar pronta, você pode precisar reiniciar sua máquina.

vluzrmos / HasWithCountScope.php
Last active Aug 17, 2019
Laravel 5.1 withCount(relation) method.
View HasWithCountScope.php
namespace App;
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\HasOneOrMany;
use Illuminate\Database\Eloquent\Relations\Relation;
use Illuminate\Database\Query\Builder as QueryBuilder;
use Illuminate\Database\Query\Expression;
vluzrmos / unnacent.php
Created Jul 11, 2017
View unnacent.php
function to_ascii($str, $removeUnsupported = true)
foreach (ascii_chars() as $key => $value) {
$str = str_replace($value, $key, $str);
if ($removeUnsupported) {
$str = preg_replace('/[^\x20-\x7E]/u', '', $str);
vluzrmos / paginate.php
Created Jul 20, 2016
Laravel Paginate Collection or Array
View paginate.php
* Gera a paginação dos itens de um array ou collection.
* @param array|Collection $items
* @param int $perPage
* @param int $page
* @param array $options
* @return LengthAwarePaginator
vluzrmos / Laravel_Response_Streamed.php
Created May 11, 2016 — forked from langemike/streamed.php
Laravel response macro for streamed responses with seeking support (with bug fixes & usage example)
View Laravel_Response_Streamed.php
Response::macro('streamed', function($type, $size, $name, $callback) {
$start = 0;
$length = $size;
$status = 200;
$headers = [
'Content-Type' => $type,
'Content-Length' => $size,
You can’t perform that action at this time.