Skip to content

Instantly share code, notes, and snippets.

View jbuck's full-sized avatar

Jon Buckley jbuck

  • Mozilla
  • Toronto, ON
View GitHub Profile
@jbuck
jbuck / releases.js
Created May 15, 2020 17:04
Heroku apps + latest release in a spreadsheet
const Heroku = require('heroku-client')
const heroku = new Heroku({ token: process.env.HEROKU_API_TOKEN })
const main = async () => {
const apps = (await heroku.get(`/apps`)).map(m => { return { created_at: m.created_at, name: m.name, stack: m.stack.name } })
console.log(['App Name', 'Created At', 'Stack', 'Version', 'Description', 'Released At', 'User'].join('\t'))
for (app of apps) {
const releases = await heroku.get(`/apps/${app.name}/releases`)
#!/usr/bin/env python3
import click
import requests
# Create a group for all subcommands
# http://click.palletsprojects.com/en/7.x/quickstart/#nesting-commands
@click.group()
@click.option('--host', default='https://bounceradmin-default.dev.mozaws.net', show_default=True)
@click.option('--username')
@jbuck
jbuck / Dockerfile
Last active September 26, 2018 19:23
diff --git a/Dockerfile b/Dockerfile
index 49dbc0e1..0a38cf1b 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,10 +1,8 @@
FROM php:5.6-apache
MAINTAINER iteratec WPT Team <[email protected]>
-RUN echo deb http://www.deb-multimedia.org jessie main non-free >> /etc/apt/sources.list && \
- apt-get update && \
'use strict';
const AWS = require('aws-sdk')
const main = async () => {
const env = process.argv[2]
const regions = {
'eu-west-1': {
data_processing_cost: 0.008,
lcu_cost: 0.008
@jbuck
jbuck / execute.sh
Created September 12, 2017 17:04
gh-ost migration scripts
gh-ost \
--max-load=Threads_running=25 \
--assume-rbr \
--critical-load=Threads_running=1000 \
--chunk-size=1000 \
--max-lag-millis=15000 \
--user="" \
--password="" \
--host="" \
--assume-master-host="" \
SHOW VARIABLES WHERE Variable_name LIKE 'character\_set\_%' OR Variable_name LIKE 'collation%';
+--------------------------+-------------------+
| Variable_name | Value |
+--------------------------+-------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | latin1 |
@jbuck
jbuck / rqmetrics.sh
Created June 3, 2016 19:48
Read RQ metrics and put into CloudWatch
#!/bin/bash
set -o errexit
set -o pipefail
set -o nounset
# set -o xtrace
COUNT=60
REDIS_HOST=$2
$ ./stats.sh
Wed May 04: 433.9 Today: 303.0 Change: -30.2%
Tue May 03: 505.1 Today: 303.0 Change: -40.0%
Mon May 02: 485.5 Today: 303.0 Change: -37.6%
Sun May 01: 448.9 Today: 303.0 Change: -32.5%
Sat Apr 30: 451.9 Today: 303.0 Change: -32.9%
Fri Apr 29: 799.5 Today: 303.0 Change: -62.1%
Thu Apr 28: 841.0 Today: 303.0 Change: -64.0%
Wed Apr 27: 817.0 Today: 303.0 Change: -62.9%
Tue Apr 26: 366.7 Today: 303.0 Change: -17.4%
CREATE USER 'fxa_sproc_def';
GRANT ALL PRIVILEGES ON fxa.* TO 'fxa_sproc_def';
UPDATE `mysql`.`proc` p SET definer = 'fxa_sproc_def@%' WHERE definer='root@localhost'
CREATE USER 'fxa_user_1';
GRANT EXECUTE ON PROCEDURE fxa.* to 'fxa_user_1';
CREATE USER 'fxa_user_2';
GRANT EXECUTE ON PROCEDURE fxa.* to 'fxa_user_2';
@jbuck
jbuck / watchdns.sh
Created April 8, 2016 22:57
Watch for ELB scaling via DNS record changes
#!/bin/bash
DOMAIN="$1"
OLD_RECORDS="`dig +short @8.8.8.8 $DOMAIN A | sort`"
echo `date` $OLD_RECORDS
while true; do
sleep 30
NEW_RECORDS="`dig +short @8.8.8.8 $DOMAIN A | sort`"