Skip to content

Instantly share code, notes, and snippets.

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

Johan Berggren berggren

🏠
Working from home
View GitHub Profile
<template>
<v-container v-if="appStore.activeLLM" fluid style="margin-top: 5vh">
<v-card flat class="mx-auto" max-width="700px" color="transparent">
<template v-slot:title>
<h2>Forensic Research Assistant</h2>
</template>
<template v-slot:subtitle>
Connected to
<strong>{{ appStore.activeLLM.display_name }}</strong> using model
<strong>{{ appStore.activeLLM.model }}</strong>
import re
from fastapi import APIRouter
from pydantic import BaseModel
from typing import List
from api.datastores.chroma import VectorStore
from api.plugins.llms import manager
import requests
from markdownify import markdownify
from bs4 import BeautifulSoup
from collections.abc import Generator
from api.datastores.chroma import VectorStore
BASE_URL = "https://forensics.wiki/tags/"
import chromadb
class VectorStore:
def __init__(self, collection_name) -> None:
self.client = chromadb.PersistentClient(path="/tmp/embeddings.vector")
self.collection_name = collection_name
self.collection = self.client.get_or_create_collection(collection_name)
def embed_documents(
### Keybase proof
I hereby claim:
* I am berggren on github.
* I am j4711 (https://keybase.io/j4711) on keybase.
* I have a public key ASDRG5dDQ2rOVb0LPiEq_d7ftkxd_1JKJ8wvg3x0RnYUHgo
To claim this, I am signing this object:
@berggren
berggren / example_test_sketch_analyzer.py
Created November 7, 2018 10:08
Example test for sketch analyzer
"""Tests for aggregations."""
from __future__ import unicode_literals
import mock
from timesketch.lib.analyzers.the_sketch_analyzer import TheSketchAnalyzer
from timesketch.lib.testlib import BaseTest
from timesketch.lib.testlib import MockDataStore
@berggren
berggren / example_sketch_analyzer.py
Last active November 7, 2018 10:06
Example sketch analyzer for Timesketch
"""TheSketchAnalyzer."""
from __future__ import unicode_literals
from timesketch.lib.analyzers import interface
from timesketch.lib.analyzers import manager
class TheSketchAnalyzer(interface.BaseSketchAnalyzer):
"""The Sketch Analyzer."""
@berggren
berggren / example_index_analyzer.py
Last active November 7, 2018 10:06
Example index analyzer task for Timesketch
"""TheIndexAnalyzer."""
from __future__ import unicode_literals
from timesketch.lib.analyzers import interface
from timesketch.lib.analyzers import manager
class TheIndexAnalyzer(interface.BaseIndexAnalyzer):
"""The Index Analyzer."""
@berggren
berggren / gist:efadf2cb97cece8ca19546765ccddeee
Created December 20, 2016 22:18
Timesketch CSV example
message,timestamp,datetime,timestamp_desc,extra_field_1,extra_field_2
A message,123456789,2015-07-24T19:01:01+00:00,Write time,foo,bar
...
@berggren
berggren / ts-api-client.py
Last active October 3, 2016 11:27
Minimal Timesketch API client in Python
import requests
import BeautifulSoup
class TimesketchApiClient():
def __init__(self, host, username, password):
self.host = host
self.host_url = u'http://{0:s}:5000'.format(self.host)
self.session = self._CreateSession(username, password)