Skip to content

Instantly share code, notes, and snippets.

Gleicon Moraes gleicon

Block or report user

Report or block gleicon

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
@gleicon
gleicon / cross_check_aws_ri_and_instances.py
Created Apr 5, 2019
cross check reservation IDs against running instances on aws
View cross_check_aws_ri_and_instances.py
import boto3
import pprint
from collections import defaultdict
ec2 = boto3.client('ec2')
resp = ec2.describe_instances()
running_instances = defaultdict (lambda:0)
running_instances_apps = defaultdict(set)
@gleicon
gleicon / musical_notes.h
Last active Feb 8, 2019
arduino robot brain for gabi
View musical_notes.h
// Reference: This list was adapted from the table located here:
// http://www.phy.mtu.edu/~suits/notefreqs.html
const float note_C0 = 16.35; //C0
const float note_Db0 = 17.32; //C#0/Db0
const float note_D0 = 18.35; //D0
const float note_Eb0 = 19.45; //D#0/Eb0
const float note_E0 = 20.6; //E0
const float note_F0 = 21.83; //F0
const float note_Gb0 = 23.12; //F#0/Gb0
const float note_G0 = 24.5; //G0
View quick-tips-optimizing-jvm.md

EDIT: go to https://golang.org/, skip the rest of this doc.

Quick Tips for Fast Code on the JVM

I was talking to a coworker recently about general techniques that almost always form the core of any effort to write very fast, down-to-the-metal hot path code on the JVM, and they pointed out that there really isn't a particularly good place to go for this information. It occurred to me that, really, I had more or less picked up all of it by word of mouth and experience, and there just aren't any good reference sources on the topic. So… here's my word of mouth.

This is by no means a comprehensive gist. It's also important to understand that the techniques that I outline in here are not 100% absolute either. Performance on the JVM is an incredibly complicated subject, and while there are rules that almost always hold true, the "almost" remains very salient. Also, for many or even most applications, there will be other techniques that I'm not mentioning which will have a greater impact. JMH, Java Fligh

@gleicon
gleicon / list_objects_google_storage_boto3.py
Last active May 22, 2019
How to use boto3 with google cloud storage and python to emulate s3 access.
View list_objects_google_storage_boto3.py
from boto3.session import Session
from botocore.client import Config
from botocore.handlers import set_list_objects_encoding_type_url
import boto3
ACCESS_KEY = "xx"
SECRET_KEY = "yy"
boto3.set_stream_logger('')
@gleicon
gleicon / README.md
Created Aug 9, 2017 — forked from lucindo/README.md
Using Graphite/Grafana to gather Locust.io test data
View README.md

Using Locust.io with Grafana

On your locust master server:

  • Install and configure Graphite. Follow a good tutorial
  • Install and configure Grafana: tutorial

Use logra.py on your locust test file. See locustfile.py.

@gleicon
gleicon / service-checklist.md
Created Jan 15, 2017 — forked from acolyer/service-checklist.md
Internet Scale Services Checklist
View service-checklist.md

Internet Scale Services Checklist

A checklist for designing and developing internet scale services, inspired by James Hamilton's 2007 paper "On Desgining and Deploying Internet-Scale Services."

Basic tenets

  • Does the design expect failures to happen regularly and handle them gracefully?
  • Have we kept things as simple as possible?
@gleicon
gleicon / snapshots.py
Created Dec 29, 2016 — forked from Eyjafjallajokull/snapshots.py
AWS EBS - Find unused snapshots - this script generates csv raport about snapshot usage
View snapshots.py
import re
import boto3
import csv
from botocore.exceptions import ClientError
ec2 = boto3.client('ec2')
def get_snapshots():
return ec2.describe_snapshots(OwnerIds=['self'])['Snapshots']
View keybase.md

Keybase proof

I hereby claim:

  • I am gleicon on github.
  • I am gleicon (https://keybase.io/gleicon) on keybase.
  • I have a public key whose fingerprint is C6CC 3FB6 16AE 0EFA 74E1 D749 E45A 2482 12B7 5B5B

To claim this, I am signing this object:

View stats.py
# Helper class for statistics
# see: http://www.johndcook.com/blog/standard_deviation/
class Stats:
""" Uses Welford's method to calculate stats.
Assumes positive values.
It's not thread safe
stats = Stats("ConnectionTimeStats")
stats.add(0.223)
stats.add(1.343)
You can’t perform that action at this time.