Skip to content

Instantly share code, notes, and snippets.

Avatar

Daniel Miranda danielkza

View GitHub Profile
@danielkza
danielkza / Dockerfile
Created Jan 5, 2018
Bors-NG Docker setup
View Dockerfile
ARG ELIXIR_VERSION=1.4.5
FROM elixir:${ELIXIR_VERSION} as builder
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8
RUN apt-get update -q && apt-get install -y build-essential libtool autoconf curl
RUN DEBIAN_CODENAME=$(sed -n 's/VERSION=.*(\(.*\)).*/\1/p' /etc/os-release) && \
curl -q https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - && \
@danielkza
danielkza / zfs-root-fs-generator.sh
Last active Aug 20, 2017
ZFS root systemd generator
View zfs-root-fs-generator.sh
#!/bin/sh
generator_dir="$1"
list_datasets() {
/usr/sbin/zfs list -r -H -o name,canmount,mountpoint "$1"
}
get_root_zfs_dataset() {
while read mnt_dev mnt_path mnt_type rest; do
View keybase.md

Keybase proof

I hereby claim:

  • I am danielkza on github.
  • I am danielkza (https://keybase.io/danielkza) on keybase.
  • I have a public key whose fingerprint is B797 986C 9753 D44F 0477 32D0 0790 9306 308D 7399

To claim this, I am signing this object:

@danielkza
danielkza / heartbeat.clj
Created Mar 15, 2017
Riemann heartbeat with continuous alerting (with exponential backoff time)
View heartbeat.clj
(defn- heartbeat-bounce
[alpha min-ttl max-ttl & children]
(fn [event]
(let [ttl (max min-ttl (:ttl event))
ttl (min max-ttl (* alpha ttl))]
(call-rescue (assoc event :ttl ttl :time (unix-time)) children))))
(defn- heartbeat-process
[svc desc index bounce & children]
(fn [event]
View index-utils.clj
(require '[clojure.java.io :as io]
'[clojure.tools.logging :refer [infof]]
'[riemann.common :refer [encode decode-inputstream]]
'[riemann.config :refer [service!]]
'[riemann.service :refer [thread-service]]
'[riemann.time :refer [unix-time]])
(import '[java.io.File FileOutputStream])
(defn index-save
[file index]
@danielkza
danielkza / reddit-update-filters.py
Created Dec 3, 2016
Python3 script to synchronize Reddit /r/all filters from a list file
View reddit-update-filters.py
#!/bin/env python3
# Copyright (c) 2016, Daniel Miranda <danielkza2@gmail.com>
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
@danielkza
danielkza / ipsec
Created Nov 29, 2016
Strongswan IPSec init script with UCI support
View ipsec
#!/bin/sh /etc/rc.common
START=90
STOP=10
NAME=ipsec-uci
USE_PROCD=1
IPSEC_BIN=/usr/sbin/ipsec
IPSEC_SECRETS=/var/run/ipsec/ipsec.secrets
@danielkza
danielkza / lambda.py
Last active Oct 19, 2016
Stacker hook for uploading lambda functions
View lambda.py
import os
import os.path
import fnmatch
import stat
import logging
import hashlib
from StringIO import StringIO
from zipfile import ZipFile, ZIP_DEFLATED
import boto3
View improve_descendant_values.txt
$ PROFILE_NUM_RUNS=3 command time -v ruby performance/tests/aggregation.rb
warning: parser/current is loading parser/ruby22, which recognizes
warning: 2.2.x-compliant syntax, but you are running 2.3.0.
warning: please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
Profiling Performance::Aggregation
Setup: start
Created 1023 ModuleResults and 4096 MetricResults
Setup: finish
Run 1: start
Run 1: finish
View metadata
--- !ruby/object:Gem::Specification
name: kalibro_client
version: !ruby/object:Gem::Version
version: 4.0.0
platform: ruby
authors:
- Daniel Quadros Miranda
- Diego de Araújo Martinez Camarinha
- Heitor Reis Ribeiro
- Rafael Reggiani Manzo
You can’t perform that action at this time.