Skip to content

Instantly share code, notes, and snippets.

@laranea
laranea / Install
Last active February 25, 2020 13:17 — forked from ines/Install
Streamlit + spaCy
pip install streamlit
pip install spacy
python -m spacy download en_core_web_sm
python -m spacy download en_core_web_md
python -m spacy download de_core_news_sm
@laranea
laranea / powers_in_dash.py
Created February 25, 2020 07:20 — forked from treuille/powers_in_dash.py
Comparing Dash and Streamlit
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
app.layout = html.Div([
@laranea
laranea / interactive_google_oauth2.py
Created February 24, 2020 09:53 — forked from frankie567/interactive_google_oauth2.py
Interactive Google OAuth2 flow with Streamlit
import asyncio
import streamlit as st
from httpx_oauth.clients.google import GoogleOAuth2
st.title("Google OAuth2 flow")
"## Configuration"
client_id = st.text_input("Client ID")
@laranea
laranea / interactive_google_oauth2.py
Created February 24, 2020 09:53 — forked from frankie567/interactive_google_oauth2.py
Interactive Google OAuth2 flow with Streamlit
import asyncio
import streamlit as st
from httpx_oauth.clients.google import GoogleOAuth2
st.title("Google OAuth2 flow")
"## Configuration"
client_id = st.text_input("Client ID")
@laranea
laranea / sqlalchemy_snippet.py
Created January 14, 2020 07:27 — forked from mumumu/sqlalchemy_snippet.py
sqlalchemy snippet.
#!/usr/bin/env python
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String
from sqlalchemy.orm import sessionmaker
engine = create_engine('sqlite:///:memory:', echo=True)
Session = sessionmaker(bind=engine)
Base = declarative_base()
@laranea
laranea / sqlalchemy_snippet.py
Created January 14, 2020 07:27 — forked from mumumu/sqlalchemy_snippet.py
sqlalchemy snippet.
#!/usr/bin/env python
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String
from sqlalchemy.orm import sessionmaker
engine = create_engine('sqlite:///:memory:', echo=True)
Session = sessionmaker(bind=engine)
Base = declarative_base()
@laranea
laranea / upgrade_postgres
Created January 11, 2020 23:13 — forked from wosephjeber/upgrade_postgres
Upgrade from postgres 9.6.2 to 10.5 on OSX
## Following these commands should upgrade and migrate your existing database.
## This is an example of going from 9.6.2 to 10.5 on OSX.
## Be sure to update any version numbers based on the versions you're upgrading from and to.
## Adapted from https://stackoverflow.com/questions/24379373/how-to-upgrade-postgresql-from-version-9-6-to-version-10-1-without-losing-data
## Backup your database, just in case (replace databasename with your actual DB name)
pg_dump databasename > ~/Desktop/dev_dump
## Stop postgres
@laranea
laranea / genetic_function.py
Created January 6, 2020 19:32 — forked from xav-b/genetic_function.py
Genetic optimization of a trading strategy for zipline backtester
import time
import random
import math
import numpy as np
import logbook
log = logbook.Logger('Optimization')
from neuronquant.network.transport import ZMQ_Dealer
@laranea
laranea / hrtool.py
Created June 10, 2019 14:16 — forked from miratcan/hrtool.py
A python script to run hackerrank answers on your local. Just run it in the sample test cases folder that you downloaded from hackerrank.
import re
import glob
import subprocess
from os.path import exists
from sys import exit
INPUT_FOLDER = 'input/'
OUTPUT_FOLDER = 'output/'