Twitter's [new API pricing starts at $5,000 per month][pricing] to read 1 million tweets per month. According to our metrics, [Thresholderbot] read more than 15 million tweets per month on average over the last 12 full months of activity — and that estimate may be far too low if retweets are counted as 2 reads.
#!/usr/bin/env python3 | |
import subprocess | |
import sys | |
def run_cmd(cmd): | |
return subprocess.check_output(cmd).decode("utf8").strip() | |
#!/bin/bash | |
VENV_DIR=".venv" | |
REQUIREMENTS_HASH_FILE="$VENV_DIR/requirements.shasum" | |
REQUIREMENTS_HASH_FUNC="shasum" | |
REQUIREMENTS_HASH_VAL=$($REQUIREMENTS_HASH_FUNC requirements.txt | cut -d ' ' -f 1) | |
function reset_venv() { | |
rm -rf "$VENV_DIR" |
#!/bin/bash | |
# | |
# A wrapper that executes the gcloud CLI in a docker container, to avoid | |
# requiring a local installation. | |
# | |
# Adapted from this helpful blog post: | |
# https://blog.scottlowe.org/2018/09/13/running-gcloud-cli-in-a-docker-container/ | |
GCLOUD_SDK_TAG="312.0.0" |
#!/usr/bin/env python3 | |
import argparse | |
import subprocess | |
import sys | |
import urllib.parse | |
def main(env: str, services: [str]) -> int: | |
filters = [f"env:{env}"] |
Here are two queries that look up information about a pull request via GitHub's GraphQL API v4. The first looks up a pull request by number, the second looks up a pull request by ref (i.e. commit hash, branch name, tag name).
While it is trivial to use the RESTful v3 API to look up a pull request by number, the GraphQL API is the only way to do the same thing for an arbitrary reference in a single HTTP request.
These took a bit of trial and error in the GitHub's GraphQL Explorer and various support threads to get right, so I'm putting them up here for posterity.
config: | |
aws:region: us-east-2 | |
pulumi:template: aws-go |
Here's a short snippet of code that demonstrates a surprising effect of golang's variable scoping rules. (This is maybe only surprising for me, with Python's scoping rules deeply ingrained in my brain.)
In the real world, this came up in the context of an HTTP middleware function, where state accumulated in surprising ways across multiple requests to the handler wrapped by the middleware.
#!/usr/bin/env python3 | |
import subprocess | |
import sys | |
def run_cmd(cmd): | |
return subprocess.check_output(cmd).decode('utf8').strip() | |
#!/usr/bin/env python3 | |
import os | |
import sys | |
import requests | |
def run_query(api_token, query): | |
url = 'https://api.github.com/graphql' |