Skip to content

Instantly share code, notes, and snippets.

Michael Malone mmalone

Block or report user

Report or block mmalone

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
View lambda2img.Dockerfile
ARG FUNCTION_RUNTIME
FROM mikesir87/aws-cli as code
ARG FUNCTION_NAME
ARG AWS_DEFAULT_REGION
ARG AWS_ACCESS_KEY_ID
ARG AWS_SECRET_ACCESS_KEY
RUN wget -O function.zip `aws lambda get-function --function-name $FUNCTION_NAME --query 'Code.Location' --output text`
@mmalone
mmalone / example.sh
Created Feb 12, 2019
Using `step certificate` without the online step CA
View example.sh
# Create a root certificate and signing key.
$ step certificate create "Root CA" root.crt root.key --profile root-ca
Please enter the password to encrypt the private key:
Your certificate has been saved in root.crt.
Your private key has been saved in root.key.
# Create an intermediate certificate & signing key. This isn't
# required; we could use the root to sign directly which is
# probably fine for local dev and removes the need to bundle later.
$ step certificate create "Intermediate CA" int.crt int.key --profile intermediate-ca --ca root.crt --ca-key root.key
@mmalone
mmalone / README.md
Created Nov 5, 2015 — forked from mbostock/.block
Line Chart
View README.md
@mmalone
mmalone / diskstats.py
Created Jul 14, 2011
python diskstats parser
View diskstats.py
def diskstats():
file_path = '/proc/diskstats'
# http://lxr.osuosl.org/source/Documentation/iostats.txt
columns_disk = ['major_dev_num', 'minor_dev_num', 'device', 'reads', 'reads_merged', 'sectors_read', 'ms_reading', 'writes', 'writes_merged', 'sectors_written', 'ms_writing', 'current_ios', 'ms_doing_io', 'weighted_ms_doing_io']
columns_partition = ['major_dev_num', 'minor_dev_num', 'device', 'reads', 'sectors_read', 'writes', 'sectors_written']
result = {}
for line in (l for l in open(file_path, 'r').xreadlines() if l != ''):
parts = line.split()
View gist:735234
>>> x = 'abcdefghijklmnopqrstuvwyz1234567890'
>>> for i in xrange(len(x) + 1):
... y = (x[:i] + 'x' * len(x))[:len(x)]
... print timeit.Timer('x == y', 'from __main__ import x, y').timeit()
...
0.0604889392853
0.0732460021973
0.069344997406
0.0671350955963
0.0664479732513
View gist:734025
# Requires apachelog from http://code.google.com/p/apachelog/source/browse/trunk/apachelog.py
import sys, time, re
from collections import defaultdict
from threading import Timer
import apachelog
class Parser(apachelog.parser):
View stats.py
import math
import random
class Statistic(object):
"""
Hookin' it up with the seven descriptive statistics.
"""
def __init__(self, sample):
View gist:572870
1568020383607837124674242424233936224366074619938054295149435080651133347159866539515828916334423825699216287430613550119009746682495526220087196369932993220993947068398348139078036223234189886410582032934294689156382470618963836853600005504402303219553800308328245464091978334255365120288597797327665191066332303969094527875543599893710346844574971075921041496871881080512503217260769624804065596751534343662438394009356717682549849813579683807411836806956417224771432950855424795916847683629888419235012414123218681592018347300549566480645820788828884670170227348048694510744364877265930061422199605236539854481131874246370399956781377830722015722886884059955236617197194789439998472191229648923258247262131755689255146886795535534537354318015385271178803608088214700126029621133594790006436889852250107606783683417339851548995227133141803484257221095744914814397064115308252464652873341285802340753454548916615332528616057502990290828900499685424871335209817720727253000270548565157264252790009718525020443966599344478805
View InnerClassUglySyntax.java
class Outer {
public Outer() {
}
public class Inner {
public Inner() {
}
public void doit() {
System.out.println("Sup.");
View collision.py
import random
import itertools
def find_collision(rng):
d = {}
for iteration in itertools.count():
nonce = rng()
if nonce in d:
return iteration
You can’t perform that action at this time.