Skip to content

Instantly share code, notes, and snippets.

# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant::Config.run do |config|
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "trusty"
# config.vm.box_url = "http://domain.com/path/to/above.box"
# config.vm.box_url = "https://oss-binaries.phusionpassenger.com/vagrant/boxes/latest/ubuntu-14.04-amd64-vbox.box"
# config.vm.box_url = "https://dl.dropboxusercontent.com/u/197673519/debian-7.2.0.box"
config.vm.box_url = "file://ubuntu-14.04-amd64-vbox.box"
@TimSimmons
TimSimmons / gist:aeb79d93eb888c952b94
Created July 31, 2014 14:34
designate/api/v2/__init__.py
# Copyright 2013 Hewlett-Packard Development Company, L.P.
#
# Author: Kiall Mac Innes <kiall@hp.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
import re
import time
import redis
red = redis.StrictRedis(host='162.242.231.206', port=6379, db=0)
regex = r'(.*) xfer-in(.*) transfer of \'(.*)/IN\'(.*)from (.*)#53: Transfer completed(.*)'
regex_2 = r'(.*) general: info: zone (.*)/IN: transferred serial (.*)'
def read(thefile):
while True:
@TimSimmons
TimSimmons / etcmysqlmydotconf
Created October 17, 2014 20:10
MySQL Config
#
# Generated by Chef for galera-1
#
# Local modifications will be overwritten.
#
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
@TimSimmons
TimSimmons / queriestobeoptd
Created October 22, 2014 21:24
Queries to be optimized
These queries need to be analyzed to see what generates them, and see if they can be optimized.
# Query 2: 2.06 QPS, 0.16x concurrency, ID 0xA8C3198C3A54D679 at byte 12403643
# This item is included in the report because it matches --limit.
# Scores: Apdex = 1.00 [1.0], V/M = 0.00
# Query_time sparkline: | ^_ |
# Time range: 2014-10-22 16:20:16 to 16:22:28
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 0 272
@TimSimmons
TimSimmons / analysis.sql
Last active August 29, 2015 14:08
Query Analysis results
# 336.7s user time, 960ms system time, 21.99M rss, 65.09M vsz
# Current date: Wed Oct 22 16:35:03 2014
# Hostname: galera-2
# Files: slow.log
# Overall: 1.86M total, 175 unique, 1.97k QPS, 0.07x concurrency _________
# Time range: 2014-10-22 16:19:15 to 16:35:02
# Attribute total min max avg 95% stddev median
# ============ ======= ======= ======= ======= ======= ======= =======
# Exec time 67s 1us 110ms 36us 20us 990us 15us
# Lock time 2s 0 4ms 0 0 6us 0
SELECT domains.id, domains.version, domains.created_at, domains.updated_at, domains.deleted, domains.deleted_at, domains.tenant_id, domains.name, domains.email, domains.description, domains.ttl, domains.serial, domains.refresh, domains.retry, domains.expire, domains.minimum, domains.status, domains.parent_domain_id
FROM domains
WHERE domains.id = 'ff5dcaafe2684da69c571617f0a68790' AND domains.tenant_id = 'noauth-project' AND domains.deleted = '0'
LIMIT 2;
SELECT recordsets.id, recordsets.version, recordsets.created_at, recordsets.updated_at, recordsets.tenant_id, recordsets.domain_id, recordsets.name, recordsets.type, recordsets.ttl, recordsets.description
FROM recordsets
WHERE recordsets.id = 'b743734519d942058ffd0d3b3875810d' AND recordsets.tenant_id = 'noauth-project'
LIMIT 2;
@TimSimmons
TimSimmons / queries.sql
Last active August 29, 2015 14:08
Full Query Analysis by API Call
-- GET
-- /v2/zones
-- /v2/zones?marker=xxx&limit=10
-- v2/zones?name=poo.com
-- v2/zones?name=poo.com*
-- v2/zones?name=*poo.com
-- v2/zones?name=*poo.com*
-- v2/zones?name=*poo*.com*
-- /v2/zones/id/
-- /v2/zones/id/recordsets
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<meta http-equiv="refresh" content="1" />
<title>JS Bin</title>
</head>
<body>
<img src="http://blog.4pm.ie/wp-content/uploads/2013/01/Mona-Lisa1.jpg" width="900px" height="300px" />
@TimSimmons
TimSimmons / log.sql
Created March 25, 2015 15:20
axfr log
# Time: 150325 15:18:19
SELECT domains.id, domains.version, domains.created_at, domains.updated_at, domains.deleted, domains.deleted_at, domains.tenant_id, domains.name, domains.email, domains.description, domains.type, domains.transferred_at, domains.ttl, domains.serial, domains.refresh, domains.retry, domains.expire, domains.minimum, domains.status, domains.parent_domain_id, domains.action, domains.pool_id, domains.reverse_name
FROM domains
WHERE domains.name = 'cloddnstest.com.' AND domains.pool_id = '794ccc2cd75144feb57f8894c9f5c842' AND domains.deleted = '0'
LIMIT 2;
SELECT recordsets.id, recordsets.version, recordsets.created_at, recordsets.updated_at, recordsets.tenant_id, recordsets.domain_id, recordsets.name, recordsets.type, recordsets.ttl, recordsets.description, recordsets.reverse_name
FROM recordsets
WHERE recordsets.type = 'SOA' AND recordsets.domain_id = 'b3854322bf9b4596ac7b819646a4fcb8' ORDER BY recordsets.created_at ASC, recordsets.id ASC, recordsets.created_at ASC;
SELECT count(recor