Skip to content

Instantly share code, notes, and snippets.

View cpoptic's full-sized avatar

Cpop cpoptic

View GitHub Profile
import datetime
import pandas as pd
from ib_insync import *
pd.set_option('display.max_rows', None)
ib = IB()
ib.connect('127.0.0.1', 7496, clientId=15)
contract = Stock('SPY', 'SMART', 'USD')
@SmartDataWithR
SmartDataWithR / pl_intro.py
Created September 18, 2022 08:35
PyTorch Lightning - complete code
#%% packages
# data handling
import numpy as np
from sklearn.datasets import fetch_california_housing
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import train_test_split
from sklearn.metrics import r2_score
# deep learning
import torch
import torch.nn as nn
@yashprakash13
yashprakash13 / app.py
Created April 4, 2021 17:26
FastApi example
import uvicorn
from fastapi import FastAPI
from model import SentimentModel, SentimentQueryModel
app = FastAPI()
model = SentimentModel()
@app.post('/predict')
def predict(data: SentimentQueryModel):
data = data.dict()
@ih2502mk
ih2502mk / list.md
Last active May 17, 2024 00:14
Quantopian Lectures Saved
@sivinnguyen
sivinnguyen / wsl2_200915_fix_dns_resolution.md
Last active April 12, 2024 07:30
Fix DNS resolution in WSL2

Error

$ sudo apt-get update
Err:1 http://archive.ubuntu.com/ubuntu focal InRelease
Temporary failure in name rerolution

$ host google.com
;; connection timed out; no servers could be reached
@okld
okld / multipage_settings_app.py
Last active September 25, 2023 13:50
Streamlit - Settings page with session state
import streamlit as st
from persist import persist, load_widget_state
def main():
if "page" not in st.session_state:
# Initialize session state.
st.session_state.update({
# Default page.
"page": "home",
@upkarlidder
upkarlidder / dl-resources.md
Last active June 18, 2022 08:32
Deep Learning Hands-On Series with Eric Schles
@claraj
claraj / git_submodule_fix.md
Last active April 7, 2024 13:37
Fixing git submodule AKA git repo inside another git repo

Problem, and symptoms:

You experience one or more of these symptoms

  • you have code in a directory but it's not being pushed to GitHub. You just see an empty directory icon
  • you see this message when you add code to your git repository from the command prompt
hint: You've added another git repository inside your current repository.
hint: Clones of the outer repository will not contain the contents of
hint: the embedded repository and will not know how to obtain it.
"""
Script to eveluation model
Usage:
python evaluate.py --dataset /path/to/folder/images --checkpoint /point/to/model
Example:
python evaluate.py --dataset /dataset/val --checkpoint /box20190222T1237/mask_rcnn_box_0019.h5
"""
import json