Skip to content

Instantly share code, notes, and snippets.

View sebastianschramm's full-sized avatar

Sebastian M. Schramm sebastianschramm

View GitHub Profile
@sebastianschramm
sebastianschramm / geopolitical-simulator.md
Created February 25, 2026 18:39
Geopolitical Simulator Claude Code Skill

name: geo-sim description: > Simulate geopolitical conflicts and diplomatic crises using a virtual war room of AI-modeled state actors. Trigger explicitly on:

  • "simulate a conflict / scenario"
  • "war game a scenario"
  • "how would countries respond to"
  • "geopolitical / diplomatic crisis simulation"
  • "model a trade war / sanctions"
@sebastianschramm
sebastianschramm / SKILL.md
Created February 25, 2026 16:53
Geopolitical Scenario Simulator Claude Code Skill

name: war-room description: > Simulate geopolitical conflicts and diplomatic crises using a virtual war room of AI-modeled state actors. Use this skill explicitly when the user requests:

  • "simulate a conflict"
  • "war game a scenario"
  • "how would countries respond to"
  • "geopolitical simulation"
  • "diplomatic crisis simulation"
@sebastianschramm
sebastianschramm / classifier_litserver.py
Created August 28, 2024 08:45
LitServe API for toxicity classifier
import torch
from litserve import LitAPI, LitServer
from pydantic import BaseModel, conint
from pydantic_settings import BaseSettings
from transformers import AutoModelForSequenceClassification, AutoTokenizer
class ToxicitySettings(BaseSettings):
model_id: str = "s-nlp/roberta_toxicity_classifier"
port: conint(ge=1024, le=65535) = 8000 # type: ignore
@sebastianschramm
sebastianschramm / ner_with_uniner-7b-definition-gptq-4bit.ipynb
Created August 27, 2023 11:21
ner_with_uniner-7b-definition-gptq-4bit.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sebastianschramm
sebastianschramm / ner_with_uniner-7b-type-gptq-4bit.ipynb
Created August 27, 2023 11:15
ner_with_uniner-7b-type-gptq-4bit.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sebastianschramm
sebastianschramm / ner_with_uniner-7b-all-gptq-4bit.ipynb
Created August 26, 2023 11:29
NER_with_UniNER-7B-all-GPTQ-4bit.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sebastianschramm
sebastianschramm / union_operator_for_typing.py
Created August 31, 2022 16:45
How to use the union operator instead of Union for typing
from typing import Union
def is_valid_type(object):
return isinstance(object, Union[str, None])
def is_valid_type_new(object):
return isinstance(object, str | None)
@sebastianschramm
sebastianschramm / pandas_testing.py
Created August 30, 2022 16:34
How to use pandas testing assert_frame_equal
import pandas as pd
from pandas.testing import assert_frame_equal
df_one = pd.DataFrame(
{"city": ["Tokyo", "Delhi"], "population": [13_515_271, 16_753_235]}
)
df_two = df_one[["population", "city"]].copy(deep=True)
assert_frame_equal(left=df_one, right=df_two)
@sebastianschramm
sebastianschramm / zip_strict.py
Created August 29, 2022 13:11
How to use zip with strict since py3.10
names = ['a', 'b', 'c']
values = [10, 54, 2]
values_too_long = values + [10]
"""
>>> {k: v for k, v in zip(names, values_too_long, strict=True)}
ValueError: zip() argument 2 is longer than argument 1
>>> {k: v for k, v in zip(names, values_too_long, strict=False)}
{'a': 10, 'b': 54, 'c': 2}
@sebastianschramm
sebastianschramm / pandarallel_apply.py
Created August 26, 2022 14:53
An easy way to parallelize pandas.apply processing
import pandas as pd
from pandarallel import pandarallel
from sklearn.datasets import fetch_20newsgroups
def preprocess_text(row: pd.Series) -> float:
return [word.lower() for word in row.text.split()]
def get_data() -> pd.DataFrame: