Skip to content

Instantly share code, notes, and snippets.

Avatar

Andrew Childs andrewchilds

View GitHub Profile
@andrewchilds
andrewchilds / google-meet-kindergarten-edition.css
Last active Sep 25, 2020
Google Meet: Kindergarten Edition
View google-meet-kindergarten-edition.css
/*
This is a quick attempt to make Google Meet work better for someone in Kindergarten
(one in particular - it may or may not work for yours).
Requirements:
- I used the "Stylebot" extension to make this CSS work, but any other related extension should also work.
Changes:
- Hides the "who's here" rotating carousel which is distracting.
@andrewchilds
andrewchilds / redirect.js
Created Nov 1, 2017
How long does it take to stop JS execution during a location redirect?
View redirect.js
for (var i = 0; i < 1000; i++) {
logAndRedirect(i);
}
window.location.href = window.location.href;
function logAndRedirect(i) {
setTimeout(function () {
window.console.log(i);
}, i);
@andrewchilds
andrewchilds / getAgeOfCodebase.sh
Created Jul 3, 2017
Creates a histogram CSV file of the age of every line of code in a directory
View getAgeOfCodebase.sh
#!/bin/bash
set -e
APP_DIR="$1"
TEMP_FILE="codebase-age-histogram.txt"
OUTPUT_FILE="codebase-age-histogram.csv"
pushd $APP_DIR
@andrewchilds
andrewchilds / moving-stories-to-deployed.sh
Last active Aug 4, 2016
Moving Clubhouse Stories to Deployed
View moving-stories-to-deployed.sh
# Define the range of commits in this deploy.
old_sha="87d4fed"
new_sha="2d5b22d"
# Define a comment to be posted to each story.
deploy_id="v1.1234"
deploy_url="https://github.com/company/repo/compare/$old_sha...$new_sha"
comment="This story was deployed as part of $deploy_id.$deploy_url"
# Move stories to deployed and post a comment.
@andrewchilds
andrewchilds / extract-stories-from-commits.sh
Last active Aug 4, 2016
Extracting Clubhouse story IDs from a set of git commits
View extract-stories-from-commits.sh
old_sha="87d4fed"
new_sha="2d5b22d"
git log $old_sha..$new_sha --oneline
# 2d5b22d Merge pull request #6 from company/me/ch345/my-story-name
# e730351 Fix bug
# c410ba0 Fix other bug [ch1004]
function clubhouse_find_stories_in_commit_range {
old_sha="$1"
@andrewchilds
andrewchilds / commit-and-branch-formatting-example.sh
Last active Sep 14, 2016
Clubhouse Branch & Commit Formatting Examples
View commit-and-branch-formatting-example.sh
# Associate a branch with story 123:
git checkout -b ac/ch123/my-story-name
# Or, you might want to associate a single commit with story 123:
git commit -m "Fix bug [ch234]"
@andrewchilds
andrewchilds / clubhouse.sh
Last active Jan 23, 2020
Clubhouse/git/deploy utility functions
View clubhouse.sh
# Clubhouse / git / deploy utility functions
#
# API docs: https://clubhouse.io/api
#
# Assuming the following:
# 1. We have a range of git commits that represent the changes being deployed
# 2. Our git branches and pull requests use the username/ch123/story-name format,
# so that "ch123" ends up in a commit message
# 3. We have a Clubhouse API token set to the $CLUBHOUSE_API_TOKEN environment variable
#
@andrewchilds
andrewchilds / gitbr.sh
Created Feb 18, 2016
A more GitHub-like `git branch`
View gitbr.sh
#!/bin/sh
# gitbr
#
# Example output:
#
# $ gitbr
#
# 3 months ago ac/1999/labels-redesign-spike
# 745f166 WIP.
@andrewchilds
andrewchilds / gist:11831dc82093e53d41af
Last active Oct 30, 2020
Rollbar RQL Cheat Sheet
View gist:11831dc82093e53d41af
# List users by average and maximum session length.
SELECT person, max(client.runtime_ms), avg(client.runtime_ms)
FROM item_occurrence
GROUP BY 1
ORDER BY 2 DESC
# List active date ranges for each deploy.
SELECT client.javascript.code_version, min(timestamp), max(timestamp)
FROM item_occurrence
GROUP BY 1
View gist:015efc22dd7decb6d0e7
#!/bin/bash
# Run every minute using cron:
# */1 * * * * /path/to/mysqlrestarter > /dev/null 2>&1
serverName="website.com"
adminEmail="me@example.com"
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
UP=$(service mysql status | grep 'mysql start/running' | wc -l);