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(){ | |
// Sets and gets a sample ID for bucket selection in A/B and related testing methodologies. | |
var ckPattern = /sampleId=(\d+)/g; | |
var sampleId = -1; | |
// TODO: adopt a different method for selecting the corp top level domain | |
var domain = document.location.hostname; | |
document.cookie.replace(ckPattern, function($0, $d){ |
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 python | |
# Loads a CSV file, assuming it has header names, and prints only the specified columns. | |
# ... like selecting two columns of a 7-column table. | |
# | |
# Arguments: | |
# - field names, comma-separated | |
# - input filename | |
# | |
# Output: | |
# - the header row for the specified columns, and those fields for all input records. |
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
<!-- Google Tag Manager loader; customized by Analytics Pros [analyticspros.com] --> | |
<script> | |
/* Update these for your GTM container(s); be sure they're unique, occurring only once each, not duplicated */ | |
var GTMContainerIDs = ['GTM-XXXXX', 'GTM-YYYYY' ]; | |
window.dataLayer = window.dataLayer || []; | |
window.dataLayer.push({ | |
'platform': 'hubspot' // Update this value to reflect other platforms | |
}); |
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
# Example dynamic selection of Python requirements files | |
dependencies: $(shell python requirements.py) | |
for req in $^; do \ | |
pip install --upgrade -r $$req ; \ | |
done | |
test: dependencies | |
echo run your tests. |
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
#!/bin/sh | |
# Sets up a wide array of my development environment on a Mac... | |
fail(){ | |
err=$1; shift 1; | |
echo "$@" >&2 | |
exit $err | |
} |
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
#!/bin/sh | |
# Execute directly: sh converse.sh script.text | |
which say || exit 1 | |
cat $@ | grep -v '^#' | tr -s ':' '\t' | while read name content; do say -v $name "$content"; done |
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 python | |
""" | |
Scan an index of files, typically keyed by MD5 checksum, in the format produced by | |
GNU `md5sum` (not BSD-style), searching for one of many checksums listed in a pattern file. | |
The primary objective is to help find duplicates in a large collection of files, e.g. an | |
archive of music. Example: | |
> find ./music -type f -print0 | xargs -0 md5sum | sort > index.txt |
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
#!/bin/sh | |
curl http://www.coe.neu.edu/cgi-bin/fortune | \ | |
xmllint --nowarning --html --recover --xpath "//pre//text()" - 2>/dev/null | \ | |
say -v Alex |
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
#!/bin/bash | |
# VirtualBox control handler | |
# OS X shell context (BSD utilities) | |
# Simplifies VBoxHeadless and VBoxManage calls. | |
# In my use-case, the primary objective is to | |
# Usage: | |
# vm.sh list lists all your VMs |
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
#!/bin/sh | |
export MACHINE_NAME="test machine" | |
export DATE=`date +"%Y-%m-%d %H:%M:%S"` | |
take_snapshot () { | |
while read vmuuid; do | |
VBoxManage snapshot "${vmuuid}" take "Snapshot ${DATE}" | |
done | |
} |