Skip to content

Instantly share code, notes, and snippets.

View pharaujo's full-sized avatar

Pedro Araújo pharaujo

View GitHub Profile
@pharaujo
pharaujo / 1.log
Last active June 11, 2019 14:16
azure-mgmt-resourcegraph/msrest 429 test case
...
DEBUG:msrest.http_logger:Request URL: 'https://management.azure.com/providers/Microsoft.ResourceGraph/resources?api-version=2019-04-01'
DEBUG:msrest.http_logger:Request method: 'POST'
DEBUG:msrest.http_logger:Request headers:
DEBUG:msrest.http_logger: 'accept-language': 'en-US'
DEBUG:msrest.http_logger: 'Content-Type': 'application/json; charset=utf-8'
DEBUG:msrest.http_logger: 'x-ms-client-request-id': '<REDACTED>'
DEBUG:msrest.http_logger: 'Accept': 'application/json'
DEBUG:msrest.http_logger: 'Content-Length': '451'
DEBUG:msrest.http_logger: 'User-Agent': 'python/2.7.16 (Darwin-18.6.0-x86_64-i386-64bit) msrest/0.6.6 msrest_azure/0.6.0 azure-mgmt-resourcegraph/1.0.0 Azure-SDK-For-Python'
@pharaujo
pharaujo / sitefeed_client.sh
Last active January 8, 2018 15:00
Pure bash OpenTSP site feed client (for debugging)
#!/usr/bin/env bash
#
# Accepts OpenTSDB line protocol connections
# Responds to `version` requests
# Outputs everything else to stdout
tsdb_connector() { nc -l -k 0 4545 ; }
coproc TSDB { tsdb_connector; }
while IFS='' read -ru ${TSDB[0]} line; do
@pharaujo
pharaujo / prometheus-configmap.yaml
Last active September 21, 2016 14:18
Prometheus configmap for coreos-kubernetes (https://github.com/coreos/coreos-kubernetes.git) on vagrant multi-node mode
apiVersion: v1
kind: ConfigMap
metadata:
name: prometheus
data:
alerts.rules: |-
# Alert for any instance that is unreachable for >5 minutes.
ALERT InstanceDown
IF up == 0
FOR 5m
@pharaujo
pharaujo / gist:b94ecde0d1831335b7be
Last active August 29, 2015 14:25
riemann: simple config with test
; -*- mode: clojure; -*-
; vim: filetype=clojure
(logging/init {:file "riemann.log" :console false})
; Listen on the local interface over TCP (5555) and UDP (5555)
; needs `io` to prevent side-effects in testing
(io
(let [host "127.0.0.1"]
(tcp-server {:host host})
@pharaujo
pharaujo / nomes_menina_compostos_2014
Created January 6, 2015 23:11
Nomes registados em Portugal em 2014
1º Maria Inês 603
2º Maria Leonor 496
3º Maria Francisca 315
4º Maria Clara 257
5º Maria Carolina 164
6º Ana Carolina 161
7º Maria João 140
8º Maria Beatriz 140
9º Lara Sofia 130
10º Maria Luísa 125
@pharaujo
pharaujo / gist:c6e87bd098266fbac14a
Created June 13, 2014 15:17
Get node IP addresses in Chef
# chef > addresses = node[:network][:interfaces].collect {|iface,props| props[:addresses].find_all {|x, opts| opts[:family] == 'inet'}}.find_all {|a| !a.empty?}.collect {|a| a.first.first}
# => ["127.0.0.1", "10.62.200.40", "172.31.254.1"]
addresses = node[:network][:interfaces].collect {|iface,props| props[:addresses].find_all {|x, opts| opts[:family] == 'inet'}}.find_all {|a| !a.empty?}.collect {|a| a.first.first}

Keybase proof

I hereby claim:

  • I am pharaujo on github.
  • I am phcrva (https://keybase.io/phcrva) on keybase.
  • I have a public key whose fingerprint is D370 E7D4 882B 3108 7F4A F0E9 1636 08DD F5D7 FBF8

To claim this, I am signing this object:

@pharaujo
pharaujo / multiprocess_util.py
Created May 29, 2012 15:53
Python decorator to detach decorated function by daemonizing it
def detached(f):
"""Generator for creating a forked process
from a function"""
def wrapper(*args, **kwargs):
"""Wrapper function to be returned from generator.
Executes the function bound to the generator and then
exits the process"""
import os
@pharaujo
pharaujo / compile_vim73.sh
Created April 27, 2012 17:13
Script to compile Vim73 on CentOS 5
#!/usr/bin/env bash
set -e
export CONF_OPT_PYTHON='--enable-pythoninterp'
export CONF_OPT_MULTIBYTE='--enable-multibyte'
export CONF_OPT_FEAT='--with-features=huge'
export CONF_OPT_NOSELINUX='--disable-selinux'
export CONF_OPT_COMPBY='--with-compiledby="yourname@example.com"'
make distclean