Skip to content

Instantly share code, notes, and snippets.

View diogok's full-sized avatar

Diogo Souza da Silva diogok

View GitHub Profile
@diogok
diogok / Dockerfile
Created January 15, 2020 17:47
CLojure dockerfile
FROM clojure:openjdk-13-tools-deps-slim-buster as builder
WORKDIR /usr/src/app
# install cambada builder, as it will not change
RUN clj -Sdeps '{:deps {luchiniatwork/cambada {:mvn/version "1.0.0"}}}' -e :ok
# install main deps, sometimes change
COPY deps.edn /usr/src/app/deps.edn
RUN clj -e :ok
groups:
- name: prometheus/alert.rules
rules:
- alert: service_down
expr: up == 0
- alert: APIHighInvocationRate
expr: sum(rate(gateway_function_invocation_total{code="200"}[10s])) by (function_name) / sum(gateway_service_count) by (function_name) > 5
for: 5s
labels:
service: gateway
@diogok
diogok / dnsmasq.conf
Last active June 28, 2019 17:02
dnsmas forward to consul cache for 3 hours and log
log-queries
no-negcache
all-servers
cache-size=1000
max-cache-ttl=10801
min-cache-ttl=10800
server=/consul/10.2.2.1#8600
version: "2"
services:
# service discovery
consul:
image: consul:1.5.0
ports:
- 8500:8500
consul-exporter:
image: prom/consul-exporter
@diogok
diogok / prometheus.yml
Created May 28, 2019 23:57
prometheus.yml
# config file version
apiVersion: 1
# list of datasources that should be deleted from the database
deleteDatasources:
- name: Prometheus
orgId: 1
# list of datasources to insert/update depending
# whats available in the database
[rabbitmq_federation_management,rabbitmq_management,rabbitmq_mqtt,rabbitmq_stomp,rabbitmq_peer_discovery_consul].
global:
scrape_interval: 5s
scrape_configs:
- job_name: nomad_metrics
params:
format:
- prometheus
scrape_interval: 5s
scrape_timeout: 5s
metrics_path: /v1/metrics
global:
scrape_interval: 5s
scrape_configs:
- job_name: 'services'
consul_sd_configs:
- server: 'host:8500'
relabel_configs:
- source_labels: [__meta_consul_tags]
regex: .*,prometheus,.*
action: keep
@diogok
diogok / fill.js
Created May 10, 2017 14:22
Zendesk new request filler
location
.search
.match(/([^&=?]+)=([^&]+)/g)
.map(function(kv) {
return kv.split("=")
}).map(function(kv) {
document.getElementById(kv[0]).value = decodeURIComponent(kv[1]).replace("+", " ")
});
// Usage: https://myohmy.zendesk.com/hc/pt-br/requests/[email protected]&request_custom_fields_77509687=Diogo+Silva&request_subject=Help+me
@diogok
diogok / resource.json
Created October 7, 2016 21:45
Idea for IPT api
{
"ipt":{
"name":"",
"link":"http://localhost:8080",
"root":"http://localhost:8080/api/resources"
},
"resource":{
"data":{
"shortname":"tes1",
"eml":{