Skip to content

Instantly share code, notes, and snippets.

View andfanilo's full-sized avatar
🎈
Streamlitin'

Fanilo Andrianasolo andfanilo

🎈
Streamlitin'
View GitHub Profile
@andfanilo
andfanilo / DataFrameTesting.scala
Created May 24, 2016 11:49
An implementation of DataFrame comparison functions from spark-testing-base's DataFrameSuiteBase trait in specs2
package utils
import org.apache.spark.rdd.RDD
import org.apache.spark.sql.types.StructType
import org.apache.spark.sql.{DataFrame, Row}
import org.specs2.matcher.{Expectable, Matcher}
import org.specs2.mutable.Specification
/**
* Utility class to compare DataFrames and Rows inside unit tests
@andfanilo
andfanilo / NoSQL_demo_README.md
Last active January 18, 2022 14:47
NoSQL Docker demo

NoSQL Docker demo

Here is a Docker compose file which starts redis, mongo, cassandra and neo4j containers for demonstration purposes.

Cluster

If you want to start all at once !

Start : docker-compose up

@andfanilo
andfanilo / launch-kaggle-python-notebook.sh
Last active June 6, 2022 10:04
Run Jupyter notebook in a local kaggle/python docker container
docker run -v $PWD:/tmp/working -w=/tmp/working --rm -it -p 8888:8888 kaggle/python jupyter notebook --no-browser --ip=* --allow-root --NotebookApp.token="" --notebook-dir=/tmp/working
@andfanilo
andfanilo / productivity.sh
Last active November 25, 2020 17:02
Set of python CLI tools for productivity
conda create -n productivity python=3.7
conda activate productivity
conda install ffmpeg
# conda install nginx
# conda install nodejs
# conda install rust
pip install -r requirements.txt
# to regenerate requirements.txt
pip install pip-tools
@andfanilo
andfanilo / analytics.sh
Last active September 28, 2020 12:34
pip packages for analytics environment in Python
conda create -n analytics python=3.7
conda activate analytics
#conda install pytorch-cpu torchvision-cpu torchvision torchtext -c pytorch
# if pip-compile doesn't work you can just pip install requirements.in
pip install pip-tools
pip-compile requirements.in
pip install -r requirements.txt
# Jupyter lab extensions
[alias]
lg1 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
lg2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all
lg = !"git lg1"
@andfanilo
andfanilo / app.py
Last active June 10, 2020 07:33
[Streamlit] Altair version of Gapminder vega-lite demo
import altair as alt
import streamlit as st
from vega_datasets import data
chart = None
@st.cache
def get_data():
return data.gapminder_health_income()
@andfanilo
andfanilo / README.md
Last active November 20, 2020 07:21
[Streamlit] Vega Datasets explorer

I had started a Vega Explorer datasets Streamlit app. Feel free to reuse it.

pip install altair matplotlib pandas streamlit scikit-learn vega_datasets
streamlit run vega_datasets_explorer.py
@andfanilo
andfanilo / README.md
Created June 10, 2020 07:32
[Streamlit] Access request HTTP headers

streamlit/streamlit#1083 (comment)

from streamlit.server.Server import Server
import streamlit as st

def get_headers():
    # Hack to get the session object from Streamlit.

 current_server = Server.get_current()
@andfanilo
andfanilo / jupyter_things.md
Last active November 13, 2020 09:25
Jupyter things

Jupyter kernels for Jupyterhub

Ref

You can use your own conda environments within Jupyterhub as a Kernel. Make sure the library "ipykernel" is installed in your environment. If not, you will have to install it before you proceed : conda install ipykernel

# Activate your environment 
conda activate yourEnvName