Skip to content

Instantly share code, notes, and snippets.

View matburt's full-sized avatar
😄

Matthew Jones matburt

😄
View GitHub Profile
@matburt
matburt / locale
Created September 19, 2017 17:20
locale output
~ locale
LANG=en_US.utf8
LC_CTYPE=en_US.utf8
LC_NUMERIC="en_US.utf8"
LC_TIME="en_US.utf8"
LC_COLLATE="en_US.utf8"
LC_MONETARY="en_US.utf8"
LC_MESSAGES="en_US.utf8"
LC_PAPER="en_US.utf8"
LC_NAME="en_US.utf8"
@matburt
matburt / test_inventory_script.py
Created September 15, 2017 18:53
Large AWX Test Inventory Script
#!/usr/bin/env python
import json
import random
import string
ADDRESSES = ["ahost{}".format(e) for e in range(10000)]
GROUPS = ["agroup{}".format(e) for e in range(500)]
def main():
print(json.dumps(inventory(), sort_keys=True, indent=2))
fib_seq=[0,1]
for x in range(40):
fib_seq.append(fib_seq[-1]+fib_seq[-2])
print(fib_seq)
@matburt
matburt / gist.sql
Created September 19, 2016 13:18
Octoverse 2016 - Top 20 Reviewers
SELECT
events.repo.name AS events_repo_name,
COUNT(DISTINCT events.actor.id) AS events_actor_count
FROM (
SELECT
*
FROM TABLE_DATE_RANGE([githubarchive:day.],TIMESTAMP('2015-09-01'),TIMESTAMP('2016-08-31'))) AS events
WHERE
events.type = 'PullRequestReviewCommentEvent'
AND events.org.login IS NOT NULL
@matburt
matburt / gist:1313c7684688f4c7ebe330297809537b
Created September 19, 2016 12:52
Octoverse 2016 - Contributions - No Comments - All Ansible
SELECT
COUNT(DISTINCT events.actor.id) AS events_actor_count
FROM (
SELECT
*
FROM TABLE_DATE_RANGE([githubarchive:day.],TIMESTAMP('2015-09-01'),TIMESTAMP('2016-08-31'))) AS events
WHERE
(events.repo.name = 'ansible/ansible'
or events.repo.name = 'ansible/ansible-modules-extras'
or events.repo.name = 'ansible/ansible-modules-core') AND
@matburt
matburt / gist:ac3b5fbb25f99678cdb5904d3fd09b85
Last active September 19, 2016 12:29
Octoverse 2016 - Contributions without comments
SELECT
events.repo.name AS events_repo_name,
COUNT(DISTINCT events.actor.id) AS events_actor_count
FROM (
SELECT
*
FROM TABLE_DATE_RANGE([githubarchive:day.],TIMESTAMP('2015-09-01'),TIMESTAMP('2016-08-31'))) AS events
WHERE
events.type = 'PushEvent'
OR events.type = 'PullRequestEvent'
@matburt
matburt / gist:ed8317be57379b55192959d6fdeb7711
Created September 19, 2016 12:23
Contributors - All ansible core repos
SELECT
COUNT(DISTINCT events.actor.id) AS events_actor_count
FROM (
SELECT
*
FROM TABLE_DATE_RANGE([githubarchive:day.],TIMESTAMP('2015-09-01'),TIMESTAMP('2016-08-31'))) AS events
WHERE
(events.repo.name = 'ansible/ansible'
or events.repo.name = 'ansible/ansible-modules-extras'
or events.repo.name = 'ansible/ansible-modules-core') AND
@matburt
matburt / gist:7eb5e241c7c072f460b0e7d7c67ccd61
Created September 19, 2016 12:15
Octoverse 2016 - Repositories with most contributors (top 20)
SELECT
events.repo.name AS events_repo_name,
COUNT(DISTINCT events.actor.id) AS events_actor_count
FROM (
SELECT
*
FROM TABLE_DATE_RANGE([githubarchive:day.],TIMESTAMP('2015-09-01'),TIMESTAMP('2016-08-31'))) AS events
WHERE
events.type = 'CommitCommentEvent'
OR events.type = 'PushEvent'
@matburt
matburt / flask_handler.py
Last active October 6, 2023 14:15
Demonstrating a basic flask POST request handler that examines request headers.
#!/usr/bin/env python
from flask import Flask, request, abort, jsonify
app = Flask(__name__)
@app.route('/push', methods=['POST'])
def handle_push():
if not request.json:
abort(400)
if 'AnsibleTower' in request.headers and request.headers['AnsibleTower'] == 'xSecretx':
# Trigger some other external action
@matburt
matburt / index.js
Created May 22, 2016 04:09
Google Cloud Functions test
use 'strict'
exports.hellohttp = function (context, data) {
console.log(data.message);
context.success('My GCF Function: ' + data.message);
};