Skip to content

Instantly share code, notes, and snippets.

View mraaroncruz's full-sized avatar
🏃‍♂️

Aaron Cruz mraaroncruz

🏃‍♂️
View GitHub Profile
@mraaroncruz
mraaroncruz / Caddyfile
Created September 25, 2019 04:09
Caddyfile
foo.example.com
rewrite /grafana {
r (.*)
to /{1}
}
proxy / grafana:3000 {
transparent
}
@mraaroncruz
mraaroncruz / cloudSettings
Last active July 23, 2019 13:13
VSCode settings
{"lastUpload":"2019-07-20T10:34:33.114Z","extensionVersion":"v3.4.0"}
@mraaroncruz
mraaroncruz / NetworkingTalk.md
Created July 17, 2019 16:59
Networking Talk notes

Networking Talk

Intro

The hardest part for me about networking is trying to balance the fact that I want something with being able to give.

I have friends that are great people to have in my network and have referred me lots of work and I sometimes feel a bit scummy having them in my CRM.

This year

@mraaroncruz
mraaroncruz / jwt_params.rb
Created April 28, 2019 22:30
JWT params middleware
module Middlewares
class JwtParams
def initialize(app)
@app = app
end
def call(env)
request = Rack::Request.new(env)
token = request.params['auth']
@mraaroncruz
mraaroncruz / Dockerfile
Last active March 8, 2019 09:47
Very, very simple ruby docker image
FROM ruby:2.6
RUN mkdir /app
WORKDIR /app
ADD Gemfile Gemfile.lock /app/
RUN gem install bundler \
&& bundle install -j 8
ADD . /app
@mraaroncruz
mraaroncruz / docker-compose.yml
Last active March 7, 2019 16:59
Setup docker registry
version: '3'
services:
registry:
image: registry:2
ports:
- "5000:5000"
environment:
REGISTRY_AUTH: htpasswd
REGISTRY_AUTH_HTPASSWD_REALM: Registry
@mraaroncruz
mraaroncruz / setup.bash
Last active April 15, 2019 20:24
Setup a docker letsencrypt nginx port forwarded box
#!/bin/bash
set -e
# Run like
# bash setup.bash example.com janet@example.com 5000
# vhost letsencrypt email application port
HOST=$1
EMAIL=$2
@mraaroncruz
mraaroncruz / Dockerfile
Created March 4, 2019 22:10 — forked from teamon/Dockerfile
elixir + phoenix + node dockerfile
########################################
# 1. Build nodejs frontend
########################################
FROM node:10.9-alpine as build-node
# prepare build dir
RUN mkdir -p /app/assets
WORKDIR /app
# set build ENV
@mraaroncruz
mraaroncruz / deploy.rb
Created February 28, 2019 21:41
mina script for Phoenix deployment
require 'mina/git'
set :domain, 'your_domain'
set :deploy_to, 'your_path_on_server'
set :repository, 'your_git'
set :branch, 'master'
set :app_name, 'your_app_name'
set :shared_paths, ['log']
@mraaroncruz
mraaroncruz / ecto_batch_stream.ex
Created February 21, 2019 14:40
Batch ecto requests as a stream
defmodule PrimedMind.Domain.Utils.EctoBatchStream do
import Ecto.Query, only: [from: 2]
@batch_size 1000
# Example:
#
# query = from u in MyApp.User, select: u.email
# stream = EctoBatchStream.stream(MyApp.Repo, query)
# stream |> Stream.take(3) |> Enum.to_list # => […]