Skip to content

Instantly share code, notes, and snippets.

View lucenarenato's full-sized avatar
🐘
Remoto

Renato Lucena lucenarenato

🐘
Remoto
View GitHub Profile
@lucenarenato
lucenarenato / Seed_cidades.php
Created October 27, 2022 21:53 — forked from edsonmsantos/Seed_cidades.php
[Seed_cidades] Seed de cidades do Brasil para Laravel, atualizado em 12/10/2020 a partir do site https://sidra.ibge.gov.br/territorio#/N6 #php #laravel
Cities::create([
'cod' => '11',
'uf_name' => 'Rondônia',
'city' => "Alta Floresta D'Oeste",
]);
Cities::create([
'cod' => '11',
'uf_name' => 'Rondônia',
'city' => "Ariquemes",
@lucenarenato
lucenarenato / descript_file.php
Created October 27, 2022 21:53 — forked from edsonmsantos/descript_file.php
[Descriptografar arquivo com OpenSSL] #php
<?php
exec('openssl enc -aes-256-cbc -pbkdf2 -k 102030 -in /mnt/c/Lixo/a.enc.txt -out /mnt/c/Lixo/b.txt');// Encrypt
exec('openssl enc -aes-256-cbc -pbkdf2 -k 102030 -d -in /mnt/c/Lixo/a.enc.txt -out /mnt/c/Lixo/b.txt');// Decrypt
/**
É nescessário possuir o OpenSSL no computador, se for windows, basta realizar o download dos seguintes arquivos e adicionar a um diretório que esteja na path do sistema.
https://host.sisecf.app/arquivos/openssl/msys-crypto-1.1.dll
https://host.sisecf.app/arquivos/openssl/msys-ssl-1.1.dll
https://host.sisecf.app/arquivos/openssl/openssl.exe
ou
@lucenarenato
lucenarenato / prepare_linux.sh
Created October 27, 2022 21:51 — forked from edsonmsantos/prepare_linux.sh
[Prepare Linux] #linux
echo Preparando......
sudo mkdir /home/downloads
cd /home/downloads
sudo chmod -R 777 /home/downloads
#echo Google Chrome
get https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i ./google-chrome-stable_current_amd64.deb
sudo rm ./google-chrome-stable_current_amd64.deb
@lucenarenato
lucenarenato / docker-compose-example.yml
Created October 27, 2022 14:09
custom-501-mysql8-phpmyadmin-docker-compose-example.yml
# Use admin/pass as user/password credentials to login to openemr (from OE_USER and OE_PASS below)
# MYSQL_HOST and MYSQL_ROOT_PASS are required for openemr
# FLEX_REPOSITORY and (FLEX_REPOSITORY_BRANCH or FLEX_REPOSITORY_TAG) are required for flex openemr
# MYSQL_USER, MYSQL_PASS, OE_USER, MYSQL_PASS are optional for openemr and
# if not provided, then default to openemr, openemr, admin, and pass respectively.
version: '3.1'
services:
mysql:
restart: always
@lucenarenato
lucenarenato / manual_paginate.php
Created October 14, 2022 21:47 — forked from nellytadi/manual_paginate.php
Manual Paginate In Laravel
<?php
namespace App\Http\Controllers\Api;
use App\Model;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Pagination\LengthAwarePaginator as Paginator;
@lucenarenato
lucenarenato / Upload-Multipart-Form-Data.md
Created October 7, 2022 21:38
Exemplo File Upload Using Multipart Form Data

segue o exemplo de uma forma alternativa.

/**
* @OA\Post(
* tags={"Files"},
* description="Envia os arquivos especificados para o servidor.",
* path="/files/upload",
* security={{"bearerAuth":{}}},
* @OA\RequestBody(
@lucenarenato
lucenarenato / LongestWord.md
Created September 26, 2022 18:44
Create PHP function LongestWord(sen) take the sen parameter being passed and return the largest word in the string.

Have the function LongestWord(sen) take the sen parameter being passed and return the longest word in the string. If there are two or more words that are the same length, return the first word from the string with that length. Ignore punctuation and assume sen will not be empty. Words may also contain numbers, for example "Hello world123 567"

pt_BR

Faça com que a função LongestWord(sen) pegue o parâmetro sen que está sendo passado e retorne a palavra mais longa na string. Se houver duas ou mais palavras com o mesmo comprimento, retorne a primeira palavra da string com esse comprimento. Ignore a pontuação e assuma que sen não estará vazio. As palavras também podem conter números, por exemplo "Hello world123 567"

Solution:

<?php

function LongestWord($sen) {
    $return = '';
@lucenarenato
lucenarenato / docker-setup.sh
Created September 26, 2022 18:24 — forked from Gerst20051/docker-setup.sh
Automate Docker Setup Script
#!/usr/bin/env sh
# ASCII: http://patorjk.com/software/taag/#p=display&f=Graffiti&t=Docker%20Setup%20Script
# SOURCE: https://gist.github.com/Gerst20051/bf1341448bd43f430761c1f8150fb1b7
function double_echo {
echo && echo
}
function newline {
@lucenarenato
lucenarenato / age_counting.php
Created September 26, 2022 18:20 — forked from Gerst20051/age_counting.php
PHP Age Counting
<?php
// Your goal is to count how many items exist that have an age equal to or greater than 50, and print this final value.
$ch = curl_init('https://coderbyte.com/api/challenges/json/age-counting');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, 0);
$data = curl_exec($ch);
curl_close($ch);
@lucenarenato
lucenarenato / UsingFakerInPT-BR.md
Last active August 17, 2022 20:22 — forked from flyingluscas/UsingFakerInPT-BR.md
Utilizando Faker em pt-BR

Utilizando Faker em pt-BR

Acesse o seu arquivo app/Providers/AppServiceProvider.php, e no método register adicione o seguinte :

/**
 * Register any application services.
 *
 * @return void
 */