Skip to content

Instantly share code, notes, and snippets.

@alefhsousa
alefhsousa / .bash_profile
Last active April 2, 2021 21:11
example bash profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/.local/bin:$HOME/bin
@alefhsousa
alefhsousa / script.sh
Last active April 2, 2021 21:29
setup-java
#!/bin/bash
sudo yum install -y java-1.8.0-openjdk-devel.x86_64
sudo wget http://ftp.meisei-u.ac.jp/mirror/apache/dist/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz
sudo tar -xzvf apache-maven-3.6.3-bin.tar.gz
sudo mv apache-maven-3.6.3 /opt/
@alefhsousa
alefhsousa / Vagrantfile
Last active March 9, 2020 20:41
vagrant-ubuntu-sample
Vagrant.configure("2") do |config|
config.vm.box = "bento/ubuntu-18.04"
config.vm.define :db do |db_config|
db_config.vm.network "private_network", ip: "192.168.50.11"
db_config.vm.hostname = 'db'
db_config.vm.provider :virtualbox do |vb|
vb.name = "db"
end
end
@alefhsousa
alefhsousa / ExceptionHandler.java
Created January 24, 2020 19:15
Sample script to show how to use the ExceptionHandler
package com.alefh.gateways.http;
import com.alefh.gateways.http.resources.response.ErrorResponse;
import java.util.Collections;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.config.ResourceNotFoundException;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
@alefhsousa
alefhsousa / eats_pagamento.sql
Created July 27, 2019 19:05
eats_pagamento.sql
-- MySQL dump 10.13 Distrib 5.6.33, for debian-linux-gnu (x86_64)
--
-- Host: localhost Database: eats_pagamento
-- ------------------------------------------------------
-- Server version 5.6.33-0ubuntu0.14.04.1
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
@alefhsousa
alefhsousa / docker.md
Created August 14, 2018 19:39
install docker on ubuntu

Installing with apt-get

#!/bin/sh
# https://docs.docker.com/engine/installation/linux/ubuntu/#install-using-the-repository
sudo apt-get update && sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88 | grep docker@docker.com || exit 1
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
@alefhsousa
alefhsousa / removeAccentuation.js
Created April 16, 2018 00:02
remove accentuation in javascript using ES6
function removeAccentuation(s) {
return s.normalize('NFD').replace(/[\u0300-\u036f]/g, "")
}
@alefhsousa
alefhsousa / server.go
Last active September 13, 2017 03:49
Simple server for share static documents
package main
import (
"flag"
"log"
"net/http"
)
func main() {
port := flag.String("p", "9999", "port to serve on")
@alefhsousa
alefhsousa / freeboar-with-multi-stage
Created September 4, 2017 07:40
dockerfile with docker multi stage build for freeboard
FROM node:alpine as temp
RUN apk update && \
apk upgrade && \
apk add nodejs git
WORKDIR /app
RUN git clone https://github.com/Freeboard/freeboard.git
RUN cd /app/freeboard && npm install -g
@alefhsousa
alefhsousa / dockerfile-without-multi-stage.txt
Last active September 10, 2017 01:25
dockerfile-freeboard-without-multi-stage-build
FROM nginx:1.12-alpine
RUN apk update && \
apk upgrade && \
apk add nodejs git
WORKDIR /app
RUN chmod 777 -R /app
RUN git clone https://github.com/Freeboard/freeboard.git