Skip to content

Instantly share code, notes, and snippets.

View pchalasani's full-sized avatar

Prasad Chalasani pchalasani

View GitHub Profile
@pchalasani
pchalasani / chainlit-nested-ask.py
Created February 3, 2024 17:45
Chainlit: Trying to nest AskUserMessage under a step
from typing import Any, Callable, cast, Optional, Union
import textwrap
import chainlit as cl
from datetime import datetime
from chainlit.sync import run_sync
from chainlit.message import AskMessageBase, AskUserMessage, MessageStepType
from chainlit.types import AskSpec
from chainlit.step import StepDict
from chainlit.config import config
from chainlit.telemetry import trace_event
/Users/pchalasani/Git/langroid-examples/.venv/lib/python3.11/site-packages/langroid/parsing/docu │
│ ment_parser.py:301 in iterate_pages │
│ │
│ 298 │ def iterate_pages(self) -> Generator[Tuple[int, Any], None, None]: # type: ignore │
│ 299 │ │ from unstructured.partition.pdf import partition_pdf │
│ 300 │ │ │
│ ❱ 301 │ │ elements = partition_pdf(file=self.doc_bytes, include_page_breaks=True) │
│ 302 │ │ for i, el in enumerate(elements): │
│ 303 │ │ │ yield i, el │
│ 304 │
@pchalasani
pchalasani / arb-bot.py
Created April 17, 2022 21:30
Example using blankly add_arbitrage_event
import blankly
from blankly import StrategyState
import numpy as np
def trade(state: StrategyState):
'''
Example of how to decide a trade based on ALL assets
'''
symbols = state.symbol
@pchalasani
pchalasani / blankly-multi-asset.py
Last active April 17, 2022 20:07
Example of using blankly to decide trade based on all asset prices using a global state-list
'''
Example of using blankly to decide trade based on all asset prices using a global state-list
'''
import blankly
import numpy as np
# global list of StrategyStates, one per symbol (price_event)
states = []
def trade():
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.yahoo.floura</groupId>
<artifactId>floura</artifactId>
<version>2.0.0</version>
<packaging>jar</packaging>
<name>floura</name>
<properties>
<maven.compiler.source>1.7</maven.compiler.source>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.yahoo.floura</groupId>
<artifactId>floura</artifactId>
<version>2.0.0</version>
<packaging>jar</packaging>
<name>floura</name>
<properties>
<maven.compiler.source>1.7</maven.compiler.source>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.yahoo.floura</groupId>
<artifactId>floura</artifactId>
<version>2.0.0</version>
<packaging>jar</packaging>
<name>floura</name>
<properties>
<maven.compiler.source>1.7</maven.compiler.source>
@pchalasani
pchalasani / gist:58f008dc32205701f5d3
Created May 13, 2015 13:59
spark-sql hive read time out
This file has been truncated, but you can view the full file.
Logged in as: prasadch
Logs for container_1428474791204_251895_01_000001
ResourceManager
RM Home
NodeManager
Tools
@pchalasani
pchalasani / HyperLogLog
Created December 19, 2012 16:17
Cascalog Example
;; Create a map without quoting: (an interesting defmacro exercise!)
;; (qmap city nyc population 14000000)
;; => {"city" "nyc", "population" "14000000"}
;; (some special chars still need to be quoted though!)
(defmacro qmap [& args]
`(apply hash-map (map name (map str '~args))))
;; conf settings: