Skip to content

Instantly share code, notes, and snippets.

Avatar
😋

Matt Madoshakalaka

😋
  • Altlab
  • Edmonton, Canada
View GitHub Profile
@Madoshakalaka
Madoshakalaka / run-bike-fun.py
Created Apr 16, 2021
math 372 - run bike fun - linear programming
View run-bike-fun.py
from scipy.optimize import linprog
import numpy as np
import matplotlib.pyplot as plt
from numpy.linalg import matrix_rank
# scipy's lingprog
# https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.linprog.html
View quick_select_n_largest.py
from typing import List
def quick_sort_find_n_th_largest(numbers: List[float], n: int) -> float:
pivot = numbers[0]
left = []
right = []
@Madoshakalaka
Madoshakalaka / singleton.py
Created Aug 24, 2019
pythonic singleton class
View singleton.py
class ClassName:
_instance = None
def __init__(self, arg1, arg2, arg3):
if ClassName._instance is None:
# do initialization here
ClassName._instance = self
def __new__(cls, **kwargs):
if cls._instance is None:
@Madoshakalaka
Madoshakalaka / .travis.yml
Last active Aug 25, 2019
.travis.yml for python package with pipenv work flow
View .travis.yml
language: python
dist: xenial
install: 'pipenv install --dev'
script: 'pytest'
stages:
- test
- deploy
jobs:
View python_interactive_wrapper.py
import os
import sys
import select
import termios
import tty
import pty
from subprocess import Popen
command = 'python'
# command = 'docker run -it --rm centos /bin/bash'.split()
@Madoshakalaka
Madoshakalaka / python3-package.travis.yml
Last active Aug 23, 2019
perfect travis.yml for python 3 package
View python3-package.travis.yml
language: python
dist: xenial # required to use python 3.7
install: pip install -e .
script:
- pytest tests/*.py
stages:
- test
- deploy
View staged_test_and_deployment.travis.yml
dist: xenial
stages:
- test
- name: deploy
if: branch = master # don't run deploy stage if branch is not master
jobs:
include: