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
@berggren
berggren / timesketch_refactor.md
Last active August 29, 2015 14:09
Timesketch refactor roadmap

We need to do some initial refactor and clean up to give the project better maintainability and less complex Django magic. This will be done i multiple steps in seperate CLs. A rough roadmap follows.

  1. [DONE] API re-factor step 1 - Add tests - google/timesketch#8
  2. [DONE] Cleanup HTML and CSS - google/timesketch#15
  3. [DONE] Simplify SQL schema - google/timesketch#24
  4. [WiP] Refactor UI views - google/timesketch#22
  5. Clean up Sketch models - google/timesketch#25
  6. Clean up UserProfile models - google/timesketch#26
  7. API re-factor step 2 - google/timesketch#9
@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)
@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 / 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 / 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_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
### 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:
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(
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 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