Skip to content

Instantly share code, notes, and snippets.

@alefhsousa
alefhsousa / installing-oh-my-zsh-fedora.md
Created March 14, 2016 02:19 — forked from jshcrowthe/installing-oh-my-zsh-fedora.md
Installing Oh My ZSH oh Fedora (2015 CIT 325 Image)

Installing oh-my-zsh on Fedora (for DB class images)

Oh-my-zsh is an extension of the traditional z shell that is extensible via community created plugins (Plugins found here: oh-my-zsh github repo). It is, in my opinion, a breath of fresh air in comparison to the traditional bash shell.

DO THE FOLLOWING IN ORDER

Installing ZSH (using yum)

The first step for this install is getting zsh we will do this via yum. From your terminal:

@alefhsousa
alefhsousa / persistence.xml
Last active July 8, 2021 22:35
Sample persistence.xml for Hibernate 5.0.1with postgresql 9
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">
<persistence-unit name="jpa">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
@alefhsousa
alefhsousa / cors.java
Created May 10, 2017 16:47
CorsAdapterSpring.java
@Configuration
public class CorsAdapter extends WebMvcConfigurerAdapter {
@Override
public void addCorsMappings(final CorsRegistry registry) {
registry.addMapping("/**");
}
}
@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
@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 / 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 / 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 / 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 / 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 / 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;