Start up a lambda-like docker container:
docker run -i -t -v /tmp:/var/task lambci/lambda:build /bin/bash
Install some dependencies inside the container:
yum install gperf freetype-devel libxml2-devel git libtool -y
easy_install pip
A::B is a system with 4 tokens: `A#`, `#A`, `B#` and `#B`. | |
An A::B program is a sequence of tokens. Example: | |
B# A# #B #A B# | |
To *compute* a program, we must rewrite neighbor tokens, using the rules: | |
A# #A ... becomes ... nothing | |
A# #B ... becomes ... #B A# |
# %% | |
# this is run from /notebooks on paperspace | |
from huggingface_hub import login | |
from dotenv import load_dotenv | |
load_dotenv("/notebooks/.env") | |
import os | |
os.environ["TOKENIZERS_PARALLELISM"]="false" | |
login(token=os.getenv("HUGGINGFACE_TOKEN")) |
""" | |
Demo script for writing a pandas data frame to a CSV file on S3 using s3fs-supported pandas APIs | |
""" | |
import os | |
import pandas as pd | |
AWS_S3_BUCKET = os.getenv("AWS_S3_BUCKET") | |
AWS_ACCESS_KEY_ID = os.getenv("AWS_ACCESS_KEY_ID") |
set backspace=2 | |
set autoindent | |
set smartindent | |
set expandtab | |
set et | |
set tabstop=4 | |
set shiftwidth=4 | |
set showmatch | |
set ignorecase | |
set incsearch |
def plot_multi(data, cols=None, spacing=.1, **kwargs): | |
from pandas import plotting | |
# Get default color style from pandas - can be changed to any other color list | |
if cols is None: cols = data.columns | |
if len(cols) == 0: return | |
# colors = getattr(getattr(plotting, '_style'), '_get_standard_colors')(num_colors=len(cols)) | |
# colors = [rand_color.generate() for _ in range(len(cols))] | |
# colors = rand_color.generate(hue="blue", count=len(cols)) |
# Sorry for the scrappiness of this. It's supposed to be scrappy. | |
import time | |
from botocore.exceptions import ClientError | |
import boto3 | |
import boto3.session | |
# boto3.set_stream_logger('') | |
session = boto3.session.Session() | |
s3 = session.client('s3') |
axios({ | |
url: 'http://localhost:5000/static/example.pdf', | |
method: 'GET', | |
responseType: 'blob', // important | |
}).then((response) => { | |
const url = window.URL.createObjectURL(new Blob([response.data])); | |
const link = document.createElement('a'); | |
link.href = url; | |
link.setAttribute('download', 'file.pdf'); | |
document.body.appendChild(link); |