This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import subprocess | |
def shell(*args, **kwargs): | |
"""Execute a shell command and return the output as a string. | |
Any additional kwargs are passed directly to subprocess.run. | |
Examples: | |
shell("date") | |
shell("date", "-u") | |
message = "hello, world" | |
shell("echo", message) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
securityDefinitions: | |
api_key: | |
in: query | |
name: key | |
type: apiKey | |
api_token: | |
in: query | |
name: token | |
type: apiKey |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'digest' | |
module VanitySha | |
extend self | |
COMMITTER_PATTERN = /^committer .* \<.*\> (?<timestamp>\d+)(?<timezone>.*$)/ | |
AUTHOR_PATTERN = /^author .* \<.*\> (?<timestamp>\d+)(?<timezone>.*$)/ | |
TIMESTAMP_DELTA_MAX = 10 * 24 * 60 * 60 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE metrics ( | |
id bytea NOT NULL primary key, | |
description text, | |
name text COLLATE pg_catalog."C" | |
); | |
CREATE TABLE contribution_metrics ( | |
last_update_on timestamp with time zone, | |
metric bytea NOT NULL, | |
projected double precision, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
psql> explain analyze select investments.id | |
from contributions | |
JOIN investments ON contributions.investment_id = investments.id | |
JOIN contribution_investment_metrics cim on cim.investment_id = investments.id | |
WHERE contributions.id = '\x58c9c0d3ee944c48b32f814d'; | |
QUERY PLAN | |
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
Nested Loop (cost=27098.32..27106.89 rows=1 width=13) (actual time=1322.324..1322.329 rows=1 loops=1) | |
Join Filter: (contributions.investment_id = investments.id) | |
-> Merge Join (cost=27098. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import gdb | |
from datetime import datetime | |
import sys | |
if sys.version_info > (3, 0): | |
raw_input = input | |
# | |
# The gdb constant COMPLETE_EXPRESSION was added in gdb 7.7. For earlier | |
# version of gdb, we use COMPLETE_SYMBOL which is close enough. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
// A parent class using CRTP to track all instances of the derived class. | |
// | |
// This supports two python functions for use in gdb: | |
// | |
// - TrackedClassWalk(derived_class_name, filter=lambda _: True): | |
// | |
// A generator that iterates over all instances of the derived class | |
// in existance. This currently relies on embedding additional data in |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
import argparse | |
import blessed | |
from collections import defaultdict | |
import csv | |
import jinja2 | |
import logging | |
import numpy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Date/Time: 2015-11-11 16:48:02 -0800 | |
OS Version: 10.10.5 (Build 14F1021) | |
Architecture: x86_64 | |
Report Version: 21 | |
Event: Sleep Wake Failure | |
Steps: 8 | |
Hardware model: MacBookPro10,1 | |
Active cpus: 8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Generates a "latency heat map", showing both on-CPU and off-CPU stacks. In addition, | |
# attempts to color code on-CPU based on CPI by diffling the on-CPU stacks sampled | |
# at ~1000 Hz and every ~3e6 instructions. Intuitively, if a stack is more common in | |
# frequency stacks than in count stacks, than it represents a "slower" stack. | |
# | |
perf_data_dir=$1 | |
dest_dir=$2 |
NewerOlder