Skip to content

Instantly share code, notes, and snippets.

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

Sebastian Stehle SebastianStehle

🏠
Working from home
View GitHub Profile
import { AgentExecutor, createOpenAIToolsAgent } from "langchain/agents";
import { pull } from "langchain/hub";
import { ChatOpenAI } from "@langchain/openai";
import type { ChatPromptTemplate } from "@langchain/core/prompts";
import { DallEAPIWrapper } from "@langchain/openai";
// Get the prompt to use - you can modify this!
// If you want to see the prompt in full, you can at:
// https://smith.langchain.com/hub/hwchase17/openai-tools-agent
using CsvHelper;
using CsvHelper.Configuration;
using System.Globalization;
class Entry
{
public string Timestamp { get; set; }
public string RequestPath { get; set; }
using Squidex.ClientLibrary;
using System.Text.Json;
var idsFile = File.ReadAllText("failed-ids.json");
var idsList = JsonSerializer.Deserialize<List<string>>(idsFile)!;
var appName = "ids-test";
var client = new SquidexClient(new SquidexOptions
{
// Das Objekt muss nur das abbilden was du auch wirklich brauchst. Du kannst JSON properties ignorieren, wenn du sie nicht brauchst.
// DOKU: https://github.com/square/moshi
class SensorData {
SensorStatus cloud;
SensorStatus mqtt;
// Der Json property name ist nicht in JAva, deshalb müssen wir hier den Namen überschreiben.
@Json(name = "script:10") SensorScript script;
}
// MQTT und Cloud teilen sich ja die gleiche Struktur
using Jint;
using Jint.Native;
using Jint.Runtime.Interop;
using System.Diagnostics.CodeAnalysis;
using System.Text.Json.Nodes;
using System.Collections;
using System.Runtime.CompilerServices;
using System;
using Squidex.Text;
using MongoDB.Bson;
using MongoDB.Driver;
using System.Diagnostics;
namespace MongoTest;
public class Program
{
public static async Task Main()
{
<script src="https://YOUR_DOMAIN/notifo-sdk.js"></script>
<script<script>
var notifo = notifo || [];
// YOUR CODE here.
notifo.push(['init', {
userToken: 'YOUR_USER_API_KEY'
});
</script>
<div id="notifo-button"></div>
const hotelsRegex = new RegExp(`${CONFIG.url}\\/api/content\\/${CONFIG.appName}\\/hotels/(?<id>[a-z0-9\\-]+)`);
export const Markdown = ({ markdown, references }) => {
return (
<ReactMarkdown children={markdown} components={{
a({ href, children }) {
const match = hotelsRegex.exec(href);
if (match && match.groups) {
const referenceId = match.groups.id;
{
"openapi": "3.0.0",
"info": {
"title": "Squidex Content API for 'self' App",
"description": "# Introduction\r\n\r\nThe API provides two specifications. The Content API usually returns one object per schema field where the keys are the languages (or `iv` for non-localized) fields and the values are the actual field values.\r\n\r\nYou can use the `X-Flatten` header to return a flat structure when you query content items. This is more performant and easier for code generation. Unfortunantely it cannot be modelled with OpenAPI. Therefore we provide two different documents for your API.\r\n\r\nRead more about this here: https://docs.squidex.io/02-documentation/concepts/localization#how-to-use-the-api\r\n\r\n## Normal Content API\r\n\r\nAll content fields are objects in the response.\r\n\r\nGo to: https://localhost:5001/api/content/self/docs/\r\n\r\n## Flat Content API\r\n\r\nAll content fields are single values.\r\n\r\nGo to: https://localhost:5001/api/content/self/docs/flat/",
"version": "1.0.0.
@SebastianStehle
SebastianStehle / ParseQuery.cs
Created November 9, 2021 19:44
Parses Lucene Query Syntax and converts it to Mongo Atlas format
// See https://aka.ms/new-console-template for more information
using Lucene.Net.Analysis.Standard;
using Lucene.Net.Index;
using Lucene.Net.QueryParsers.Classic;
using Lucene.Net.Search;
using Lucene.Net.Util;
using MongoDB.Bson;
using MongoDB.Bson.IO;
using System.Globalization;
using System.Text;