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
// use std::fs::File; | |
use itertools::Itertools; | |
use std::io::{self, BufRead, BufReader, BufWriter, Write}; | |
use serde::{Deserialize, Serialize}; | |
// use std::path::Path; | |
#[derive(Serialize, Deserialize)] | |
struct Item<'a> { | |
id: i64, |
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 | |
# Simple pattern for exporting a query from postgres into jsonl using psql \copy command | |
pg_url=$POSTGRES_URL | |
fpath=$FPATH | |
psql $pg_url > $fpath << EOF | |
\copy(select to_jsonb(r) as jl from (select * from my_table) r ) to stdout; | |
EOF |
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
#!/usr/bin/env python | |
""" standalone cli script for easy version bumping with pyproject. | |
""" | |
import argparse | |
import toml | |
import pathlib | |
import sys | |
import re | |
import os | |
import subprocess |
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
""" | |
Assuming you have pyproject.toml we will read in the current version tag into the environment tag: VERSION_TAG | |
This will be available in your workflow now. | |
Place this at the root of .github folder | |
""" | |
import toml | |
import os | |
import sys |
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. |
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
""" 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
{ | |
"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
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
# 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 |
NewerOlder