Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View miguelcnf's full-sized avatar

Miguel Fonseca miguelcnf

View GitHub Profile
# -*- mode: ruby -*-
# vi: set ft=ruby :
boxes = {
:tomcat => {
:ipaddress => "172.31.254.110",
:role => "application"
},
:mysql => {
:ipaddress => "172.31.254.120",
$ cat /.ssh/config
Host *
ServerAliveInterval 60
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
Host nat*.eu1.dev.foo.bar.com
ProxyCommand none
IdentityFile /Users/foo/.ssh/id_dsa_bar
User ec2-user

Keybase proof

I hereby claim:

  • I am miguelcnf on github.
  • I am miguelcnf (https://keybase.io/miguelcnf) on keybase.
  • I have a public key whose fingerprint is DE51 BEDD F9AA 2BB8 325C B6D0 ED05 4013 98CE 07D3

To claim this, I am signing this object:

#!/usr/bin/env bash
######
# CPU
######
if [ $# -lt 2 ]
then
echo "Missing arguments"
echo "Usage:"
require 'chef/provisioning'
with_driver 'aws'
with_machine_options :bootstrap_options => {
:security_group_ids => ["#{ENV['AWS_SECURITY_GROUP']}"],
:key_name => "#{ENV['AWS_KEY_NAME']}",
:image_id => "#{ENV['AWS_IMAGE_ID']}"
},
:ssh_username => "#{ENV['AWS_SSH_USERNAME']}"
@miguelcnf
miguelcnf / ping_packet_loss
Created May 18, 2015 17:53
Measure packet loss between hosts and push it as a gauge to statsd every 5 seconds.
#!/usr/bin/env bash
DST_IP=XXX.XXX.XXX.XXX
SRC_IP=$(/sbin/ip -f inet addr | grep inet | grep -v 127.0.0.1 | awk -F ' ' '{print $2}' | awk -F '/' '{print $1}')
PACKET_LOSS=$(/bin/ping -w 4 -q $DST_IP | tail -2 | awk -F ' ' '{print $6}' | awk -F '%' '{print $1}' | grep -v '^$')
SANITIZED_DST_IP="${DST_IP//./_}"
SANITIZED_SRC_IP="${SRC_IP//./_}"
METRIC_PREFIX=""
@miguelcnf
miguelcnf / plusLargeData.js
Created June 30, 2015 15:52
node util.format performance test
#!/usr/bin/env node
var fs = require('fs');
fs.readFile('urandomStrings', 'utf8', function (err,data) {
if (err) {
return console.log(err);
} else {
console.time('concat');
var string = '';
@miguelcnf
miguelcnf / influxdb.conf
Created July 1, 2015 19:16
influxdb_0_9_cluster_config
reporting-disabled = true
[admin]
bind-address = ":8083"
enabled = true
[cluster]
shard-writer-timeout = "5s"
[continuous_queries]
@miguelcnf
miguelcnf / heap-usage-with-util-console
Last active August 29, 2015 14:24
node winston heap usage under load measured with memwatch
{ nodes: 42444,
time: Mon Jul 06 2015 16:36:48 GMT+0100 (WEST),
size_bytes: 7244456,
size: '6.91 mb' }
{ nodes: 45852,
time: Mon Jul 06 2015 16:36:48 GMT+0100 (WEST),
size_bytes: 7755120,
size: '7.4 mb' }
{ num_full_gc: 145,
num_inc_gc: 105,
<HEADER>
<TITLE>The World Wide Web project</TITLE>
<NEXTID N="55">
</HEADER>
<BODY>
<H1>World Wide Web</H1>The WorldWideWeb (W3) is a wide-area<A
NAME=0 HREF="WhatIs.html">
hypermedia</A> information retrieval
initiative aiming to give universal
access to a large universe of documents.<P>