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
| curl https://raw.githubusercontent.com/github/gitignore/master/Python.gitignore > .gitignore |
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
| # basic setup for a single droplet with ssh and firewall config | |
| # reference: https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-18-04 | |
| 1. Login in as root | |
| $ root@xxx.xxx.xxx.xxx | |
| 2. Add a non-root user, give sudo privelages and transfer ssh public key | |
| $ adduser sammy | |
| $ usermod -aG sudo sammy | |
| $ rsync --archive --chown=sammy:sammy ~/.ssh /home/sammy |
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
| # for dev purposes or machines that aren't opened up to the public | |
| # ref: https://www.humankode.com/ssl/create-a-selfsigned-certificate-for-nginx-in-5-minutes | |
| # 1. make a local directory...create a conf file for localhost config | |
| $ sudo nano localhost.conf | |
| # paste this in there... | |
| ------------------------------- | |
| [req] | |
| default_bits = 2048 |
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
| # based on the digital ocean guides | |
| # This is for configuring nginx to proxy_pass to multiple backend servers | |
| # from a gateway server. | |
| # 1. install | |
| $ sudo apt update | |
| $ sudo apt install nginx | |
| # 2. adjust firewall | |
| $ sudo ufw allow 'Nginx 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
| # based on digital ocean for 18.04 | |
| $ sudo apt update | |
| $ sudo apt install postgresql postgresql-contrib | |
| # make a new non-postgres user for the system without switching roles | |
| $ sudo -u postgres createuser --interactive | |
| $ sudo -u postgres createdb <your-user-name> | |
| # setup a db password for user |
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
| from sqlalchemy import create_engine | |
| from sqlalchemy.orm import sessionmaker, scoped_session | |
| from contextlib import contextmanager | |
| import logging | |
| l = logging.getLogger(__name__) | |
| class DataAccessLayer(object): |
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
| { | |
| "configurations": [ | |
| { | |
| "name": "Linux", | |
| "includePath": [ | |
| "${workspaceFolder}/**", | |
| "~/.conan/**" | |
| ], | |
| "defines": [], | |
| "compilerPath": "/usr/bin/clang", |
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
| """ Defines a generic interface for composable widgets. Panels are the view layer, Datastores are the model. | |
| Downloaders should fill the datastores with data. Panels should register observers to implement parts of the API. This could be | |
| as simple as downloading and displaying data, or calling custom APIs that call things. | |
| """ | |
| import abc | |
| import IPython | |
| import ipywidgets as widgets | |
| import inspect |
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
| """ A high-level API that wraps the sklearn Pipeline interface. If designed well we should be able to use this base class to | |
| encapsulate elements of jupyter notebook script. A user should subclass and override the specified hook methods of these classes | |
| to build a workflow for deployment and benchmarking. | |
| """ | |
| import abc | |
| #from sklearn.externals.joblib import parallel_backend warning says to use parallel backend from joblibe directly... | |
| from joblib import parallel_backend | |
| from sklearn.model_selection import GridSearchCV, RandomizedSearchCV,\ | |
| ParameterGrid, ParameterSampler |
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
| from typing import Any, List, NamedTuple, Optional | |
| import pydantic | |
| import datetime | |
| import re | |
| _ym_re = re.compile(r'[0-9]{4}-[0-9]{2}') | |
| class YearMonth(NamedTuple): | |
| """A custom YearMonth type. Can validate against YYYY-MM, ('YYYY', 'MM') or (int, int). | |
| Checks that year and month are valid ISO 8601 ranges. |
OlderNewer