This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Genkit, type StreamingCallback } from "genkit"; | |
import { GenkitMcpHost } from '@genkit-ai/mcp'; | |
export function organizeMessages( | |
messages: { text: string; user: string; ts: string }[] | |
): { newMessages: string[], history: { role: 'user' | 'model', content: { text: string }[] }[] } { | |
const groups = messages.reduce((g, m) => { | |
const lastGroup = g[g.length - 1]; | |
const role = m.user === process.env['SLACK_BOT_USER_ID'] ? 'model' : 'user'; | |
m.text = role === 'user' ? `${m.user}: ${m.text}` : m.text |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Genkit } from "genkit"; | |
import { GenkitMcpHost } from '@genkit-ai/mcp'; | |
import { type StreamingCallback } from "genkit"; | |
export function organizeMessages( | |
messages: { text: string; user: string; ts: string }[] | |
): { newMessages: string[], history: { role: 'user' | 'model', content: { text: string }[] }[] } { | |
const groups = messages.reduce((g, m) => { | |
const lastGroup = g[g.length - 1]; | |
const role = m.user === process.env['SLACK_BOT_USER_ID'] ? 'model' : 'user'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"extends": ["@commitlint/config-conventional"] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import http from 'http'; | |
import url from 'url'; | |
const port = 80; | |
const requestListener = function (req, res) { | |
res.setHeader('Content-Type', 'application/json'); | |
res.setHeader('Access-Control-Allow-Origin', '*'); | |
res.writeHead(200); | |
res.end(JSON.stringify({ query: { echo: url.parse(req.url, true).query.echo.toUpperCase() }})); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Project Sdk="Microsoft.NET.Sdk.Web"> | |
<PropertyGroup> | |
<TargetFramework>net6.0</TargetFramework> | |
<Nullable>enable</Nullable> | |
<ImplicitUsings>enable</ImplicitUsings> | |
</PropertyGroup> | |
</Project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const http = require('http'); | |
const port = 8080; | |
const requestListener = function (req, res) { | |
res.setHeader('Content-Type', 'application/json'); | |
res.writeHead(200); | |
res.end(JSON.stringify({ msg: 'Hello, World!'})); | |
} | |
const server = http.createServer(requestListener); | |
server.listen(port); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Uninstall old versions | |
sudo apt-get remove docker docker-engine docker.io containerd runc | |
# Install using the repository | |
## Set up the repository | |
sudo apt-get update |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Linq; | |
class MorseCodeDecoder | |
{ | |
public static string Decode(string morseCode) | |
{ | |
var decoded = morseCode.Trim().Replace(" ", " ").Split(' ').Select(GetDecodedValue); | |
return string.Join(string.Empty, decoded); | |
} | |