Skip to content

Instantly share code, notes, and snippets.

@erangaeb
erangaeb / mental-reasoning.csv
Created March 29, 2025 09:56
mental reasoning dataset
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 4.
conversation,reasoning,diagnosis
"Patient: I feel on top of the world, barely sleep, and started multiple projects. Doctor: Are your thoughts racing? Patient: Yes, I can't stop talking or thinking. (Sample 0)","Elevated mood, decreased need for sleep, increased goal-directed activity, and pressured speech indicate a manic episode consistent with Bipolar I Disorder.","Bipolar I Disorder, Current Episode Manic (DSM-5 296.41)"
Patient: I've been feeling really down for weeks and I don't enjoy anything anymore. Doctor: How is your sleep and appetite? Patient: I can't sleep and I've lost my appetite. (Sample 1),"The patient reports a persistent depressed mood, anhedonia, insomnia, loss of appetite, and hopelessness lasting more than two weeks. These symptoms align with the diagnostic criteria for Major Depressive Disorder as per DSM-5.",Major Depressive Disorder (DSM-5 296.21)
"Patient: I suddenly feel like I can't breathe and my heart races. Doctor: Do these happen without warning? Patient: Yes, and I worry about
@erangaeb
erangaeb / stride-llama-response
Created March 25, 2025 18:06
stride-llama response
{
"image": "images/mobile_app_architecture.png",
"prompt": "Analyze this system architecture for STRIDE threats. Output a table with Component, STRIDE Category, Threat Description, and Mitigation.",
"response": "Component: Mobile App
Category: Information Disclosure
Threat: Unencrypted data in transit
Mitigation: Use TLS for all communications.
Component: API Gateway
Category: Denial of Service
{
"image": "images/webapp_diagram_01.png",
"prompt": "Given this threat diagram, identify the STRIDE threats and categorize them by components.",
"response": {
"Web Server": [
{
"threat": "Spoofing",
"description": "Unverified clients may impersonate legitimate users if authentication is weak.",
"mitigation": "Implement strong authentication with MFA."
},
@erangaeb
erangaeb / NISTControlParser.scala
Created February 17, 2025 22:56
NIST control parser with control guide
import scala.util.matching.Regex
object NISTControlParser extends App {
// Function to split the text into control questions and control description
def processControlText(controlId: String, text: String): (List[String], String) = {
val sections = text.split("(?i)Supplemental Guidance:").map(_.trim)
// Extract the control part before Supplemental Guidance
val controlDescription = if (sections.length > 1) sections(1) else ""
@erangaeb
erangaeb / NISTControlParser.scala
Created February 17, 2025 22:50
parse nist control statement
import scala.util.matching.Regex
object NISTControlParser extends App {
def generateQuestions(controlId: String, text: String): List[String] = {
val lines = text.stripMargin.split("\n").map(_.trim).filter(_.nonEmpty).toList
val questionList = scala.collection.mutable.ListBuffer[String]()
val regex: Regex = """^([a-z]+|\d+)\.\s*(.*)""".r // Matches lines like "a. Identifies..." or "1. When accounts..."
@erangaeb
erangaeb / control-parser.py
Created February 17, 2025 22:47
nist control parser
import re
# Input text (NIST 800-53 control AC-2 example)
nist_control_text = """
a. Identifies and selects the following types of information system accounts to support organizational missions/business functions: [Assignment: organization-defined information system account types];
b. Assigns account managers for information system accounts;
c. Establishes conditions for group and role membership;
d. Specifies authorized users of the information system, group and role membership, and access authorizations (i.e., privileges) and other attributes (as required) for each account;
e. Requires approvals by [Assignment: organization-defined personnel or roles] for requests to create information system accounts;
f. Creates, enables, modifies, disables, and removes information system accounts in accordance with [Assignment: organization-defined procedures or conditions];
@erangaeb
erangaeb / w-538.json
Last active June 26, 2024 03:14
w-528 nft schema to represent medicine recipe
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Medical Recipe NFT",
"type": "object",
"properties": {
"tokenId": {
"type": "string",
"description": "Unique identifier for the NFT"
},
"recipeName": {
--------------------------- MODULE BlockchainTransactions ---------------------------
EXTENDS Integers, Sequences, TLC
(*-- Constants used in the specification --*)
CONSTANT Clients, KafkaNodes, SmartContracts, StorageNodes, CacheNodes, LokkaServices
(*-- The set of all possible transactions --*)
VARIABLE transactions, messageBroker, blockchainStorage, distributedCache, blocks
(* -- Define the initial state of the blockchain system --*)
{
"token_id": "pbom123",
"timestamp": "2023-11-01T12:30:00Z",
"package": {
"package_id": "pkg789",
"package_name": "example_app"
},
"pull_requests": [
{
"id": "pr456",
{
"token_id": "string",
"timestamp": "string",
"package": {
"package_id": "string",
"package_name": "string"
},
"pull_requests": [
{
"id": "string",