Skip to content

Instantly share code, notes, and snippets.

View paulodutra's full-sized avatar

Paulo Dutra paulodutra

View GitHub Profile
version: '3'
services:
db:
build:
context: ./
dockerfile: mysql.dockerfile
container_name: db-laravel
restart: always
tty: true
ports:
FROM php:5.6-apache
#Instala as libs de desenvolvimento
RUN apt update && apt install -y \
libaio1 \
vim \
unzip \
curl \
wget \
build-essential \
<?php
class Sql {
public $conn;
public function __construct(){
return $this->conn = mysqli_connect("127.0.0.1","root","","hcode_shop");
@paulodutra
paulodutra / composer-with-official-image-php.dockerfile
Created December 8, 2022 15:20
You can use this dockerfile for install composer and php together using only official images docker.
FROM composer as composer
FROM php:VERSION
COPY --from=composer /usr/bin/composer /usr/bin/composer
@paulodutra
paulodutra / laminas-api-tools-database
Created December 8, 2022 15:23
The dabase using the test laminas-api-tools. Link to repository: https://github.com/paulodutra/laminas-api-tools
First create the sqlite file: touch test.sqlite
Access the database file using the sqlite: sqlite3 test.sqlite
Listing of the tables: .tables
Creating the table of users: create table users(id int, name varchar(255), email varchar(255));
@paulodutra
paulodutra / golang-install-grpc.txt
Last active December 15, 2022 14:09
golang installation with protocol buffter compiler and plugins for working gRPC with golang
1. First make the download the Go installer: curl -k https://go.dev/dl/go1.19.4.linux-amd64.tar.gz -o go.1.19.14.linux-amd64.tar.gz
2. You need remove any previous Go installation (if it exists), and then extract the file downloaded before: rm -rf /usr/local/go && tar -C /usr/local -xzf go1.19.4.linux-amd64.tar.gz
3. Add the go PATH in PATH environment variable: export PATH=$PATH:/usr/local/go/bin
4. Open the profile file: vim ~/.profile
5. In the end profile file add the go PATH: PATH=$PATH:/usr/local/go/bin
6. Install de protocol buffter compiler: apt install protobuf-compiler
7. Install the go plugins for working with gRPC:
go install google.golang.org/protobuf/cmd/[email protected]
go install google.golang.org/grpc/cmd/[email protected]
8. Update your PATH with protoc complier can find the plugins:
@paulodutra
paulodutra / example-swagger-user.yaml
Created January 14, 2023 00:29
Example of documentation using swagger write in yaml
swagger: "2.0"
info:
description: "Prover acesso ao recurso de usuários."
version: "0.0.1"
title: "Lista de Usuários"
termsOfService: "http://swagger.io/terms/"
contact:
name: Paulo
email: "[email protected]"
license:
@paulodutra
paulodutra / 1-create-typescript-project.sh
Last active April 12, 2023 18:52
1 - Create a simple project with typescript and jest
npm init -y
npm i typescript [email protected] @types/node @types/[email protected] [email protected] --save-dev
function firstAttack() {
if [monsterA.speed == monsterB.speed] then
if[monsterA.attack > monsterB.attack] then
monsterAttack = monsterA
monsterDefense = monsterB
else
monsterAttack = monsterB
monsterDefense = monsterA
fi
else if [monsterA.speed > monsterB.speed] then
@paulodutra
paulodutra / for.py
Created July 25, 2023 13:19
An example using for and array of strings in python
names = ['Maria', 'João', 'Jose', 'Cleiton', 'Pedro']
for name in names:
print(name)