Instantly share code, notes, and snippets.

View robot_brain.c
#include "musical_notes.h"
int PushButton = 2;
int soundSensor = 3;
int RightEye = 4;
int LeftEye = 5;
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

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('')
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.

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?
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)
View main.go
package main
import (
"bufio"
"fmt"
"strings"
"github.com/dgryski/go-simstore/simhash"
)