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
suite = unittest.TestLoader().loadTestsFromTestCase(TestMultiplyBy5Operator) | |
unittest.TextTestRunner(verbosity=2).run(suite) |
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
#!/bin/sh | |
# see black https://github.com/python/black | |
set -e | |
if which black >/dev/null; then | |
REPO_ROOT_DIR="$(git rev-parse --show-toplevel)" | |
files=$((git diff --cached --name-only --diff-filter=ACMR | grep -Ei "\.py$") || 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
pipenv lock -r > requirements.txt | |
zip -r MyMLfunction_layer1.zip python | |
aws s3 cp MyMLfunction_layer1.zip s3://mybucket/layers/ | |
# layer 1 | |
aws lambda publish-layer-version --layer-name MyMLfunction_layer1 --content S3Bucket=mybucket,S3Key=layers/MyMLfunction_layer1.zip --compatible-runtimes python3.6 | |
# layer 2 |
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
create database thor2; | |
create user thor2 with encrypted password 'thor2'; | |
grant all privileges on database thor2 to thor2; |
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
[user] | |
name = Lorne | |
email = [email protected] | |
[alias] | |
# BASIC | |
cl = clone | |
ci = commit -m | |
mg = merge | |
st = status | |
co = checkout |
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
# os lib | |
sudo yum update | |
sudo yum groupinstall "Development Tools" | |
sudo yum install -y gcc gcc-c++ git zlib zlib-devel libffi-devel openssl-devel bzip2 bzip2-devel readline-devel sqlite sqlite-devel openssl-devel xz xz-devel findutils | |
# pyenv | |
git clone https://github.com/pyenv/pyenv.git ~/.pyenv | |
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile | |
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile | |
echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.bash_profile |
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
import requests | |
import json | |
import uuid | |
from flask_oauthlib.client import OAuthRemoteApp | |
from flask_oauthlib.utils import to_bytes | |
from jose import jws | |
from oauthlib.oauth2 import WebApplicationClient | |
try: |
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
#!/bin/bash | |
while read oldrev newrev refname | |
do | |
branch=$(git rev-parse --symbolic --abbrev-ref $refname) | |
if [ "master" == "$branch" ]; then | |
sudo git --git-dir=/home/git/ozsales.git --work-tree=/opt/ozsales checkout -f master >/dev/null | |
cd /opt/ozsales | |
PIP=/home/luotao/venv/ozsales/bin/pip |
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
import time | |
import pprint | |
import functools | |
from functools import wraps | |
def repeat(num_times=1): | |
def decorator_repeat(func): | |
@functools.wraps(func) | |
def wrapper_repeat(*args, **kwargs): |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.