Skip to content

Instantly share code, notes, and snippets.

View Samk13's full-sized avatar
πŸ€
Busy coding...

Sam Arbid Samk13

πŸ€
Busy coding...
View GitHub Profile
from langchain.chat_models import ChatOpenAI
from langchain.prompts import ChatPromptTemplate
from langchain.schema.output_parser import StrOutputParser
import requests
from bs4 import BeautifulSoup
from langchain.schema.runnable import RunnablePassthrough, RunnableLambda
from langchain.utilities import DuckDuckGoSearchAPIWrapper
import json
RESULTS_PER_QUESTION = 3
@Samk13
Samk13 / PowerShell.ps
Last active November 24, 2023 23:39
PowerShell commands
# Get motherboard model
Get-WmiObject win32_baseboard | Select-Object -Property Product
# Get the maximun capacity of the MB RAM in GB
Get-WmiObject -Class Win32_PhysicalMemoryArray | Select-Object -Property @{Name="MaxCapacityGB";Expression={$_.MaxCapacity / 1MB}}
# Get the current RAM installed
Get-WmiObject -Class Win32_PhysicalMemory | Measure-Object -Property Capacity -Sum | Select-Object @{Name="TotalGB"; Expression={ $_.Sum / 1GB }}
# Get list of connected storage devices
@Samk13
Samk13 / docker-compose.md
Last active December 1, 2023 23:54
docker compose commands

full video

Quick way to see if you did something wrong:

# list your docker compose
docker compose config

# list all images used
docker compose config --images 
@Samk13
Samk13 / Keycloak-docker-compose.yaml
Created February 3, 2024 14:50
Keycloak docker-compose setup
# https://www.youtube.com/watch?v=6ye4lP9EA2Y
version: '3'
services:
postgresql:
image: postgres:16
environment:
- POSTGRES_USER=keycloak
- POSTGRES_DB=keycloak
- POSTGRES_PASSWORD=SUPERsecret
volumes:
@Samk13
Samk13 / utils.py
Last active February 12, 2024 00:50
# https://github.com/inveniosoftware/invenio-communities/pull/1086/files#diff-6c07ffce9d2dd97c912da89fd4869787bdb49626a3fa278d466117cc8e489941
# Simplifying the function
def filter_dict_keys(src, keys):
"""Filter a dictionary based on a list of key paths."""
# Split the keys into top-level and nested keys
top_level_keys = [key for key in keys if "." not in key]
nested_keys = [key for key in keys if "." in key]