Skip to content

Instantly share code, notes, and snippets.

View vinicius73's full-sized avatar
🤓
"Those who cannot acknowledge themselves, will eventually fail."

Vinicius Reis vinicius73

🤓
"Those who cannot acknowledge themselves, will eventually fail."
View GitHub Profile
FROM golang:1.15.5-alpine3.12 as sidecar
WORKDIR /go/src/app
COPY ./docker/sidecar/ ./
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags '-s -w -extldflags "-static"' -o bin/sidecar . && \
chmod +x ./bin/sidecar
FROM node:12.19.0-alpine3.9 as build-stage
@vinicius73
vinicius73 / messageBroker.js
Last active May 14, 2020 23:45
Vue.js EventBus approach
const listeners = ctx => {
if (!ctx.$options.on) {
return
}
const listeners = {}
Object.entries(ctx.$options.on)
.forEach(([event, callback]) => {
listeners[event] = callback.bind(ctx)
@vinicius73
vinicius73 / Makefile
Last active March 29, 2020 20:16
Terraform + Digital Ocean Spaces
init:
@read -p "SPACES_ACCESS_TOKEN=" SPACES_ACCESS_TOKEN; \
read -p "SPACES_SECRET_KEY=" SPACES_SECRET_KEY; \
read -e -p "SPACE_BUCKET_NAME=" -i "space-name" SPACE_BUCKET_NAME; \
terraform init \
-backend-config="access_key=$$SPACES_ACCESS_TOKEN" \
-backend-config="secret_key=$$SPACES_SECRET_KEY" \
-backend-config="bucket=$$SPACE_BUCKET_NAME"
plan:
package xx
class Deferrer {
private val actions = arrayListOf<() -> Unit>()
fun defer(f: () -> Unit) {
actions.add(f)
}
fun done() {
@vinicius73
vinicius73 / Dockerfile
Last active March 22, 2020 22:51
Docker - Front-end APP
FROM node:12-alpine as build-stage
RUN apk add --no-cache curl gnupg libstdc++
WORKDIR /app
COPY package*.json ./
COPY yarn.lock ./
RUN yarn install
COPY . .
ARG MODE=production
@vinicius73
vinicius73 / .dockerignore
Created March 22, 2020 22:42
Docker + PM2 - Node Backend APP
node_modules/
dist/
.git/
const pino = require('pino')
const dest = pino.destination()
const logger = pino({
name: process.env.APPLICATION_NAME || 'my-app',
level: process.env.LOG_LEVEL || 'info',
useLevelLabels: true,
base: {
}
}, dest)
const fs = require('fs')
const path = require('path')
const slug = require('slug')
const axios = require('axios')
const progress = require('progress')
const urlRegx = /(https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|www\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9]+\.[^\s]{2,}|www\.[a-zA-Z0-9]+\.[^\s]{2,})/gi;
const readList = async () => {
console.info('Loading file data')
@vinicius73
vinicius73 / index.js
Created December 1, 2019 16:54
Script de sorteio inimigo/amigo oculto
const { shuffle, map } = require('lodash')
const { sendMessages } = require('./send-email')
const input = shuffle(require('./input.json'))
function assign (array) {
return map(array, (person, index, array) => {
const friend = array[index + 1] || array[0]
return {
person,
@vinicius73
vinicius73 / Dockerfile
Created October 25, 2019 13:20
jupyter - docker compose
FROM continuumio/anaconda3
RUN /opt/conda/bin/conda install jupyter
RUN mkdir -p /opt/notebooks/notebook
EXPOSE 8888
CMD /opt/conda/bin/jupyter notebook --notebook-dir=/opt/notebooks --ip='*' --port=8888 --no-browser --allow-root