Skip to content

Instantly share code, notes, and snippets.

View tuliomonteazul's full-sized avatar

Tulio Monte Azul tuliomonteazul

View GitHub Profile
@tuliomonteazul
tuliomonteazul / traefik-kubernetes-config.md
Last active March 25, 2021 07:01
Traefik configuration for Kubernetes using Helm

deployment.yaml

{{- range .Values.envs }}
{{ $version := index $.Values.traefikAPI .name "version" }}
{{ $replicas := index $.Values.traefikAPI .name "replicas" }}
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: traefik-api-ingress-controller

Regex Cheatsheet

Quick reference about regex to look up

Feature: Negative lookahead ?!

Specifies a group that can not match after the main expression (if it matches, the result is discarded). Doesn't work in Javascript, but works on Sublime Text.

Situation: We have a list with the text "user" : "" where the id vary betwen 123, 234, 345. You want to find if there is any other values for `` that are not included in the list (123, 234, 345).

What is this?

A quick reference for the Linux screen command.

Start a new screen session

screen -S <name>
@tuliomonteazul
tuliomonteazul / azk-front-end-nginx.md
Last active September 20, 2016 12:23
How to use Azk, Docker and Nginx for Front-end Development

Using AZK to develop your front-end code and serve with Nginx as a CDN

Motivation

Setting up an envinroment to start coding is hard. Specially if you are in a team and have to share your environment setup. Here is where [Azk] comes in. It's an orchestrator to setup your development environment. It uses the Azkfile.js to read your project's requirements and install everything using [Docker] containers. If you're familiar with [Vagrant], let's say that Azk solves the same problem but with a different approach. Instead of a monolithic, it's based on separation of concerns. We have modular containers that are lighter and allow more possibilites such as sharing setup to deploy to other environments.

When we develop front-end code nowadays, we often need a set of tools for automation. Specially for Single Page Apps. So, we often need to install [Grunt], [Gulp] or [Webpack] to run CSS processors like [Sass] or [Less] and JavaScript compilers like [Babel] for ES6/7 or [JSX] for React.

Thereafter, we need a s

@tuliomonteazul
tuliomonteazul / react-question.md
Last active September 9, 2015 20:09
React Hangout Question

Digamos que temos uma estrutura assim:

<NewItem/>
<List>
  <Item/>
  <Item/>
</List>
@tuliomonteazul
tuliomonteazul / agendor-api-examples.md
Last active May 8, 2019 15:07
Agendor API Examples

Primeiro, você vai precisar de duas coisas para realizar sua integração via API:

  • Da ajuda de um programador
  • Do seu token de autenticação (que pode ser encontrado em Menu > Integrações)

Recomendamos que faça o download do Postman e depois importe a nossa biblioteca de exemplos de uso da API V3. Essa é a forma mais fácil e completa de entender e testar a nossa API.

Abaixo também estão alguns exemplos dos casos mais comuns de uso da API:

@tuliomonteazul
tuliomonteazul / getIdFromLocation
Created October 9, 2014 16:39
Function to read a location header and get just what is after the last slash
var locationHeader = "http://www.example.com/resource/child/id123"
console.log(getIdFromLocation(locationHeader)); // should print id123
function getIdFromLocation(location) {
var extracted = /\/(\w+)$/.exec(location)
return extracted? extracted[1] : null;
}
#!/bin/bash
# Script for placing sudoers.d files with syntax-checking
# Making a temporary file to contain the sudoers-changes to be pre-checked
TMP=$(mktemp -t vagrant_sudoers)
cat /etc/sudoers > $TMP
cat >> $TMP <<EOF
# Allow passwordless startup of Vagrant when using NFS.
Cmnd_Alias VAGRANT_EXPORTS_ADD = /usr/bin/su root -c echo '*' >> /etc/exports
git config --global color.ui auto
curl https://raw.github.com/git/git/master/contrib/completion/git-completion.bash -o ~/.git-completion.bash
echo "source ~/.git-completion.bash" >> ~/.bash_profile