Skip to content

Instantly share code, notes, and snippets.


Gleicon Moraes gleicon

View GitHub Profile
gleicon / detect.swift
Created Feb 7, 2021
Swift test to detect light/dark mode
View detect.swift
// swiftc detect.swift -o detect
import Cocoa
func detectDarkTheme() {
let isDark = UserDefaults.standard.string(forKey: "AppleInterfaceStyle") == "Dark"
if isDark {
print("Mode is Dark")
} else {
gleicon /
Created Apr 5, 2019
cross check reservation IDs against running instances on aws
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 / 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:
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

EDIT: go to, 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 /
Last active Mar 26, 2021
How to use boto3 with google cloud storage and python to emulate s3 access.
from boto3.session import Session
from botocore.client import Config
from botocore.handlers import set_list_objects_encoding_type_url
import boto3
gleicon /
Created Aug 9, 2017 — forked from lucindo/
Using Graphite/Grafana to gather test data

Using with Grafana

On your locust master server:

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

Use on your locust test file. See

gleicon /
Created Jan 15, 2017 — forked from acolyer/
Internet Scale Services Checklist

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 /
Created Dec 29, 2016 — forked from Eyjafjallajokull/
AWS EBS - Find unused snapshots - this script generates csv raport about snapshot usage
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']

Keybase proof

I hereby claim:

  • I am gleicon on github.
  • I am 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: