Skip to content

Instantly share code, notes, and snippets.

View Createdd's full-sized avatar
🚀
Making it happen

Daniel Deutsch Createdd

🚀
Making it happen
View GitHub Profile
#!/bin/sh
echo "$branchName"
if [ "$branchName" = "master" ]; then
exit 0
fi
if [[ "$branchName" =~ ^[a-z]+[\/]+[A-Z]+[\-]+[0-9]+[\_]+[a-zA-Z] ]]; then
echo "Good branch name!"
exit 0
#!/bin/sh
echo "Running pre-push hook"
./exampleScrit.sh
# $? stores exit value of the last command
if [ $? -ne 0 ]; then
echo "Tests must pass before commit!"
exit 1
fi
#!/usr/bin/env node
const fs = require( 'fs' );
const commit = process.argv[2];
const data = fs.readFileSync( commit, { encoding: 'utf8' } );
const [ firstLine ] = data.split( '\n' );
const result = /^[A-Z]+\-\d+ .+$/.test( firstLine );
const errorMessage = `
-----------------------------------------------------
#!/bin/sh
# list of hooks the script will look for
HOOK_NAMES="applypatch-msg pre-applypatch post-applypatch pre-commit prepare-commit-msg commit-msg post-commit pre-push pre-rebase post-checkout post-merge pre-receive update post-receive post-update pre-auto-gc"
# relative folder path of the .git hook / current script
GIT_HOOK_DIR=./.git/hooks
# relative folder path of the custom hooks to deploy / current script
LOCAL_HOOK_DIR=./scripts/git
# relative folder path of the custom hooks to deploy / .git hook folder
@Createdd
Createdd / unit1_ex4_unit_tests
Created October 19, 2019 15:49
unit tests for the calculator exercise of programming class
def test_addtion_int():
assert calculate_result(2, 3, 'int', "addition") == 5
def test_addtion_float():
assert calculate_result(2.1, 3.5, 'float', "addition") == 5.6
def test_subtraction_int():
assert calculate_result(4, 3, 'int', "subtraction") == 1
def test_subtraction_float():
import numpy as np
one_dim = np.ones(shape=(5), dtype=np.int)
# print(one_dim)
# [1 1 1 1 1]
two_dim = np.ones(shape=(5, 2), dtype=np.int)
# print(two_dim)
@Createdd
Createdd / statistics4.ipynb
Last active April 4, 2020 15:01
Exercisesheet Statistics on Variability and Boxplots
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import os
import glob
import shutil
import typing
import numpy as np
from PIL import Image, ImageStat, ImageChops
from pathlib import Path
def pre_processsing(input_dir: str, output_dir: str, logfile: str) -> int:
@app.route('/predict',methods=['POST'])
def predict():
input_val = [x for x in request.form.values()][0]
rf = load_model(BUCKET_NAME, MODEL_FILE_NAME, MODEL_LOCAL_PATH)
if input_val not in available_countries:
return f'Country {input_val} is not in available list. Try one from the list! Go back in your browser', 400
to_pred = get_prediction_params(input_val, url_to_covid)
prediction = rf.predict(to_pred)[0]
return render_template('home.html',pred=f'New cases will be {prediction}')
def pre_process(df):
cols_too_many_missing = ['new_tests',
'new_tests_per_thousand',
'total_tests_per_thousand',
'total_tests',
'tests_per_case',
'positive_rate',
'new_tests_smoothed',
'new_tests_smoothed_per_thousand',
'tests_units',