Skip to content

Instantly share code, notes, and snippets.

View ssghost's full-sized avatar
🏠
Working from home

Stardust Song ssghost

🏠
Working from home
View GitHub Profile
@ssghost
ssghost / omniparse_googlecolab.ipynb
Created July 4, 2024 12:46
OmniParse_GoogleColab.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
from itertools import combinations
from typing import List, Set
def brute_set_cover(universe: Set[int], setlist: List[Set[int]]) -> int, List[Set[int]]:
n = len(setlist)
res = []
for i in range(1, n+1):
for subset in combinations(setlist, i):
if set.union(*subset) == universe:
res.append(subset)
from typing import List, Dict
def sack_dp(items: List[Dict[str, int]], capacity: int) -> int, List[Dict[str,int]]:
n = len(items)
dp = [[0 for _ in range(capacity+1)] for _ in range(n+1)]
for i in range(1, n+1):
for w in range(1, capacity+1):
if items[i-1]['weight'] <= w:
dp[i][w] = max(items[i-1]['value']+dp[i-1][w+items[i-1]['weight']], dp[i-1][w])
@ssghost
ssghost / MD_BUTTONS_DOCS.md
Created May 18, 2024 04:07 — forked from cxmeel/MD_BUTTONS_DOCS.md
Documentation for markdown buttons.

Markdown Buttons

A collection of SVG buttons for displaying custom "buttons" in Markdown content. You are free to use these buttons wherever you like. All buttons were created in Figma, with (most) icons provided by the Iconify plugin.

Sponsor on GitHub View Itch.io Store

The SVG files can be found on this gist. They have been separated in order to reduce the amount of lag when loading this README file.

use std::fs::{File, remove_file};
use std::io::{Read, Write};
use orion::hazardous::{
aead::xchacha20poly1305::{seal, open, Nonce, SecretKey},
mac::poly1305::POLY1305_OUTSIZE,
stream::xchacha20::XCHACHA_NONCESIZE,
};
use orion::hazardous::stream::chacha20::CHACHA_KEYSIZE;
@ssghost
ssghost / chatbot-arena-mle-elo-rating-bradley-terry-model-calculation-apr-9-2024.ipynb
Created April 19, 2024 21:03
Chatbot Arena: MLE Elo Rating (Bradley-Terry model) Calculation (Apr 9, 2024)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ssghost
ssghost / tvta.py
Last active April 14, 2024 00:10
from tradingview_ta import TA_Handler, Interval
import requests
import timeout_decorator
@timeout_decorator.timeout(300)
def tvta():
symbols = ["BTCUSDT", "ETHUSDT", "SOLUSDT", "BCHUSDT"]
for sym in symbols:
handler = TA_Handler(symbol=sym, screener='crypto', exchange='BINANCEUS', interval=Interval.INTERVAL_1_DAY)
import hashlib
from starlette.applications import Starlette
from starlette.requests import Request
from starlette.responses import PlainTextResponse
from starlette.routing import Route
async def online_sha256(stream) -> bytes:
hasher = hashlib.sha256()
use pyo3::prelude::*;
#[pyclass]
#[derive(Debug, Clone, PartialEq)]
enum AttachmentType {
Image,
Video,
Audio,
File,
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.