Skip to content

Instantly share code, notes, and snippets.

View bergpb's full-sized avatar
💻
https://blog.bergpb.dev

Lindemberg Barbosa bergpb

💻
https://blog.bergpb.dev
View GitHub Profile

Oh my zsh.

Oh My Zsh

Install ZSH.

sudo apt install zsh-autosuggestions zsh-syntax-highlighting zsh

Install Oh my ZSH.

@bergpb
bergpb / list-git-branches.groovy
Created October 27, 2022 16:55 — forked from ThabetAmer/list-git-branches.groovy
Jenkins Groovy script to read Git repo branches and list them in an array, can be suited with Active Choice Jenkins Plugin
#!/usr/bin/env groovy
/**
* List all Git branches of a repo.
* @author thabet.amer@gmail.com
* @since Jenkins 2.204.1
* @params String url for Git repo URL, String credentialID, Bool activeChoice if ActiveChoice plugin used, String defaultBranch
* @return String array of branch names
*
* Dependencies:
@bergpb
bergpb / fabfile.py
Created July 27, 2022 17:08 — forked from eshandas/fabfile.py
Fabric 2 file for helping in deployments and other housekeeping tasks
# Fabfile to:
# - update the remote system(s)
# - download and install an application
from fabric import Connection
from fabric import task
import os
import environ
root = environ.Path(__file__) - 1 # one folder back (/manage - 3 = /)
@bergpb
bergpb / esp32_ttgo_t5_213.yaml
Created July 16, 2022 14:01 — forked from TheGroundZero/esp32_ttgo_t5_213.yaml
TTGO T5 v2.3.1 2.13" display in ESPHome
# Board
# https://s.click.aliexpress.com/e/_9IDl91
# ESPHome docs:
# - https://esphome.io/components/display/waveshare_epaper.html
# - https://esphome.io/components/spi.html#spi
# - https://esphome.io/components/display/index.html#formatted-text
substitutions:
esphome_name: esp32_ttgo_t5
@bergpb
bergpb / postgres-cheatsheet.md
Created March 29, 2022 17:14 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@bergpb
bergpb / install.md
Created March 20, 2022 15:43 — forked from Ryanb58/install.md
How to install telnet into a alpine docker container. This is useful when using the celery remote debugger in a dev environment.
>>> docker exec -it CONTAINERID /bin/sh
/app # telnet
/bin/sh: telnet: not found

/app # apk update
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/x86_64/APKINDEX.tar.gz
v3.7.0-243-gf26e75a186 [http://dl-cdn.alpinelinux.org/alpine/v3.7/main]
v3.7.0-229-g087f28e29d [http://dl-cdn.alpinelinux.org/alpine/v3.7/community]
@bergpb
bergpb / youtube_clean_watch_later_videos.js
Last active May 26, 2021 16:07 — forked from qoomon/youtube_clean_watch_later_videos.js
Clean YouTube Watch Later Videos
// This script will remove all videos from watch later list
//
// Usage
//
// #1 go to https://www.youtube.com/playlist?list=WL
// #2 run following script
// adjust REMOVE_BUTTON_TEXT_MAP if your language is missing
(async function() {
const REMOVE_BUTTON_TEXT_MAP = {
@bergpb
bergpb / SessionTimeout.php
Created February 24, 2021 22:27 — forked from rcaneppele/SessionTimeout.php
Configurando Session-Timeout no PHP
session_start();
$timeout = 600; // Tempo da sessao em segundos
// Verifica se existe o parametro timeout
if(isset($_SESSION['timeout'])) {
// Calcula o tempo que ja se passou desde a cricao da sessao
$duracao = time() - (int) $_SESSION['timeout'];
// Verifica se ja expirou o tempo da sessao
if($duracao > $timeout) {
@bergpb
bergpb / Transfer repository
Created February 16, 2021 16:53 — forked from mandiwise/Update remote repo
Transfer repo from Bitbucket to Github
// Reference: http://www.blackdogfoundry.com/blog/moving-repository-from-bitbucket-to-github/
// See also: http://www.paulund.co.uk/change-url-of-git-repository
$ cd $HOME/Code/repo-directory
$ git remote rename origin bitbucket
$ git remote add origin https://github.com/mandiwise/awesome-new-repo.git
$ git push origin master
$ git remote rm bitbucket
@bergpb
bergpb / revisao-commit.md
Created February 15, 2021 12:35 — forked from pedrosancao/revisao-commit.md
Manual de Revisão de Commit

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