Skip to content

Instantly share code, notes, and snippets.

Aidan Feldman afeld

Block or report user

Report or block afeld

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
afeld /
Last active Mar 28, 2019
run SAS script from UNIX command line

To use, put the script in a file on the machine you want to run SAS, then make it executable.

chmod +x

After that, you can use it to run SAS scripts:

afeld / MY_Exceptions.php
Created Feb 10, 2019
StackDriver reporting for PHP CodeIgniter
View MY_Exceptions.php
use Google\Cloud\ErrorReporting\Bootstrap;
use Google\Cloud\Logging\LoggingClient;
use Google\Cloud\Core\Report\SimpleMetadataProvider;
// application/core/MY_Exceptions.php
class MY_Exceptions extends CI_Exceptions {
public function __construct()
afeld /
Created Sep 17, 2018
get list of properties from a JSON Schema

Uses jq.

cat schema.json | \
  jq -r '[paths | join(".")] | .[]' | \
  grep 'properties\.\w\+$' | \
  sed 's/properties\.//g'

Example with this file:

afeld /
Created Jul 9, 2018
redact IP addresses in output

When running a command with output that will be publicly available, you may not want to show IP addresses. This might come up with output from a freemium continuous integration (CI) service like TravisCI or CircleCI, for example. Pipe output into the following command to redact the first three segments:

sed -E 's/[0-9]+\.[0-9]+\.[0-9]+\.([0-9]+)/███.███.███.\1/g'

The squares are the Unicode "full block" character. Example use:

$ ansible-playbook -i --list-hosts playbooks/test.yml | sed -E 's/[0-9]+\.[0-9]+\.[0-9]+\.([0-9]+)/███.███.███.\1/g'
afeld /
Last active Aug 22, 2018
ways to send me money
afeld / mocks.go
Created Feb 22, 2018
example mocking in Golang
View mocks.go
type APIClientIface interface {
CreateAccountInOrgUnit() bool
type RealAPIClient struct {}
func (ac RealAPIClient) CreateAccountInOrgUnit() bool {
// ...
afeld /
Last active Apr 20, 2018
Talk abstract: “Love and agony: containers in government”

This talk chronicles the love story of two star-crossed protagonists, containers and bureaucrats. Root for the pair as they muddle their way through the trials and tribulations of procurement, compliance, and answering the question of “so a container is a VM, right?” Can regulation and policy be overcome to unite the two in glorious harmony? Or will this just end up being another technological missed connection?



  • Why containers are desirable in heavily-regulated industries
  • Statistics around container adoption
  • Obstacles to adoption
    • Workstation installation
afeld /
Last active Aug 27, 2019
archive inactive GitHub repositories in an organization
afeld /
Last active Mar 27, 2017
get MySQL database connection information from environment variables in Python

While this code is for MySQLdb, it would be similar for most other Python database APIs. The corresponding environment variables, which are all optional:


More information about these variables.

afeld /
Created Nov 10, 2016
attribute lists in Hugo (static site generator)

To create Kramdown-style attribute lists for adding HTML classes around blocks of Markdown, you can leverage Hugo shortcodes.

  1. Add the following to layouts/shortcodes/wrap.html:

    <div class="{{ range .Params }}{{ . }} {{ end }}">
      {{ .Inner }}
You can’t perform that action at this time.