Skip to content

Instantly share code, notes, and snippets.

Avatar
💻
https://bergpb.github.io

Berg Paulo bergpb

💻
https://bergpb.github.io
View GitHub Profile
@rponte
rponte / using-uuid-as-pk.md
Last active May 6, 2021
Não use UUID como PK nas tabelas do seu banco de dados
View using-uuid-as-pk.md

Pretende usar UUID como PK em vez de Int/BigInt no seu banco de dados? Pense novamente...

TL;TD

Não use UUID como PK nas tabelas do seu banco de dados.

Um pouco mais de detalhes

View form.py
#!/usr/bin/env python -*- coding: utf-8 -*-
from flask import request
from flask_wtf import FlaskForm, RecaptchaField
from wtforms import StringField, SelectField, TextField, TextAreaField, \
DateField, PasswordField, RadioField, BooleanField, SubmitField
from wtforms.validators import ValidationError, DataRequired, Length, \
Email, EqualTo, Regexp
from app.util.validators import Unique
from datetime import datetime
from flask_babel import _, lazy_gettext as _l
@pedrosancao
pedrosancao / revisao-commit.md
Last active Feb 15, 2021
Manual de Revisão de Commit
View revisao-commit.md

Manual de Revisão de Commit

O uso de repositórios GIT tem diversos benefícios: trabalho em equipe, desenvolvimento de recursos separadamente, histórico das alterações, etc. Mas para disponibilizar todo o potencial é preciso um pouco de dedicação no momento do commit.

Não é preciso uma vasta experiência para já ter passado por situações como conflito de arquivos onde a mensagem não traz nenhuma informações relevante e é preciso inverstigar o que a outra pessoa estava desenvolvendo ou após

View ttgo-t5-v2.3_battery.ino
#include <GxEPD2_BW.h>
#include <Fonts/FreeMonoBold9pt7b.h>
#define EPD_CS SS
GxEPD2_BW<GxEPD2_213_B73, GxEPD2_213_B73::HEIGHT> display(GxEPD2_213_B73(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEH0213B73
#define BAT 35
View send-telegram.groovy
def sendTelegram(message) {
def encodedMessage = URLEncoder.encode(message, "UTF-8")
withCredentials([string(credentialsId: 'telegramToken', variable: 'TOKEN'),
string(credentialsId: 'telegramChatId', variable: 'CHAT_ID')]) {
response = httpRequest (consoleLogResponseBody: true,
contentType: 'APPLICATION_JSON',
httpMode: 'GET',
url: "https://api.telegram.org/bot$TOKEN/sendMessage?text=$encodedMessage&chat_id=$CHAT_ID&disable_web_page_preview=true",
@michalc
michalc / table_csv_view.py
Created Mar 7, 2019
Django + gevent + psycopg2 download whole PostgreSQL table as CSV
View table_csv_view.py
import csv
import logging
import gevent
from psycopg2 import (
connect,
sql,
)
from django.conf import (
@onuralp
onuralp / Jenkinsfile
Last active Jan 6, 2021
Jenkins Shared lib function for VSTest Test Runner and Code Coverage Report
View Jenkinsfile
#!groovy
// I suggest you to add those functions as Shared Library https://jenkins.io/doc/book/pipeline/shared-libraries/
@Library('your-shared-lib') _
pipeline {
stages {
//..
stage('Run Unit Tests') {
steps {
@loganvolkers
loganvolkers / Byte Formatting for Google Sheets.md
Last active Apr 23, 2021
Byte formatting for Google Sheets
View Byte Formatting for Google Sheets.md
@kstrauser
kstrauser / black.md
Last active Nov 23, 2020
Using the "black" Python formatter in VS Code
View black.md

This is how to use the Black Python code formatter in VS Code.

Make a Python 3.6 virtualenv for running Black

Black itself requires Python 3.6 to run, but few of our projects are on that version. The VS Code plugin conveniently lets you run black from its own virtualenv.

I had to give a specific version of black this morning. I didn't yesterday. Don't specify the version unless it makes you (and if you do, give the current version, not the one from this doc).

$ cd ~/Envs