Skip to content

Instantly share code, notes, and snippets.

View lucenarenato's full-sized avatar
🐘
Remoto

Renato Lucena lucenarenato

🐘
Remoto
View GitHub Profile
@lucenarenato
lucenarenato / Jenkinsfile.groovy
Created March 8, 2024 19:54 — forked from andymotta/Jenkinsfile.groovy
Use Terraform latest docker image in Declarative Jenkins Pipeline
pipeline {
agent {
docker {
image 'hashicorp/terraform:latest'
label 'LINUX-SLAVE'
args '--entrypoint="" -u root -v /opt/jenkins/.aws:/root/.aws'
}
}
options {
ansiColor('xterm')
@lucenarenato
lucenarenato / logical-replication-test.sh
Created January 31, 2024 21:11 — forked from ololobus/logical-replication-test.sh
PostgreSQL logical replication + pg_basebackup test
#!/bin/sh -ex
#export PATH=/usr/pgsql-11/bin:$PATH
pg_ctl stop -D /tmp/master || echo "ok"
pg_ctl stop -D /tmp/slave || echo "ok"
rm -rf /tmp/master
rm -rf /tmp/slave
# setup master
initdb -D /tmp/master
@lucenarenato
lucenarenato / pgbench-query.sql
Created January 31, 2024 20:57 — forked from ololobus/pgbench-query.sql
PostgreSQL pgbench schema
\set aid random(1, 100000 * :scale)
\set bid random(1, 1 * :scale)
\set tid random(1, 10 * :scale)
\set delta random(-5000, 5000)
BEGIN;
UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;
SELECT abalance FROM pgbench_accounts WHERE aid = :aid;
UPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;
UPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;
INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);
@lucenarenato
lucenarenato / Install_PHP_on_Arch_Manjaro_Biglinux.md
Created July 7, 2023 20:14
Install multiple PHP versions on Arch / Manjaro Linux / BigLinux

Install Any PHP on Arch / Manjaro / Biglinux

Through the AUR it is possible to install older and newer PHP versions, simultaneously on the same system. I often had trouble installing using pacman and pamac so here's what I did:

mkdir -p $HOME/bin
mkdir ~/src
cd ~/src
git clone https://aur.archlinux.org/php72.git
cd php72
@lucenarenato
lucenarenato / iptables.sh
Created May 31, 2023 20:17 — forked from QNimbus/iptables.sh
Basic iptables configuration
trustedIP="1.2.3.4/32"
cat <<- EOF > /etc/iptables/rules.v4
# Generated by iptables-save v1.8.7 on Wed Mar 29 14:37:32 2023
*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
@lucenarenato
lucenarenato / supervisord.conf
Created April 13, 2023 00:09 — forked from dkarchmer/supervisord.conf
Sample supervisord conf for running a python script in the background
; Assumes dockerfile with:
; ENTRYPOINT ["/usr/bin/supervisord", "-c", "/var/app/supervisord.conf"]
[supervisord]
;logfile=/var/app/logs/ ; (main log file;default $CWD/supervisord.log)
logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB)
logfile_backups=5 ; (num of main logfile rotation backups;default 10)
loglevel=debug ; (log level;default info; others: debug,warn,trace)
pidfile=/tmp/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
nodaemon=true ; (start in foreground if true;default false)
@lucenarenato
lucenarenato / .env-Swoole
Created April 5, 2023 18:38 — forked from kiddtang/.env-Swoole
Youtube - Boosts your Laravel Sail
OCTANE_SERVER=swoole
OCTANE_HTTPS=true
@lucenarenato
lucenarenato / alpine_install_telnet.md
Created March 27, 2023 21:31
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]
@lucenarenato
lucenarenato / NamespaceHelper.php
Created November 1, 2022 20:21 — forked from SrcFlux/NamespaceHelper.php
Get the namespace of a class in Laravel
<?php
namespace App\Helpers;
class NamespaceHelper
{
/**
* Get the namespace of a class.
*
* @param string $className
@lucenarenato
lucenarenato / cidades.sql
Created October 27, 2022 21:54 — forked from edsonmsantos/cidades.sql
[Cidade do Brasil] SQL das cidade do Brasil, atualizado em 12/10/2020 a partir do site https://sidra.ibge.gov.br/territorio#/N6 #sql
insert into cities (cod, uf_name, city) values (11, "Rondônia", "Alta Floresta D'Oeste");
insert into cities (cod, uf_name, city) values (11, "Rondônia", "Ariquemes");
insert into cities (cod, uf_name, city) values (11, "Rondônia", "Cabixi");
insert into cities (cod, uf_name, city) values (11, "Rondônia", "Cacoal");
insert into cities (cod, uf_name, city) values (11, "Rondônia", "Cerejeiras");
insert into cities (cod, uf_name, city) values (11, "Rondônia", "Colorado do Oeste");
insert into cities (cod, uf_name, city) values (11, "Rondônia", "Corumbiara");
insert into cities (cod, uf_name, city) values (11, "Rondônia", "Costa Marques");
insert into cities (cod, uf_name, city) values (11, "Rondônia", "Espigão D'Oeste");