Skip to content

Instantly share code, notes, and snippets.

Miguel Fonseca miguelcnf

Block or report user

Report or block miguelcnf

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@miguelcnf
miguelcnf / rollback.go
Last active Aug 5, 2019
Idiomatic, simple, defer-based rollback mechanism https://play.golang.org/p/p28rpnpiUcL
View rollback.go
package main
import (
"errors"
"log"
)
// rollback function
func rollback(rollbackCtrl *bool, rollbackFunc func()) {
if *rollbackCtrl {
View www-project-first-site.html
<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>
@miguelcnf
miguelcnf / heap-usage-with-util-console
Last active Aug 29, 2015
node winston heap usage under load measured with memwatch
View heap-usage-with-util-console
{ 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,
@miguelcnf
miguelcnf / influxdb.conf
Created Jul 1, 2015
influxdb_0_9_cluster_config
View influxdb.conf
reporting-disabled = true
[admin]
bind-address = ":8083"
enabled = true
[cluster]
shard-writer-timeout = "5s"
[continuous_queries]
@miguelcnf
miguelcnf / plusLargeData.js
Created Jun 30, 2015
node util.format performance test
View plusLargeData.js
#!/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 / ping_packet_loss
Created May 18, 2015
Measure packet loss between hosts and push it as a gauge to statsd every 5 seconds.
View ping_packet_loss
#!/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=""
View chef-provisioning-machine-aws-driver
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']}"
View rrdtool-collectd-graphs
#!/usr/bin/env bash
######
# CPU
######
if [ $# -lt 2 ]
then
echo "Missing arguments"
echo "Usage:"
View keybase.md

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:

View ssh-config-for-aws-vpc-bastion
$ 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
You can’t perform that action at this time.