#### Cutting a release with a log of recent pull requests merged to master
git_release_commits () {
git pull
git fetch -p
git log --oneline --decorate | grep 'Merge pull request' | head -n25
}
This file contains hidden or 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 | |
| # https://stackoverflow.com/questions/4254389/git-corrupt-loose-object | |
| # https://git.kernel.org/pub/scm/git/git.git/tree/Documentation/howto/recover-corrupted-blob-object.txt?id=HEAD | |
| # https://stackoverflow.com/questions/39409252/how-to-fix-git-error-head-invalid-reflog-entry-xxxxxxxxxxxxxxxx | |
| find .git/objects/ -size 0 -exec rm -f {} \; | |
| git reflog expire --stale-fix --all | |
| git gc --aggressive --prune=now | |
| git fsck --full |
This file contains hidden or 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 | |
| # Copyright 2020 Darren Weber | |
| # | |
| # Licensed under the Apache License, Version 2.0 (the "License"). You may not | |
| # use this file except in compliance with the License. A copy of the License is | |
| # located at | |
| # | |
| # http://aws.amazon.com/apache2.0/ | |
| # |
This file contains hidden or 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
| # see https://stackoverflow.com/questions/47177538/installing-miniconda-on-alpine-linux-fails | |
| # adapted from https://github.com/Docker-Hub-frolvlad/docker-alpine-miniconda3 | |
| # depends on ./alpine/glibc* already downloaded in the git repo | |
| # https://github.com/docker-library/docker/blob/master/19.03/Dockerfile | |
| # based on alpine:3.11 | |
| image: docker:19.03.6 | |
| # image: python:3.6-stretch | |
| variables: |
This file contains hidden or 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
| # Since dict.merge() returns None on success, the | |
| # statement can be followed with an 'or' expression | |
| # to return the updated dict and assign it, return | |
| # or yield the merged dict. | |
| x = {1:'a'} | |
| y = {2:'b'} | |
| x.update(y) or x | |
| # {1: 'a', 2: 'b'} |
From https://stackoverflow.com/questions/12569452/how-to-identify-numpy-types-in-python
Note that the type(numpy.ndarray) is a type itself and watch out for boolean and scalar types. Don't be too discouraged if it's not intuitive or easy, it's a pain at first.
See also:
- https://docs.scipy.org/doc/numpy-1.15.1/reference/arrays.dtypes.html
- https://github.com/machinalis/mypy-data/tree/master/numpy-mypy
>>> import numpy as np
This file contains hidden or 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
| # Thanks to: | |
| # https://gist.github.com/bastman/5b57ddb3c11942094f8d0a97d461b430 | |
| # Volumes | |
| # https://github.com/chadoe/docker-cleanup-volumes | |
| #docker volume rm $(docker volume ls -qf dangling=true) | |
| #docker volume ls -qf dangling=true | xargs -r docker volume rm | |
| #docker volume rm $(docker volume ls -q -f 'dangling=true') |
This file contains hidden or 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
| # load and parse a requirements.txt file | |
| def parse_requirement(requirement, excludes): | |
| lib = requirement.strip().split('#')[0] # strip new lines and comments | |
| if lib: | |
| lib_name = re.split(r'[[<>=! ]+', lib)[0] | |
| if lib_name in excludes: | |
| return '' | |
| return lib.strip() | |
| return '' |