Skip to content

Instantly share code, notes, and snippets.

@akarve
akarve / app.coffee
Last active August 29, 2015 14:10
Framer JS draggable inside scrollVertical Layer (works on desktop, does not work on mobile)
bg = new BackgroundLayer backgroundColor:"black"
scroll_panel = new Layer
height: bg.height
width: bg.width
backgroundColor: "transparent"
scroll_panel.scrollVertical = true
scroll_content = new Layer
width: bg.width
@akarve
akarve / og-boilerplate.html
Last active November 12, 2023 13:35
Facebook Open Graph tags. Boilerplate for HTML pages.
<!-- Reference: https://developers.facebook.com/docs/sharing/best-practices#tags -->
<!-- CORE og -->
<!-- Title, without branding. -->
<meta property="og:title" content="" />
<!-- Name, not URL (e.g. Apple, not apple.com) -->
<meta property="og:site_name" content="" />
<!-- URL. Should match canonical URL for SEO. Unique identifier for your article. -->
<meta property="og:url" content="" />
<!-- OPTIONAL description. 2-4 sentences. -->
<meta property="og:description" content="" />
@akarve
akarve / Anscombe's Quartet
Last active October 28, 2016 05:21 — forked from ebressert/Anscombe's Quartet
updated for python 3 and immediate display
import seaborn as sns
from scipy.optimize import curve_fit
# Function for linear fit
def func(x, a, b):
return a + b * x
# Seaborn conveniently provides the data for
# Anscombe's quartet.
df = sns.load_dataset("anscombe")
@akarve
akarve / right-estimator-cheat-sheet.txt
Last active April 4, 2018 08:09
Choosing the right machine learning algorithm
Adapted from [scikit learn cheat sheet](http://scikit-learn.org/stable/tutorial/machine_learning_map/index.html).
* More than 50 samples?
* No
* Get more data
* Yes
* Predicting a category?
* No
* Predicting a quantity?
* No
@akarve
akarve / notebook.py
Last active July 24, 2018 07:26
Display images from a Quilt package
from quilt.data.robmarkcole import birds_vs_not_birds as birds
from quilt.asa.img import plot
%matplotlib inline
birds.birds(asa=plot())
@akarve
akarve / indexer.py
Last active January 30, 2019 23:16
def handler(event, context):
for record in event['Records']:
try:
response = S3_CLIENT.get_object(Bucket=bucket, Key=key)
eventname = record['eventName']
bucket = unquote(record['s3']['bucket']['name'])
if eventname == 'ObjectRemoved:Delete':
event_type = 'Delete'
post_to_es(event_type, 0, '', key, {})
continue
NB_VERSION = 4
def extract_text(notebook_str):
formatted = nbformat.reads(notebook_str, as_version=NB_VERSION)
text = []
for cell in formatted.get('cells', []):
if 'source' in cell and 'cell_type' in cell:
if cell['cell_type'] == 'code' or cell['cell_type'] == 'markdown':
text.append(cell['source'])
def post_to_es(event_type, size, text, key, meta, version_id=''):
ES_HOST = os.environ['ES_HOST']
ES_INDEX = 'drive'
data = {
'type': event_type,
'size': size,
'text': text,
'key': key,
@akarve
akarve / code_samples.md
Created November 1, 2019 02:04 — forked from armandmcqueen/code_samples.md
[WIP] New API usecases and associated code samples

Quilt Package Usecases

Introduction

This document outlines several key use cases and proposes code samples to satisfy those usecases. Both usecases and code samples are open to discussion.

The document is about UX, not implementation. It does not go much into performance needs, but the expectation is that the implementation will be written such that any API we expose is as high-performance as possible.

API names are rough and will need to be improved.

pip install quilt3
# Note: installing COCO requires at least 21GB of disk
quilt3 install cv/coco2017 \
--top-hash 3722a4 \
--dest ./detectron2/datasets/coco/ \
--registry s3://quilt-ml