Skip to content

Instantly share code, notes, and snippets.

View bergpb's full-sized avatar
🏠
Working from home

Lindemberg Barbosa bergpb

🏠
Working from home
View GitHub Profile
@bergpb
bergpb / cifra_de_cesar.py
Last active March 20, 2020 22:54
Cifra de César em Python
import string
from random import randint
texto_cifrado = ''
texto_original = ''
deslocamento = randint(1, 26)
alfabeto = list(string.ascii_lowercase)
print('Deslocamento igual a: {}'.format(deslocamento))
texto = input('Insira texto a ser cifrado, ou aperte enter para texto padrão: ')
@bergpb
bergpb / files.php
Last active February 28, 2020 14:51
laravel erro na validacao de um campo
##### form request
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class PessoaFormRequest extends FormRequest
{
/**
@bergpb
bergpb / .zshrc
Last active January 29, 2020 13:56
My ZSH config file.
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
@bergpb
bergpb / docker-compose.yml
Created January 28, 2020 02:07
Docker compose exemple
version: '3'
services:
flask:
build: app/.
container_name: controle-maquinas-flask
links:
- database
restart: always
ports:
@bergpb
bergpb / map_to_list_comp.py
Created January 24, 2020 17:37
Substituindo o Map por List Comprehension
nomes = ["marcos", "rosana", "ricardo", "silvia", "aline"]
# usando map
# def somente_nomes_com_a_letra_r(nome):
# return nome if "r" in nome else ""
# resultado = map(somente_nomes_com_a_letra_r, nomes)
# for r in resultado:
# print(r)
@bergpb
bergpb / reduce.py
Created January 24, 2020 17:35
Uso do reduce com Python
from functools import reduce
numeros = [1, 2, 3, 6]
def soma(valor, valor2):
return valor + valor2
resultado = reduce(soma, numeros)
print(resultado)
@bergpb
bergpb / git-deployment.md
Created January 4, 2020 19:06 — forked from noelboss/git-deployment.md
Simple automated GIT Deployment using Hooks

Simple automated GIT Deployment using GIT Hooks

Here are the simple steps needed to create a deployment from your local GIT repository to a server based on this in-depth tutorial.

How it works

You are developing in a working-copy on your local machine, lets say on the master branch. Most of the time, people would push code to a remote server like github.com or gitlab.com and pull or export it to a production server. Or you use a service like deepl.io to act upon a Web-Hook that's triggered that service.

@bergpb
bergpb / git.md
Created January 4, 2020 19:05 — forked from pedronauck/git.md
Terminal commands

Comandos Gerais

Clonar um Repositório

$ git clone 'nome-do-repositório'

Verificar status

$ git status
@bergpb
bergpb / mysql.database.yml
Created December 15, 2019 23:55 — forked from jwo/mysql.database.yml
Sample config/database.yml from Rails. Postgres, MySQL, and SQLite
#
# Install the MYSQL driver
# gem install mysql2
#
# Ensure the MySQL gem is defined in your Gemfile
# gem 'mysql2'
#
# And be sure to use new-style password hashing:
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
development:
@bergpb
bergpb / historiograma.py
Created November 27, 2019 22:59
Tabela Historiograma em Python
somatorio = 0
rk = [] # rk
nk = [8, 10, 16, 23, 33, 44, 56, 61] # nk fixo
pnk = [] # pnk
cdf = [] # cdf
tr = [] # tr
sk = [] # sk
print("Preenchendo valores na coluna 1..")
for i in range(1, 9):