Skip to content

Instantly share code, notes, and snippets.

@NicholasBallard
NicholasBallard / gitonremote.md
Last active November 1, 2019 03:06
Using Git for to Move Code to a Remote Server

Running Code on a Remote Server

Nicholas Ballard

Cha... Charmander?



Hope you enjoyed the gif. We are going to be working with remote servers. Fun is officially cancelled.

@NicholasBallard
NicholasBallard / asyncio.py
Created December 27, 2019 23:36
mod of asyncio.py for Win10 Python 3.8.X (so Jupyter web apps works)
# Modify [...]lib\site-packages\tornado\platform\asyncio.py on Windows with 3.8.x so asyncio works with Tornado
# Nick note 12/27/2019: still needed to check for sys.platform == 'win32' with 3.8.1 upgrade
"""Bridges between the `asyncio` module and Tornado IOLoop.
.. versionadded:: 3.2
This module integrates Tornado with the ``asyncio`` module introduced
in Python 3.4. This makes it possible to combine the two libraries on
the same event loop.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
from __future__ import annotations
from dataclasses import dataclass, astuple
from itertools import cycle
from typing import List
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
from dataclasses import dataclass
@dataclass
class Pixel:
red: int
green: int
blue: int
# alpha: float = 1
pixel = Pixel(255,0,0)
resized = resize("checkers.jpg", 50)
print(resized.shape)
plt.imshow(resized) # can use cv2.imshow("name", image)
from PIL import Image
def resize(fp: str, scale: Union[float, int]) -> np.ndarray:
""" Resize an image maintaining its proportions
Args:
fp (str): Path argument to image file
scale (Union[float, int]): Percent as whole number of original image. eg. 53
Returns:
""" resize.py
"""
from __future__ import annotations
import os
import glob
from pathlib import Path
import sys
import click
import cv2
def resize(fp: str, scale: Union[float, int]) -> np.ndarray:
""" Resize an image maintaining its proportions
Args:
fp (str): Path argument to image file
scale (Union[float, int]): Percent as whole number of original image. eg. 53
Returns: