Skip to content

Instantly share code, notes, and snippets.

View eliasjpr's full-sized avatar

Elias Perez eliasjpr

View GitHub Profile
@eliasjpr
eliasjpr / configmap.yml
Created April 6, 2020 17:06
Kubernetes ConfigMap for the NGINX IC
kind: ConfigMap
apiVersion: v1
metadata:
name: nginx-config
namespace: nginx-ingress
data:
worker-processes: "24"
worker-connections: "100000"
worker-rlimit-nofile: "102400"
worker-cpu-affinity: "auto 111111111111111111111111"
@eliasjpr
eliasjpr / load.lua
Last active July 1, 2019 14:32
Worker Load Test Script from CSV
local counter = 1
local urls = {}
local headers = {}
headers["client-id"] = "testKey"
headers["client-secret"] = "]@n8YS4Gy8K(4"
init = function()
local next = next
if next(myTable) == nil then
local loop = 0
@eliasjpr
eliasjpr / setup
Created October 9, 2018 11:12
Dev machine setup Script
#!/bin/sh
# Welcome to the thoughtbot laptop script!
# Be prepared to turn your laptop (or desktop, no haters here)
# into an awesome development machine.
fancy_echo() {
local fmt="$1"; shift
# shellcheck disable=SC2059
@eliasjpr
eliasjpr / zshrc
Created July 17, 2018 11:11
ZSH Config File
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="/home/eliasjp/.oh-my-zsh"
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="robbyrussell"
@eliasjpr
eliasjpr / blog_controller_spec.cr
Created April 9, 2018 14:18
Amber Framework - Testing controllers example
require "./spec_helper"
def blog_hash
{"title" => "Fake", "article" => "Fake"}
end
def blog_params
params = [] of String
params << "title=#{blog_hash["title"]}"
params << "article=#{blog_hash["article"]}"
@eliasjpr
eliasjpr / api.cr
Last active February 23, 2018 19:06
Versioning APIs
Amber::Server.configure do |app|
pipeline :api do
# Plug is the method to use connect a pipe (middleware)
# A plug accepts an instance of HTTP::Handler
# plug Amber::Pipe::Params.new
plug Amber::Pipe::Logger.new
end
# All static content will run these transformations
pipeline :static do
@eliasjpr
eliasjpr / params.cr
Created January 30, 2018 01:07
Adds RequiredRule
module Amber::Validators
# Holds a validation error message
record Error, param : String, value : String?, message : String
# This struct holds the validation rules to be performed
class BaseRule
getter predicate : (String -> Bool)
getter field : String
getter value : String?
@eliasjpr
eliasjpr / nanobox.yml
Created December 7, 2017 22:25
Nanobox Amber Template
run.config:
engine: crystal
extra_packages:
- nodejs
- openssl
extra_steps:
- npm install
- crystal deps build amber
@eliasjpr
eliasjpr / nanobox.yml
Created December 7, 2017 22:25
Nanobox Amber Template
run.config:
engine: crystal
extra_packages:
- nodejs
- openssl
extra_steps:
- npm install
- crystal deps build amber