Skip to content

Instantly share code, notes, and snippets.

View andfanilo's full-sized avatar
Crazy Streamlitin'

Fanilo Andrianasolo andfanilo

Crazy Streamlitin'
View GitHub Profile
@andfanilo
andfanilo / st_ghapi_starhistory.py
Created March 21, 2022 18:11
Star History but in Python with Streamlit + ghapi + Plotly Express
import pandas as pd
import plotly.express as px
import streamlit as st
from ghapi.all import GhApi
from ghapi.all import pages
@st.experimental_singleton
def load_ghapi() -> GhApi:
@andfanilo
andfanilo / st_ghapi_reacted_issues.py
Last active March 21, 2022 18:10
Query to sort issues in Github project per number of +1 reactions
import streamlit as st
from ghapi.all import GhApi
@st.experimental_singleton
def load_ghapi():
return GhApi()
@andfanilo
andfanilo / js_in_notebook.ipynb
Created March 21, 2022 10:43
Compare JS and Python for manipulating some JSON
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@andfanilo
andfanilo / st_ipython_reader.py
Last active April 16, 2024 02:28
Streamlit IPython notebook Reader
"""
pip install nbconvert
https://nbconvert.readthedocs.io/en/latest/nbconvert_library.html
"""
import base64
import io
import nbformat
import streamlit as st
from PIL import Image
"""
streamlit run st_crop_image.py
"""
import streamlit as st
import numpy as np
from pathlib import Path
from PIL import Image
from PIL import ImageDraw
st.title("Cropping an Image in a circular way using Python")
@andfanilo
andfanilo / st_ipython_history.py
Last active March 18, 2024 11:05
Streamlit IPython History Browser
from dataclasses import dataclass
from datetime import datetime
import streamlit as st
from IPython.core.history import HistoryAccessor
@dataclass
class IPythonSession:
session_id: int
@andfanilo
andfanilo / st_yt_channel.py
Last active July 22, 2022 23:21
Very Quick Streamlit Youtube scripts
import os
import pickle
from pathlib import Path
import streamlit as st
from google.auth.transport.requests import Request
from google_auth_oauthlib.flow import InstalledAppFlow
from googleapiclient.discovery import build
def set_page_title(title):
st.sidebar.markdown(unsafe_allow_html=True, body=f"""
<iframe height=0 srcdoc="<script>
const title = window.parent.document.querySelector('title') \
const oldObserver = window.parent.titleObserver
if (oldObserver) {{
oldObserver.disconnect()
}} \
import random
import time
import streamlit as st
from streamlit_echarts import st_echarts
MAX_ITERATIONS = 100
if "iteration" not in st.session_state:
st.session_state["iteration"] = 0
@andfanilo
andfanilo / st_keepass_browser.py
Created August 15, 2021 08:33
Streamlit keepass browser
"""
PS: all password entries are in cleartext between server and browser, DO NOT DEPLOY THIS ON A SERVER. EVER.
"""
from io import BufferedReader
from typing import Any
import streamlit as st
from construct import Container
from pykeepass import PyKeePass
from pykeepass.exceptions import CredentialsError