Skip to content

Instantly share code, notes, and snippets.

View CViniciusSDias's full-sized avatar

Vinicius Dias CViniciusSDias

View GitHub Profile
@CViniciusSDias
CViniciusSDias / ContatosController.php
Created June 21, 2018 20:32
Controller de Contato (Exemplo)
<?php
namespace App\Controller;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
class ContatosController
{
/**
* @var ExtratorDeContatoPorRequest
@CViniciusSDias
CViniciusSDias / socket-server.php
Last active March 12, 2021 20:49
Estudo sobre stream_select
<?php
$socket = stream_socket_server("tcp://0.0.0.0:8000", $errno, $errstr);
if (!$socket) {
var_dump($errno, $errstr);
exit(1);
}
while ($con = stream_socket_accept($socket)) {
@CViniciusSDias
CViniciusSDias / linkedin.js
Created January 19, 2022 19:15
Aceitar todos os convites do LinkedIn
document
.querySelectorAll('button[aria-label^="Aceitar o convite de"]')
.forEach((btn, i) => setTimeout(() => btn.click(), i + 500));
xdebug.mode=debug
xdebug.discover_client_host=0
xdebug.client_host=host.docker.internal
@CViniciusSDias
CViniciusSDias / diagrama.drawio
Created July 17, 2023 17:16
C4_Container_Aula4_Armazenamento
<mxfile host="app.diagrams.net" modified="2023-07-17T17:13:44.478Z" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36" etag="5PvtiTya1RYCcQBED2bU" version="21.6.2" type="device">
<diagram name="Página-1" id="mI2GYrTSxOv4K2kOxEs7">
<mxGraphModel dx="1434" dy="792" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<object placeholders="1" c4Name="Avaliador" c4Type="SystemScopeBoundary" c4Application="Software System" label="&lt;font style=&quot;font-size: 16px&quot;&gt;&lt;b&gt;&lt;div style=&quot;text-align: left&quot;&gt;%c4Name%&lt;/div&gt;&lt;/b&gt;&lt;/font&gt;&lt;div style=&quot;text-align: left&quot;&gt;[%c4Application%]&lt;/div&gt;" id="qcH5OeLFRZIFURpJNsWB-1">
<mxCell style="rounded=1;fontSize=11;whiteSpace=wrap;html=1;dashed=1;arc
@CViniciusSDias
CViniciusSDias / ler-emails.php
Last active February 23, 2024 18:33
Script para ler e-mails em voz alta usando PHP
<?php
use PhpImap\Mailbox;
require_once 'vendor/autoload.php';
$mailbox = new Mailbox(
'{imap.gmail.com:993/imap/ssl}INBOX',
'seu-email@gmail.com',
'sua senha aqui',
@CViniciusSDias
CViniciusSDias / Dockerfile
Created April 13, 2024 19:52
TransformersPHP error
FROM php:8.3-cli
RUN apt update && apt install -y libffi-dev libz-dev libpng-dev git libzip-dev
RUN docker-php-ext-install ffi sockets gd pcntl zip
COPY --from=composer:2.5.8 /usr/bin/composer /usr/bin/composer
RUN composer require codewithkyrian/transformers
RUN ./vendor/bin/transformers install
@CViniciusSDias
CViniciusSDias / completo.php
Created December 4, 2024 00:20
I/O não bloqueante
<?php
$streams = [
stream_socket_client('tcp://example.org:80'),
fopen('composer.json', 'r'),
fopen('package.json', 'r'),
];
foreach ($streams as $stream) {
stream_set_blocking($stream, false);