Skip to content

Instantly share code, notes, and snippets.

View marweck's full-sized avatar
🎯
Focusing

Marcio Carvalho marweck

🎯
Focusing
  • Amazon Web Services
  • Burnaby, British Columbia
View GitHub Profile
@marweck
marweck / Dockerfile
Last active October 16, 2018 22:36
Docker image for building and running Node app on server
# --- base ---
FROM node:8-alpine AS base
RUN mkdir -p /var/www && mkdir -p /var/log/app
ADD package.json /var/www
COPY . /tmp/
RUN cd /tmp && \
apk add --no-cache make gcc g++ python && \
npm install -g typescript && \
npm install --production --silent && \
npm run build && \
@marweck
marweck / bash_profile
Last active January 28, 2020 17:44
My .bash_profile or .bashrc
# bash_profile
#############################################
BLACK="\[\033[0;38m\]"
RED="\[\033[0;31m\]"
RED_BOLD="\[\033[01;31m\]"
BLUE="\[\033[01;34m\]"
GREEN="\[\033[0;32m\]"
export PS1="$BLACK[ \u@$RED\h $GREEN\w$RED_BOLD\$(__git_ps1)$BLACK ] "
export CLICOLOR=1
@marweck
marweck / webpack.config.js
Created October 9, 2018 17:41
Webpack Configuration for Node backend app
const path = require('path');
const { ProgressPlugin } = require('webpack');
/**
* Webpack config
*/
module.exports = {
entry: './src/main.ts',
mode: 'production',
target: 'node',
@marweck
marweck / vscode.settings.json
Last active September 4, 2019 13:59
VSCode settings
{
"editor.fontSize": 16,
"editor.tabSize": 2,
"editor.glyphMargin": true,
"terminal.integrated.fontSize": 16,
"terminal.integrated.shell.osx": "/opt/local/bin/bash",
"files.trimTrailingWhitespace": true,
"files.autoSave": "afterDelay",
"javascript.suggest.completeFunctionCalls": true,
"typescript.suggest.completeFunctionCalls": true,
@marweck
marweck / maven-exec-pom.xml
Last active October 16, 2018 12:38
Maven Exec Plugin configuration. Should run with `mvn exec:exec`
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<configuration>
<executable>java</executable>
<arguments>
<argument>-Xms600m</argument>
<argument>-Xmx600m</argument>
<argument>-XX:MaxPermSize=512m</argument>
@marweck
marweck / Dockerfile
Last active October 16, 2018 22:24
Java Dockerfile configuration for build and run
# --- builder ---
FROM openjdk:8-jdk-alpine AS builder
COPY . /usr/src/app/
WORKDIR /usr/src/app/
RUN apk --no-cache add maven && mvn package -Dmaven.test.skip=true
# --- release ---
FROM openjdk:8-jre-alpine AS release
@marweck
marweck / WebsocketConfiguration.java
Last active April 12, 2022 19:08
SockJS service example for Angular 6+ applications
package infrastructure;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.messaging.simp.config.MessageBrokerRegistry;
import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker;
import org.springframework.web.socket.config.annotation.StompEndpointRegistry;
import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer;
/**
* Websocket configuration
@marweck
marweck / maven-npm-install-pom.xml
Last active October 21, 2018 22:33
Maven exec plugin to invoke npm install and build. Integrating Spring Boot and Angular builds.
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<executable>true</executable>
</configuration>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
@marweck
marweck / docker-oracle.sh
Created October 28, 2018 22:58
Oracle docker container creation
#!/usr/bin/env bash
docker run -d --name oracle -p 1521:1521 -p 49162:8080 \
-v ~/.data/oracle:/u01/app/oracle sath89/oracle-xe-11g
# INFO:
# https://github.com/MaksymBilenko/docker-oracle-xe-11g
#
# user/pass: system/oracle sys/oracle
#
@marweck
marweck / SubnetFilter.java
Last active January 30, 2019 03:02
Servlet Filter that allows requests coming from the same subnet of the server
package com.acme.web;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;