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 bash | |
# Run `make requirements` if virtualenv or requirements dir has changed since | |
# last run. | |
set -eu -o pipefail | |
if [[ -z "${VIRTUAL_ENV:-}" ]]; then | |
echo >&2 "Not in a virtualenv" | |
exit 1 | |
fi |
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
# Load a channel's info pane, scroll to the bottom of the member list, export a HAR, then run it through this: | |
jq '.log.entries[]|select(.request.url|contains("users/list"))|.response.content.text' -r | jq '.results[]|.profile.email' -r | |
# Useful for workspace migration. |
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
git log --branches --tags --format=format:%H | grep -Po '^.{7}' | sort | uniq -c | grep -v ' 1 ' |
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
select count(*) from Transaction facet name where guid in ( | |
select parentId from ( | |
select count(*) from Transaction facet parentId | |
where appName = '...' and request_user_id = ... and name = '...' | |
limit max | |
) | |
limit max | |
) | |
since 3 days ago limit max |
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
grep -Prl 'JWT_PUBLIC_SIGNING_JWK_SET(?!.*\}\})' ~/edx-repos/*-internal | while IFS= read -r fp; do | |
cat -- "$fp" | yq '.. | .JWT_PUBLIC_SIGNING_JWK_SET? | select(. != null)' -r | jq . -c --sort-keys || echo "Error in file $fp" | |
done | sort | uniq -c | sort -rn | less -Sn |
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
""" | |
Build and display a graph of classes in a module. | |
Call from virtualenv of repo you're inspecting. | |
Example call, from inside edx-platform: | |
DJANGO_SETTINGS_MODULE=lms.envs.test python3 ./class_graph.py xmodule.modulestore BulkOperationsMixin | dot -Tsvg > BulkOperationsMixin.svg | |
""" |
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
function git_default_branch { | |
# Guess the name of the remote -- either origin or the first other remote | |
guessed_remote="$( | |
( | |
git remote | grep -P '^origin$' | |
git remote | grep -P '^origin$' -v | |
) | head -n1 | tr -d '\n' | |
)" | |
git symbolic-ref "refs/remotes/$guessed_remote/HEAD" \ | |
| sed 's|^refs/remotes/[^/]\+/||' |
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 python3 | |
# This script records an action we took to leave a comment on (almost) | |
# every open edx-platform PR to let people know that they needed to | |
# rebase onto master (or merge it into their branch) to avoid breaking | |
# the build. | |
# | |
# The script requires a Github access token and finds all open PRs | |
# against master on edx-platform which do not have a specific commit | |
# in their ancestors, then leaves a comment on each one. This should | |
# be done from a bot account; the bot will then be subscribed to all |
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/python3 | |
import collections | |
import datetime | |
import os | |
import sys | |
tz = datetime.timezone(offset=datetime.timedelta(hours=-5)) | |
logfile = os.path.expanduser("~/context-switches.log") |
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
# Place in a Python package with this in the setup.py: | |
# | |
# entry_points={ | |
# 'console_scripts': [ | |
# 'make = SOME_MODULE.instrument_make:wrapper', | |
# ], | |
# }, | |
import re |
NewerOlder