Skip to content

Instantly share code, notes, and snippets.

View hamelsmu's full-sized avatar
💻
Always learning.

Hamel Husain hamelsmu

💻
Always learning.
View GitHub Profile
#!/usr/bin/env python
# coding: utf-8
# This notebook illustrates the use of a utility, `InferenceWrapper.df_to_emb` that can be used to perform inference in bulk.
# - **checkpointed model** (2.29 GB):
# `https://storage.googleapis.com/issue_label_bot/model/lang_model/models_22zkdqlr/best_22zkdqlr.pth`
@hamelsmu
hamelsmu / markdown-details-collapsible.md
Created December 20, 2019 03:23 — forked from pierrejoubert73/markdown-details-collapsible.md
How to add a collapsible section in markdown.

A collapsible section containing markdown

Click to expand!

Heading

  1. A numbered
  2. list
    • With some
    • Sub bullets
@hamelsmu
hamelsmu / example
Last active January 16, 2020 21:29
Just paste this into your markdown
<link href="https://unpkg.com/@primer/css/dist/primer.css" rel="stylesheet" />
<div class="Toast">
<span class="Toast-icon">
{% octicon info %}
</span>
<span class="Toast-content">You can add these components, too!</span>
</div>
@hamelsmu
hamelsmu / vertical-line-altair.py
Created January 18, 2020 01:37
How to make vertical line in altair
from vega_datasets import data as vega_data
import pandas as pd
import altair as alt
data = pd.read_json(vega_data.gapminder.url)
data2000 = data.loc[data['year'] == 2000]
chart1 = alt.Chart(data2000).mark_line().encode(
alt.X('fertility:Q'),
@hamelsmu
hamelsmu / convert_nb2blog.py
Last active January 22, 2020 20:01
Monkey Patch nbdev for Jupyter Blog Posts
from nbdev import export2html
from nbdev.export2html import Config, Path, _re_digits
## Monkey Patch Nbdev For Jupyter Blog Posts ##
def _nb2htmlfname(nb_path, dest):
if dest is None: dest = Config().doc_path
return Path(dest)/_re_digits.sub('', nb_path.with_suffix('.md').name)
## apply monkey patch
export2html._nb2htmlfname = _nb2htmlfname
@hamelsmu
hamelsmu / fastpages.md
Last active February 24, 2020 21:35
Sharing Information With Jupyter Notebooks: A Data Scientist's Struggle
  1. Sally creates this notebook which contain interactive visualizations. She saves the notebook to GitHub.

  2. Sally wants to share this report with her colleagues on twitter, preferrably as a blog post. However, she cannot share her notebook via a GitHub link due of the following issues:

    • GitHub doesn't support rendering her interactive visualizations, even when all the code is client side, like the case with Vega-Lite or Altair. (That is why you don't see any visualizations in this notebook on GitHub!)
    • There is no place for colleague to comment on the notebook or provide feedback easily.
    • Sally wants to hide / show code to make the document easier to read, and remove extreanous information. It is impossible to do this without copying her notebook and creating an alternate version.
  • Sally needs the ability to hide/show code in collapsable cells in certain
@hamelsmu
hamelsmu / binder.yaml
Created May 20, 2020 21:37
Label your pull requests with mybinder.org links. This allows collaborators to view your files in a Jupyter Notebook environment with correct dependencies without cloning or building your repo.
name: Binder
on:
pull_request:
types: [opened, reopened]
jobs:
Create-Binder-Badge:
runs-on: ubuntu-latest
steps:
from multiprocessing import Pool
from time import sleep
def f(x):
sleep(1000) # simulate some computation
return x*x
if __name__ == '__main__':
with Pool(8) as p:
print(p.map(f, range(8)))
@hamelsmu
hamelsmu / mlops.md
Last active July 30, 2020 13:35
The Git + Data tool I always wanted

install MLOps

brew install mlops

clone repo as usual

If metadata data.yaml is detected in the root of the repo, the plugin mlops will automatically ask user if they would like to download the data.

> git clone https://github.com/david/ml
@hamelsmu
hamelsmu / checkbox-matrix.md
Last active September 17, 2020 16:44
How to have a matrix with checkboxes in GitHub-flavored markdown
Criteria @danfrankj @hamelsmu
Row One
Row Two -[ ] -[x]