Skip to content

Instantly share code, notes, and snippets.

View carlosocarvalho's full-sized avatar
🎯
Focusing

Carlos Carvalho carlosocarvalho

🎯
Focusing
View GitHub Profile
@carlosocarvalho
carlosocarvalho / redis.conf
Created September 6, 2023 17:46
redis.conf
# Redis configuration file example
# Note on units: when memory size is needed, it is possible to specify
# it in the usual form of 1k 5GB 4M and so forth:
#
# 1k => 1000 bytes
# 1kb => 1024 bytes
# 1m => 1000000 bytes
# 1mb => 1024*1024 bytes
# 1g => 1000000000 bytes
@carlosocarvalho
carlosocarvalho / config.md
Last active June 12, 2020 02:15
Configure - Vm Glusterfs

Format disk external

$ mkfs.xfs /dev/vdb

Set path for disk external for on boot mount automatic

Execute in all nodes(node1, node2,node3 ....)

$ mkdir /storage/bricks/1 -p
@carlosocarvalho
carlosocarvalho / kafka-stack.yaml
Created January 7, 2020 19:07
Kafka file for docker swarm
version: '3.3'
services:
kafka-1:
image: wurstmeister/kafka:1.1.0
environment:
KAFKA_BROKER_ID: '1'
KAFKA_CONTROLLER_SHUTDOWN_ENABLE: 'true'
KAFKA_DEFAULT_REPLICATION_FACTOR: '3'
KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: '3000'
KAFKA_INTER_BROKER_LISTENER_NAME: INSIDE
@carlosocarvalho
carlosocarvalho / javascript-object-to-querystring.js
Created March 1, 2019 01:33 — forked from tjmehta/javascript-object-to-querystring.js
Object to Querystring - JavaScript, JS, JSON
function objectToQuerystring (obj) {
return Object.keys.reduce(function (str, key, i) {
var delimiter, val;
delimiter = (i === 0) ? '?' : '&';
key = encodeURIComponent(key);
val = encodeURIComponent(obj[key]);
return [str, delimiter, key, '=', val].join('');
}, '');
}
@carlosocarvalho
carlosocarvalho / Jenkinsfile
Created February 16, 2019 01:53 — forked from bvis/Jenkinsfile
Jenkin pipeline definition example to be integrated with Docker Swarm cluster in our CI/CD environment
pipeline {
agent { node { label 'swarm-ci' } }
environment {
TEST_PREFIX = "test-IMAGE"
TEST_IMAGE = "${env.TEST_PREFIX}:${env.BUILD_NUMBER}"
TEST_CONTAINER = "${env.TEST_PREFIX}-${env.BUILD_NUMBER}"
REGISTRY_ADDRESS = "my.registry.address.com"
SLACK_CHANNEL = "#deployment-notifications"
@carlosocarvalho
carlosocarvalho / nginx.conf
Created September 17, 2018 16:05 — forked from calebwoods/nginx.conf
Sample Nginx config for deployment of Angular.js app
server { listen 80;
server_name example.com;
access_log /var/log/example.com/nginx.access.log;
error_log /var/log/example.com/nginx.error.log;
root /var/www/apps/example.com/public;
charset utf-8;
location / {
rewrite ^ https://$host$request_uri? permanent;
}
@carlosocarvalho
carlosocarvalho / postman_install.sh
Created August 16, 2018 22:22 — forked from posemon/postman_install.sh
Postman install Ubuntu 18.04
#!/bin/bash
# Get postman app
wget https://dl.pstmn.io/download/latest/linux64 -O postman.tar.gz
sudo tar -xzf postman.tar.gz -C /opt
sudo ln -s /opt/Postman/Postman /usr/bin/postman
#Create a Desktop Entry
cat > ~/.local/share/applications/postman.desktop <<EOL
[Desktop Entry]
Encoding=UTF-8
@carlosocarvalho
carlosocarvalho / openssl_encrypt_decrypt.php
Created August 2, 2018 16:04 — forked from joashp/openssl_encrypt_decrypt.php
Simple PHP encrypt and decrypt using OpenSSL
<?php
/**
* simple method to encrypt or decrypt a plain text string
* initialization vector(IV) has to be the same when encrypting and decrypting
*
* @param string $action: can be 'encrypt' or 'decrypt'
* @param string $string: string to encrypt or decrypt
*
* @return string
*/
/**
* Class to check up e-mail
*
* @author Konstantin Granin <kostya@granin.me>
* @copyright Copyright (c) 2010, Konstantin Granin
*/
class VerifyEmail {
/**
@carlosocarvalho
carlosocarvalho / .bash
Created March 16, 2018 04:29
nginx alias
# Nginx
alias nginx-start="sudo systemctl start nginx"
alias nginx-stop="sudo systemctl stop nginx"
alias nginx-restart="sudo systemctl restart nginx"
alias nginx-status="systemctl status nginx"
alias nginx-reload="sudo kill -HUP `cat /var/run/nginx.pid`"
alias nginx-vim-default="sudo vim /etc/nginx/sites-available/default"
alias nginx-vim-bookmarks.conf='sudo vim /etc/nginx/sites-available/codingmarks.org'
alias nginx-vim-nginx.conf="sudo vim /etc/nginx/nginx.conf"
alias nginx-tail-error.log="sudo tail -f -n200 /var/log/nginx/error.log"