Skip to content

Instantly share code, notes, and snippets.

View sambarrowclough's full-sized avatar

sambarrowclough

View GitHub Profile
from contextlib import redirect_stdout
import pandas as pd
from langchain.chains import LLMChain
from langchain.chat_models import ChatOpenAI
from io import StringIO
from langchain import PromptTemplate
prompt_template = """
This is the head of the dataframe df {df_head}.
This is the list of df column names {df_columns}.
@ninely
ninely / main.py
Last active September 15, 2025 10:10
Langchain with fastapi stream example
"""This is an example of how to use async langchain with fastapi and return a streaming response.
The latest version of Langchain has improved its compatibility with asynchronous FastAPI,
making it easier to implement streaming functionality in your applications.
"""
import asyncio
import os
from typing import AsyncIterable, Awaitable
import uvicorn
from dotenv import load_dotenv
export const chaosTestStrings = (): void => {
const textNodes = getAllTextNodes(document.body);
for (const node of textNodes) {
const textNodeLength = node.textContent ? node.textContent.length : 0;
if (node.textContent === null) {
return;
}
if (node.parentElement instanceof Element) {
if (node.parentElement.dataset.originalText === undefined) {
@FelixZY
FelixZY / supabase_api_auth.sql
Last active July 12, 2025 12:59
How to configure Supabase (https://supabase.com/) to generate and accept API tokens.
-- Token Based API Access for Supabase
--
-- How to configure Supabase (https://supabase.com/) to generate and accept API tokens.
--
-- (c) 2022 Felix Zedén Yverås
-- Provided under the MIT license (https://spdx.org/licenses/MIT.html)
--
-- Disclaimer: This file is formatted using pg_format. I'm not happy with the result but
-- prefer to follow a tool over going by personal taste.
--
@K0lb3
K0lb3 / Twitter Guest Search.py
Last active May 3, 2025 17:03
public Twitter search as json
import requests
import re
class Twitter:
def __init__(self):
self.s = requests.Session()
self.get_tokens()
def get_tokens(self):
@GregRos
GregRos / startTerminator.vbs
Created April 27, 2019 00:20 — forked from ropnop/startTerminator.vbs
VBS Script to Launch Terminator through WSL
' terminator.vbs
myCd = "~"
If WScript.Arguments.Length > 0 Then
myCd = "'$(wslpath -u '" & WScript.Arguments(0) & "')'"
End If
args = "bash" & " -c ""cd " & myCd & "; DISPLAY=:0 terminator"""
WScript.CreateObject("Shell.Application").ShellExecute "C:\Windows\System32\wsl.exe", args, "", "open", 0
@kekru
kekru / 1-Enable Docker Remote API with TLS client verification.md
Last active September 20, 2025 16:38
Docker Remote API with client verification via daemon.json

Enable Docker Remote API with TLS client verification

Docker's Remote API can be secured via TLS and client certificate verification.
First of all you need a few certificates and keys:

  • CA certificate
  • Server certificate
  • Server key
  • Client certificate
  • Client key

Create certificate files

@owulveryck
owulveryck / dynamodbCreateTable.go
Last active October 29, 2019 20:21
Dynamodb operations
func createTable(svc *dynamodb.DynamoDB, tableName string) error {
params := &dynamodb.CreateTableInput{
AttributeDefinitions: []*dynamodb.AttributeDefinition{ // Required
{ // Required
AttributeName: aws.String("Key"), // Required
AttributeType: aws.String("S"), // Required
},
{ // Required
AttributeName: aws.String("SortKey"), // Required
AttributeType: aws.String("S"), // Required
@kndt84
kndt84 / authorize.js
Last active May 17, 2024 03:11
Sample code: how to refresh session of Cognito User Pools with Node.js and Express
const AWS = require('aws-sdk');
const CognitoUserPool = require('amazon-cognito-identity-js-node').CognitoUserPool;
const CognitoUserSession = require('amazon-cognito-identity-js-node').CognitoUserSession;
const CognitoUser = require('amazon-cognito-identity-js-node').CognitoUser;
const CognitoIdToken = require('amazon-cognito-identity-js-node').CognitoIdToken;
const CognitoAccessToken = require('amazon-cognito-identity-js-node').CognitoAccessToken;
const CognitoRefreshToken = require('amazon-cognito-identity-js-node').CognitoRefreshToken;
const cfg = require('config').config;
const COGNITO_IDENTITY_POOL_ID = cfg.COGNITO_IDENTITY_POOL_ID;
# GIT heart FZF
# -------------
is_in_git_repo() {
git rev-parse HEAD > /dev/null 2>&1
}
fzf-down() {
fzf --height 50% --min-height 20 --border --bind ctrl-/:toggle-preview "$@"
}