Skip to content

Instantly share code, notes, and snippets.

Avatar

Douglas Naphas douglasnaphas

View GitHub Profile
@douglasnaphas
douglasnaphas / print-repos-on-non-master.sh
Last active May 28, 2020
Print repos in subdirectories of the current directory that are not on master or have dirty working directories
View print-repos-on-non-master.sh
for d in $(ls) ; do
if [[ ! -d ${d}/.git ]] ; then
continue ;
fi
BRANCH="$(git -C ${d} rev-parse --abbrev-ref HEAD)" ;
if [[ "${BRANCH}" != "master" ]] ; then
echo ${d} "${BRANCH}" ;
continue ;
fi
if [[ $(git -C ${d} status --porcelain 2>/dev/null | wc -l) -ne 0 ]] ; then
@douglasnaphas
douglasnaphas / pr-times.js
Created May 26, 2020
Given an array with PR creation and approval times, compute the average duration
View pr-times.js
// run this query, for example in https://developer.github.com/v4/explorer/
// query MyQuery {
// repository(name: "repo-name", owner: "repo-owner") {
// pullRequests(states: MERGED, last: 100) {
// nodes {
// publishedAt
// reviews(first: 1, states:APPROVED) {
// nodes {
// submittedAt
// }
@douglasnaphas
douglasnaphas / dep-conflict-1464-1
Created Dec 9, 2019
Dependency conflict building from PR1464 branch
View dep-conflict-1464-1
...<output truncated>...
Requirement already satisfied: zipp>=0.5 in ./samcli374/lib/python3.7/site-packages (from importlib-metadata>=0.12; python_version < "3.8"->pytest==5.2.1; extra == "dev"->aws-sam-cli==0.37.0) (0.6.0)
Requirement already satisfied: wrapt==1.11.* in ./samcli374/lib/python3.7/site-packages (from astroid<3,>=2.2.0->pylint==2.3.1; extra == "dev"->aws-sam-cli==0.37.0) (1.11.2)
Requirement already satisfied: lazy-object-proxy==1.4.* in ./samcli374/lib/python3.7/site-packages (from astroid<3,>=2.2.0->pylint==2.3.1; extra == "dev"->aws-sam-cli==0.37.0) (1.4.3)
Requirement already satisfied: typed-ast<1.5,>=1.4.0; implementation_name == "cpython" and python_version < "3.8" in ./samcli374/lib/python3.7/site-packages (from astroid<3,>=2.2.0->pylint==2.3.1; extra =
= "dev"->aws-sam-cli==0.37.0) (1.4.0)
Requirement already satisfied: apipkg>=1.4 in ./samcli374/lib/python3.7/site-packages (from execnet>=1.1->pytest-xdist==1.30.0; extra == "dev"->aws-sam-cli==0.37.0) (1.5)
ERROR: astroid 2.3.3 has re
@douglasnaphas
douglasnaphas / aws-sam-cli-tox-errors.1.txt
Created Dec 9, 2019
Errors from running tox on the development branch of aws-sam-cli
View aws-sam-cli-tox-errors.1.txt
GLOB sdist-make: /Users/douglasnaphas/repos/aws-sam-cli/setup.py
py27 inst-nodeps: /Users/douglasnaphas/repos/aws-sam-cli/.tox/.tmp/package/1/aws-sam-cli-0.37.0.zip
ERROR: invocation failed (exit code 1), logfile: /Users/douglasnaphas/repos/aws-sam-cli/.tox/py27/log/py27-3.log
================================== log start ===================================
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Processing ./.tox/.tmp/package/1/aws-sam-cli-0.37.0.zip
ERROR: Package 'aws-sam-cli' requires a different Python: 2.7.14 not in '>=3.6, <=4.0, !=4.0'
=================================== log end ====================================
py36 inst-nodeps: /Users/douglasnaphas/repos/aws-sam-cli/.tox/.tmp/package/1/aws-sam
@douglasnaphas
douglasnaphas / 2-different-rtbs-same-name.txt
Created Oct 4, 2019
Two different remote tracking branches, same name
View 2-different-rtbs-same-name.txt
| ~/repos/remote1 @ Dougs-MacBook-Pro (dougnaphas) [11:17:29] master Δ
| 4013 => git add f1
________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
| ~/repos/remote1 @ Dougs-MacBook-Pro (dougnaphas) [11:17:31] master Δ
| 4014 => git commit
[master f4cd5ac] Add a file to be committed on origin/abc b1
1 file changed, 1 insertion(+)
create mode 100644 f1
________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
| ~/repos/remote1 @ Dougs-MacBook-Pro (dougnaphas) [11:18:00] master
@douglasnaphas
douglasnaphas / promise.test.js
Created Nov 12, 2018
Examples of testing with Jest and Promises
View promise.test.js
test('promise series', () => {
new Promise(resolve => {
resolve('a');
}).then(Promise.resolve());
});
const fetchBeverageList = () =>
new Promise((resolve, reject) => {
resolve(4);
});
@douglasnaphas
douglasnaphas / awk_print_A-Z
Created Aug 6, 2015
Why does awk print letters not between A and Z in the ASCII character set when told to print lines that match the regex [A-Z]?
View awk_print_A-Z
$ echo "b" | awk '/[A-Z]/'
b
$ echo "a" | awk '/[A-Z]/'
$ echo "z" | awk '/[A-Z]/'
z
$
You can’t perform that action at this time.