Skip to content

Instantly share code, notes, and snippets.

@andersonbosa
andersonbosa / wordpress-server-block.conf
Created October 18, 2024 20:33
How to change wordpress base path on Bitnami wordpress-nginx? Here your answer. `/opt/bitnami/nginx/conf/server_blocks/wordpress-server-block.conf`
server {
listen 8080 default_server;
listen [::]:8080 default_server;
server_name _;
root /var/www/html;
index index.php index.html index.htm;
BEGIN;
/* SETUP */
CREATE EXTENSION IF NOT EXISTS "pgcrypto";
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
CREATE TABLE Users
(
user_id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
@andersonbosa
andersonbosa / patter_chaser_algorithm.js
Last active September 25, 2024 11:15
coderbyte challenge pattern chaser
/*
- input tem ate 20chars, sendo alfa-numérico lowercase
- padrão : 2 ou mais caractéres adjacentes na string
forem repetidos pelo menos uma vez
"aabecaa" => "yes aa" => because "[aa]bec[aa]"
"abbbaac" => "no null" => because not found pattern
"aabejiabkfabed" => "yes abe" => becayse "a[abe]jiabkf[abe]d"
*/
function closestEnemy(arr){
// console.time('PERFORMANCE_1')
const position = arr.indexOf(1)
let closestDistance = Infinity
for (
let i = 0;
i < arr.length;
i++
) {
const foundEnemy = arr[i] === 2
@andersonbosa
andersonbosa / lru_cache_algorithm.js
Last active September 25, 2024 11:09
coderbyte chall
function LRUCache(strArr) {
const CACHE_SIZE = 5
const cache = []
// // console.time('ARRAY_PERFORMANCE')
// strArr.forEach(
// char => {
// const charIndex = cache.indexOf(char)
// if (charIndex === -1) {
@andersonbosa
andersonbosa / studying_docker_image_sizes_to_performance.md
Created September 14, 2024 14:10
testando diferentes imagens docker

studying_docker_image_sizes_to_performance

@andersonbosa
andersonbosa / gitlab_add_batch_of_envvars.mjs
Last active September 11, 2024 20:30
Set/update multiple CI/CD variables on your Gitlab Pipelines.
#!/usr/bin/env zx
/**
* This script aims to add multiple environment variables to your Gitlab settings.
*
* Useful when setting up a new pipeline.
*
* @author Anderson Bosa < https://github.com/andersonbosa >
*
* @example
// ==UserScript==
// @name animeszone.net upgrader
// @match https://animeszone.net/*
// @version 99
// @author https://twitter.com/t4inha
// @description 8/21/2023, 1:52:49 PM
// ==/UserScript==
const CUSTOM_CSS = `
#tt-wp > header > header > nav {
import winston from 'winston'
const createWinstonLogger = () => winston.createLogger({
levels: winston.config.syslog.levels,
transports: [
new winston.transports.Console({
level: 'info',
format: winston.format.combine(
winston.format.colorize({ all: true }),
// ------------------------------- lib
import amqp from 'amqplib'
import { v4 as uuidv4 } from 'uuid'
import {
Broker,
BrokerBinding,
BrokerConfig,