Skip to content

Instantly share code, notes, and snippets.

Andrew Carter ascarter

Block or report user

Report or block ascarter

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
ascarter / docker.bash
Created May 24, 2019
Convenience functions for running docker with ephemeral containers
View docker.bash
# -*- mode: unix-shell-script; -*-
# Run command in container with local directory mounted
# Useful for scripting languages like Ruby, Python, and Node
# Usage: docker_cmd <image> <bin> <cmd> [args]
docker_cmd() {
local image=$1; shift
local bin=$1; shift
local cmd=$1; shift
local args=$*
ascarter / docker-compose.yml
Created May 23, 2019
Grafana/Prometheus/Loki stack
View docker-compose.yml
version: "3.7"
image: prom/prometheus
- 9090:9090
- prometheus-storage:/prometheus
ascarter /
Created May 22, 2019
Makefile help
HELP_FORMAT=" \033[36m%-25s\033[0m %s\n"
.PHONY: help
help: ## Display this usage information
@echo "Valid targets:"
@grep -E '^[^ ]+:.*?## .*$$' $(MAKEFILE_LIST) | \
sort | \
awk 'BEGIN {FS = ":.*?## "}; \
{printf $(HELP_FORMAT), $$1, $$2}'
@echo ""
@echo "This host will build the following targets if 'make release' is invoked:"
ascarter /
Last active Nov 29, 2018
macOS AppleScript for dark mode
# macOS display mode
alias darkmode='osascript -e "tell application \"System Events\" to tell appearance preferences to set dark mode to true"'
alias lightmode='osascript -e "tell application \"System Events\" to tell appearance preferences to set dark mode to false"'
alias togglemode='osascript -e "tell application \"System Events\" to tell appearance preferences to set dark mode to not dark mode"'
ascarter / dk
Created Dec 1, 2017
Run app via docker
View dk
# Run app via docker
dk() {
# Usage: dk <cmd> <app> [args]
local cmd=$1; shift
local app=$1; shift
local args=$*
local name_prefix="${USER}_"

Keybase proof

I hereby claim:

  • I am ascarter on github.
  • I am ascarter ( on keybase.
  • I have a public key ASD6MZm3JbqHYXOkhB-wr_5yya86iKzlgAH-OMez-Z3FAwo

To claim this, I am signing this object:

ascarter / logex.go
Last active Sep 1, 2017
Log wrapper for Go stdlib logger
View logex.go
package log
import (
stdlog "log"
var (
ascarter / log.go
Created Dec 31, 2014
HTTP request logger in Go
View log.go
package __package__
import (
type responseLogger struct {
w http.ResponseWriter
status int
#!/usr/bin/env python
# coding=UTF-8
import argparse
import math
import subprocess
import sys
def main(argv):
parser = argparse.ArgumentParser(description='Display current battery capacity')
ascarter /
Created Aug 19, 2011 — forked from alexkingorg/
View source from a URL in BBEdit
function bbcurl () {
curl $1 | bbedit --new-window +1 -t $1
You can’t perform that action at this time.