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 | |
from __future__ import print_function | |
""" | |
./%s 'cmd' <id-argname> <redef-argname> [<redef-argname>...] | |
Given the current environment: | |
IDARG=1 | |
FOO1=foovalue | |
BAR1=barvalue | |
FOO2=foo-unused |
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
def dual_decorator(func): | |
"""This is a decorator that converts a paramaterized decorator for no-param use.""" | |
# modified from http://stackoverflow.com/a/10288927/1231454. | |
@functools.wraps(func) | |
def inner(*args, **kw): | |
if ((len(args) == 1 and not kw and callable(args[0]) | |
# Exceptions are callable; the next line allows us to accept them as args. | |
and not (type(args[0]) == type and issubclass(args[0], BaseException)))): | |
return func()(args[0]) |
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
import vcrutils | |
VCR_CASSETTE_PATH = APPROOT + '/venmo_tests/cassettes/' # eg | |
MAKE_EXTERNAL_REQUESTS = os.environ.get('MAKE_EXTERNAL_REQUESTS') == 'TRUE' | |
@dual_decorator # convert a paramaterized decorator for no-arg use (https://gist.github.com/simon-weber/9956622). | |
def external_call(*args, **kwargs): | |
"""Enable vcrpy to store/mock http requests. |
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 is_non_inbox_node(node){ | |
var is_non_inbox = false; | |
if (node.isContentEditable || | |
node.tagName == 'INPUT' || | |
node.tagName == 'TEXTAREA' || | |
node.getAttribute('aria-haspopup') == 'true' | |
){ | |
is_non_inbox = true; | |
} |
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 | |
# Usage: | |
# | |
# lint [file1] [file2]... | |
# | |
# With no arguments, lint any tracked files with modifications. | |
# Get venmolint.py into the path so that git-lint detects it. |
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 | |
GITROOT=`git rev-parse --show-toplevel` | |
EXIT_STATUS=0 | |
# Lint all the files in the index, excluding deletions and directories. | |
git diff-index -z --cached --name-only --diff-filter='ACMRTUXB' HEAD | xargs -0 ls -dp | grep -v '/$' | xargs "$GITROOT/lint" | |
if [ "$?" != "0" ]; then |
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 | |
""" | |
Run on Jenkins to print a url for each artifact generated by a downstream multijob build. | |
""" | |
import os | |
import requests |
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
import sys | |
import os | |
import xml.etree.ElementTree as ET | |
import logging | |
import re | |
from shutil import copyfile | |
from optparse import OptionParser | |
### This file came from the https://github.com/flow123d/flow123d repo they were nice enough to spend time to write this. | |
### It is copied here for other people to use on its own. |
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
""" | |
Suspend an auto scaling group's scaling processes that can interfere with CodeDeploy deploys. | |
It assumes a single ASG per deployment group. | |
To use this: | |
* create a lambda function with this code, then hook up it up to an SNS topic that receives all deployment events (but not host events). | |
* attach that topic as a trigger in your deployment groups. | |
Unlike AWS's in-appspec approach, this supports arbitrary deploy concurrency. |
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
document.write = function (s) { | |
// jsfiddle doesn't allow document.write. | |
document.body.insertAdjacentHTML("beforeend", s); | |
} | |
const schemaBuilder = lf.schema.create('schema', 1); | |
schemaBuilder.createTable('Item'). | |
addColumn('id', lf.Type.INTEGER). | |
addColumn('num', lf.Type.STRING). | |
addPrimaryKey(['id']). |