Skip to content

Instantly share code, notes, and snippets.

View esilvajr's full-sized avatar

Edison Silva Jr esilvajr

  • Arquivei
  • Jaboticabal/São Carlos, SP
View GitHub Profile
@esilvajr
esilvajr / github-net-config.md
Created March 16, 2020 14:27 — forked from guilhermebruzzi/github-net-config.md
NET não libera a porta 22 e impede de acessar o github por ssh

Usar ssh do github com wifi do netcombo

A NET parece que só libera o uso de qualquer porta, como a porta 22 de ssh, para pessoa jurídica em seus novos planos (desde 2016).

Para conseguir usar o github por ssh com plano de internet da NET para pessoa física, é necessário:

Criar o arquivo ~/.ssh/config e adicionar:

Host github.com
@esilvajr
esilvajr / ConvertArrayOfObjectSample.php
Last active May 23, 2020 06:49
This is a basic solution when we need to convert a array of objects into a multidimensional array in PHP.
<?php
/**
* This is just a class for our tests
*/
class Foo
{
/**
* @var foo
*/
public $foo = 'foo';
@esilvajr
esilvajr / image_phpstorm_server.png
Last active March 27, 2022 23:49
How to use XDebug inside a docker container.
image_phpstorm_server.png
class DatabaseConnection:
__dbInstance = None
@classmethod
def getInstance(cls):
if cls.__dbInstance is None:
cls.__dbInstance = cls()
cls.__dbInstance.connect()
return cls.__dbInstance
@esilvajr
esilvajr / iti_factory_method_sample.py
Last active April 15, 2023 13:10
iti_factory_method_sample.py
class Cliente(): # Product
def gerencie(self):
raise NotImplementedError
class PessoaFisica(Cliente): # ConcreteProduct
def gerencie(self):
print("Gerenciando pessoas fisicas")
class DataMiner():
def mine(self, path: str): #templateMethod
file = self.openFile(path)
rawData = self.extractData(file)
data = self.parseData(rawData)
analysis = self.analyzeData(data)
self.sendReport(analysis)
self.closeFile(file)
def openFile(self, path: str) -> str:
class OrderState():
def processOrder(self, order):
raise NotImplementedError
class PaymentState():
_payment = None;
def verifyPayment(self) -> None:
@esilvajr
esilvajr / QueueFailedChunkCommand.php
Last active December 18, 2023 17:15
Execute Laravel failed_queue from database using chunk and wait.
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Artisan;
class QueueFailedChunkCommand extends Command
{
@esilvajr
esilvajr / kmskeys10.txt
Created November 6, 2017 17:38 — forked from CHEF-KOCH/kmskeys10.txt
Windows 10 KMS Keys
Windows.10.and.Office.2016.gVLK
#####################################################################
# Install/Uninstall keys #
#####################################################################
1.) Uninstall the current product by entering the “uninstall product key” extension:
slmgr.vbs /upk
2.) Install the key that you obtained above for “Windows Srv 2012R2 DataCtr/Std KMS for Windows 10”